Vivaldi Posted August 31, 2007 Share Posted August 31, 2007 hi i'm trying to create a script that executes nmap from my server, then displays the output. i've tried: $output = passthru('nmap -v -A'.' $ip'); $output = shell_exec('nmap -v -A'.' $ip'); system('nmap -v -A'.' $ip'); the problem i'm having is that using the above methods i only get the first line of output, ie. Starting Nmap 4.20 ( http://insecure.org ) at 2007-08-31 21:46 CST and nothing else. i've managed to find a way around it by sending the nmap output to a textfile, the using file_get_contents() to pull the data back in: exec('nmap -v -A '.$ip.' > /usr/local/www/apache22/data/nmap/'.$ip.'.html'); $file = "/usr/local/www/apache22/data/nmap/$ip.html"; $result = file_get_contents($file); echo "(pre)$result(/pre)"; that works perfectly, but i'd rather not be writing anything to the drive. i guess the problem might be that nmap takes about 5-10 seconds to do its scan, and for some reason php doesn't want to wait that long, i really have no idea. can it be made to work without needing to write to files? and for the curious minds, i'm not doing anything dodgy, i just wanted an online tool i could access from any computer to test networks i support thanks Quote Link to comment https://forums.phpfreaks.com/topic/67441-exec-system-shell_exec-etc-nmap/ Share on other sites More sharing options...
Vivaldi Posted September 1, 2007 Author Share Posted September 1, 2007 ? Quote Link to comment https://forums.phpfreaks.com/topic/67441-exec-system-shell_exec-etc-nmap/#findComment-339180 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.