|
Using PHP's exec Functions
Here I will create a function and pass it a IP Address.
I'll use alot of the what we learned so far;
-
Creating variables and assigning values to them
-
Creating a function
-
Creating an array
-
using echo to display data to the browser
-
Using the PHP exec function
function nmap_pc($nmapipaddr) {
$time=date("H:i:s");
$date=date("d-m-Y");
$nmap = "/usr/local/bin/nmap $nmapipaddr -sP";
$command = "$nmap";
echo "NMAP ran against: $nmapipaddr ";
echo "<BR>";
echo "$date @ $time";
echo "<P>";
@exec($command, $dd, $result);
$dd[] = $dd -1;
$indexLimit = count($dd);
for($index=0; $index < $indexLimit; $index++) {
$orts = (" $dd[$index] ");
echo (" $orts ");
}
}
nmap_pc($nmapipaddr);
>> Comments/FeedBack
|