Exemplo n.º 1
0
    }
    if ($ip[0] == 172 && $ip[1] >= 16 && $ip[1] <= 31) {
        return 1;
    }
    if ($ip[0] == 192 && $ip[1] == 168) {
        return 1;
    }
    return 0;
}
function scan_check($ip, $port = 80, $timeout = 0.4)
{
    $fp = @fsockopen($ip, $port, $errno, $errstr, $timeout);
    if ($fp) {
        return 1;
    }
}
//while(1) echo(ip_range(ip_rand())."\n");
while (1) {
    if (ip_range($ip = ip_rand())) {
        continue;
    }
    if (scan_check($ip, 23)) {
        echo $ip . "\n";
    }
    //echo($ip.' - '.gethostbyaddr($ip)."\n"); //Debug
}
/*
24-bit block 	10.0.0.0 - 10.255.255.255
20-bit block 	172.16.0.0 - 172.31.255.255
16-bit block 	192.168.0.0 - 192.168.255.255
*/
Exemplo n.º 2
0
<?php

include 'functions.php';
ob_start();
echo "<html>\n";
// grab the connecting ip address. //
$connecting_ip = get_ipaddress();
if (empty($connecting_ip)) {
    return FALSE;
}
// determine if connecting ip address is allowed to connect to PHP Timeclock //
if ($restrict_ips == "yes") {
    for ($x = 0; $x < count($allowed_networks); $x++) {
        $is_allowed = ip_range($allowed_networks[$x], $connecting_ip);
        if (!empty($is_allowed)) {
            $allowed = TRUE;
        }
    }
    if (!isset($allowed)) {
        echo "You are not authorized to view this page.";
        exit;
    }
}
// connect to db anc check for correct db version //
@($db = mysql_pconnect($db_hostname, $db_username, $db_password));
if (!$db) {
    echo "Error: Could not connect to the database. Please try again later.";
    exit;
}
mysql_select_db($db_name);
$table = "dbversion";
Exemplo n.º 3
0
function partition($list, $p)
{
    $listlen = count($list);
    $partlen = floor($listlen / $p);
    $partrem = $listlen % $p;
    $partition = array();
    $mark = 0;
    for ($px = 0; $px < $p; $px++) {
        $incr = $px < $partrem ? $partlen + 1 : $partlen;
        $partition[$px] = array_slice($list, $mark, $incr);
        $mark += $incr;
    }
    return $partition;
}
$part = array();
$array = ip_range($argv[1] . '.0.0', $argv[1] . '.255.255');
$total_lines = count($array);
$childcount = $argv[2];
$part = partition($array, $childcount);
$shm_id = shmop_open(23377332, "c", 0666, 1024);
shmop_close($shm_id);
for ($i = 0; $i < $childcount; $i++) {
    $pid = pcntl_fork();
    if ($pid == -1) {
        echo "failed to fork on loop {$i} of forking\n";
        exit;
    } else {
        if ($pid) {
            continue;
        } else {
            $sem = sem_get(13377331, 1, 0666, 1);