Ejemplo n.º 1
0
}
if (is_int($minute / 1) and $jobs_run == '0') {
    // Run the 1 minute jobs
    $jobs_run = 1;
    $sql = "SELECT * FROM scan_type WHERE scan_type_frequency = '1' ORDER BY scan_type_frequency, scan_type_id";
} else {
    // Check for other intervals
}
include "include_config.php";
mysql_connect($mysql_server, $mysql_user, $mysql_password) or die("Could not connect");
mysql_select_db($mysql_database) or die("Could not select database");
$result = mysql_query($sql);
if ($myrow = mysql_fetch_array($result)) {
    do {
        if ($myrow["scan_type"] == "port") {
            $result_scan = port_scan($myrow['scan_type_ip_address'], $myrow['scan_type_detail']);
            if ($result_scan == "down" or $result_scan == "closed") {
                $success = "n";
            } else {
                $success = "y";
            }
            $sql_insert = "INSERT INTO scan_log (scan_log_uuid, scan_log_ip_address, scan_log_type, scan_log_detail, ";
            $sql_insert .= "scan_log_frequency, scan_log_date_time, scan_log_result, scan_log_success) VALUES ('";
            $sql_insert .= $myrow['scan_type_uuid'] . "','";
            $sql_insert .= $myrow['scan_type_ip_address'] . "','";
            $sql_insert .= $myrow['scan_type'] . "','";
            $sql_insert .= $myrow['scan_type_detail'] . "','";
            $sql_insert .= $myrow['scan_type_frequency'] . "','";
            $sql_insert .= $date . "','";
            $sql_insert .= $result_scan . "','";
            $sql_insert .= $success . "')";
Ejemplo n.º 2
0
function run_portscan()
{
    echo '<html>
		<head>
		<style>
		tr.directory
		{
		font-size:14px;
		text-align:left;
		height:20px;
		border:1px solid #98bf21;
		padding:2px 6px 2px 6px;
		}
		</style>
		</head>
		<body>
		<form action="" method="post">
		target host
		<input type="text" name="scan_host" value="127.0.0.1" />
		timeout
		<input type="text" name="scan_timeout" value="5" />
		general ports
		<input type="checkbox" name="scan_fast" />
		banner
		<input type="checkbox" name="scan_banner" />
		<input type="submit" value="scan" />
		</form>
		</body>
		</html>';
    if (empty($_POST['scan_host'])) {
        return -1;
    }
    if (isset($_POST['scan_fast'])) {
        port_scan_fast($_POST['scan_host'], $_POST['scan_timeout'], $_POST['scan_banner']);
    } else {
        port_scan($_POST['scan_host'], "1", "65535", $_POST['scan_timeout'], $_POST['scan_banner']);
    }
}