Added hostnames and decreased font size a bit

This commit is contained in:
2014-06-04 13:36:42 +02:00
parent df0d784126
commit 1fa31a296e
6 changed files with 18 additions and 7 deletions

View File

@@ -8,21 +8,26 @@ $hosts = shell_exec("nmap $network -sn");
// Regexp to match any IP-number
preg_match_all("/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/", $hosts,
$out);
$ip);
// Match hostnames (only the host part, up to the first dot)
preg_match_all("/(?<=for\s)([a-z]*)/", $hosts, $name);
print "<h1>Hosts that are up</h1>\n";
print "<p>\n";
foreach ($out[0] as $i)
$counter = 0;
foreach ($ip[0] as $i)
{
print "<a href=\"scan.php?host=$i\">$i</a> <br />\n";
print "<a href=\"scan.php?host=$i\">$i</a>&emsp;" . $name["0"]["$counter"] .
"<br />\n";
$counter++;
}
print "</p>\n";
?>
</div>
</body>
</html>