#!/usr/bin/php
<?php
# Cancerbero Plugin: ips_without_dns_resolution ver.1
# Plugin data.
$plugin_name = "IPs without DNS Resolution";
$description = "Generate an Alert if the host has not DNS resolution";
$version = "1";
$alerts = array("No DNS Resolution"=>array ("Medium", "on"));
# Include functions
include_once(dirname(__FILE__) ."/../include/dbconnect.php");
include_once(dirname(__FILE__) ."/../include/functions_plugins.php");
if (!isset ($argv[1])) {
insert_new_plugin ($plugin_name, $description, $alerts, $version);
exit;
}
# scan_rec_id (argument supplied)
$scan = $argv[1];
$host_id_query = mysql_query("SELECT scans.host_id, ip, hostname FROM scans,hosts WHERE scan_rec_id = $scan and scans.host_id = hosts.host_id") or die ('Querry failed1: ' . mysql_error());
while ($host = mysql_fetch_row($host_id_query)){
$host_id = $host[0];
$ip = $host[1];
$hostname = $host[2];
}
if ( $hostname == "NO DNS") {
$alerts_found[" 65536 "]["No DNS Resolution"] = array ("No resolution found","","");
insert_alerts($scan, $alerts_found);
echo "inserto NO DNS\n";
}
?>