Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function enumerateSubnet()
- {
- echo "<h3>Subnet Enumeration:</h3>";
- list($octet1, $octet2, $octet3) = explode(".", $_SERVER['SERVER_ADDR']);
- 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>';
- $octet4 = 0;
- while($octet4 < 255) {
- $address = $octet1.".".$octet2.".".$octet3.".".$octet4;
- $hostname = @gethostbyaddr($address);
- if($hostname != $address) echo '<tr><td>'.$address.'</td><td>'.$hostname.'</td></tr>';
- $hostname = "";
- $octet4++;
- }
- echo '</table><br><br>';
- }
- ?>
Add Comment
Please, Sign In to add comment