SHOW:
|
|
- or go back to the newest paste.
| 1 | <?php | |
| 2 | function enumerateSubnet() | |
| 3 | {
| |
| 4 | echo "<h3>Subnet Enumeration:</h3>"; | |
| 5 | list($octet1, $octet2, $octet3) = explode(".", $_SERVER['SERVER_ADDR']);
| |
| 6 | echo '<table border="1"><tr><td><font color="green"><b>IP Address:</b></font></td><td><font color="blue"><b>Hostname:</b></font></td></tr>'; | |
| 7 | $octet4 = 0; | |
| 8 | while($octet4 < 255) {
| |
| 9 | $address = $octet1.".".$octet2.".".$octet3.".".$octet4; | |
| 10 | $hostname = @gethostbyaddr($address); | |
| 11 | if($hostname != $address) echo '<tr><td>'.$address.'</td><td>'.$hostname.'</td></tr>'; | |
| 12 | $hostname = ""; | |
| 13 | $octet4++; | |
| 14 | } | |
| 15 | echo '</table><br><br>'; | |
| 16 | } | |
| 17 | ?> |