Menu

#297 discoveryCheck.php doesn't discover

1.1
open
None
1
2015-12-15
2015-03-25
Anonymous
No

Hi,

PROBLEM

when i execute discoveryCheck.php no ip will found

DEBUG RESULT

in script functions-network.php there was a bug in function "getSubnetsToDiscover", it's works well when manualy scan a subnet but when do massive scan there some problem with array
$ip

PATCH

from this code:

# set vars
$ip = array();      //we store IPs to scan to this array

# ok, we have subnets. Now we create array of all possible IPs for each subnet,
# and remove all existing
foreach($subnets as $s) {
    // get all existing IP addresses
    $addresses = getIpAddressesBySubnetId ($s['id']);

    // set start and end IP address
    $calc = calculateSubnetDetailsNew ( $s['subnet'], $s['mask'], 0, 0, 0, 0 );
    // loop and get all IP addresses for ping
    for($m=1; $m<=$calc['maxhosts']; $m++) {
        // save to array for return
        $ip[$m]['ip_addr']  = $s['subnet']+$m;
        $ip[$m]['subnetId'] = $s['id'];
        // save to array for existing check
        $ipCheck[$m] = $s['subnet']+$m;
    }

    // remove already existing
    foreach($addresses as $a) {
        $key = array_search($a['ip_addr'], $ipCheck);
        if($key!==false) {
            unset($ip[$key]);   
        }
    }

# return result
return $ip;

to this code:

# set vars
$global_ip = array();       //we store IPs to scan to this array

# ok, we have subnets. Now we create array of all possible IPs for each subnet,
# and remove all existing
foreach($subnets as $s) {
    $ip = array();
    $ipCheck = array();

    // get all existing IP addresses
    $addresses = getIpAddressesBySubnetId ($s['id']);

    // set start and end IP address
    $calc = calculateSubnetDetailsNew ( $s['subnet'], $s['mask'], 0, 0, 0, 0 );

    // loop and get all IP addresses for ping
    for($m=1; $m<=$calc['maxhosts']; $m++) {
        // save to array for return
        $ip[$m]['ip_addr']  = $s['subnet']+$m;
        $ip[$m]['subnetId'] = $s['id'];
        // save to array for existing check
        $ipCheck[$m] = $s['subnet']+$m;
    }

    // remove already existing
    foreach($addresses as $a) {
        $key = array_search($a['ip_addr'], $ipCheck);
        if($key!==false) {
            unset($ip[$key]);
        }
    }

    $global_ip = array_merge($global_ip,$ip);

}

# return result
return $global_ip;

Discussion

  • Anonymous

    Anonymous - 2015-06-09

    Unfortunately, even after applying the patch to functions-network.php, discoveryCheck.php is not working for me. It was seemingly doing something for 20 minutes, then I had to break it. The load skyrocketed from 0.05 to 80 on a dedicated virtual machine.

    Manual scan and pingcheck is working nicely.

    I have 460 subnets (mask mostly > /24, nothing < /21) and 3330 IP addresses.

     
  • Anonymous

    Anonymous - 2015-09-01

    Awesome. This worked for me. :)
    I have /16 network subnetted into /24 among which 30+ subnets are configured on phpipam. Script takes around 5 minutes but discovers like a BOOOOM.

     
  • Anonymous

    Anonymous - 2015-09-24

    Same thing happened to me.

    ==
    Unfortunately, even after applying the patch to functions-network.php, discoveryCheck.php is not working for me. It was seemingly doing something for 20 minutes, then I had to break it. The load skyrocketed from 0.05 to 80 on a dedicated virtual machine.
    ==

    Ross.

     
  • Anonymous

    Anonymous - 2015-10-15

    tried this.. now i got no errors.. but still no output ..

     
  • Anonymous

    Anonymous - 2015-12-15

    I have the same issue.
    Then i thought to use the fpingdiscovery check, but it requires fping 3.0 and my linux build only has the 2.4 available (Fedora 14 build). I noticed that the original code that is pasted above was putted in comment.

     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.