Howdy! I'm stuck and I'm hoping someone can help. In an attempt to learn more about the exec command and string manipulation, I am using exec to capture the output of nmap via:
<?
// start table
echo "<TABLE BORDER=5>";
// run nmap and get result
exec("/usr/bin/nmap host.mysite.me", $nmapResult);
// get size of nmap
$arraySize = sizeof($nmapResult);
// start on the fifth element to get rid of
// non-scanned output
$x = 5;
// step through array
while($x < $arraySize)
{
// explode the results into own column
$resultsplitted = explode(" ", $nmapResult[$x]);
// echo the column
echo "<TR>";
echo "<TD WIDTH=33%><CENTER>" .$resultsplitted[0]. "</CENTER></TD>";
echo "<TD WIDTH=33%><CENTER>" .$resultsplitted[1]. "</CENTER></TD>";
echo "<TD WIDTH=33%><CENTER>" .$resultsplitted[2]. "</CENTER></TD>";
echo "</TR>";
// increment x
$x++;
// end table
echo "</TABLE>";
}
?>
The problem is that I get only the first result. Observing the output from nmap it would appear as though tabs are used instead of spaces. (Hence the explode will not work.) However, all attempt to explode based upon tabs have failed.
I don't now what to do! Any help is appreciated.
Thanks!
Scott A. Eden
saeden@surgite.ca