TrojanSpot

Subnet Enumeration | www.pemula.info

Sep 24th, 2012
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.67 KB | None | 0 0
  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. ?>
Add Comment
Please, Sign In to add comment