Last active
October 24, 2017 08:14
-
-
Save maakunh/b741e3aeeef10e25e9ded0c0866dc914 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once "parse_arp_from_pcap.php"; | |
//センサーネットワークアドレスを取得する | |
$network_addr = sensor_network_addr(); | |
list($network_ip, $mask) = explode('/', $network_addr); | |
$imax = pow(2, 32 - $mask) - 2; | |
for($i = 1; $i <= $imax; $i++){ | |
$ip_long = ip2long($network_ip) + $i; | |
$rtn = exec('ping -c 1 '.long2ip($ip_long).' > /dev/null &'); | |
$i++; | |
echo long2ip($ip_long).PHP_EOL; | |
if($i > $imax){ | |
$i = 1; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment