1

I am trying to write a php code test to write an nmap scan (with parameters) scheduled into crontab file.

While the nmap is running I would like to get the status of that specific nmap scan. For example: how many IP addresses scanned, is the scan still running, or is it finished?

Is is possible to get the status of any running nmap scan?

1

I'm not sure if there is an easy way to do that, but if you output the nmap results to a text file, and you use the nmap -v parameter for more verbose output, you could search the output text file for the information you need.

Fore example, the first time the phrase "Scanning x hosts" appears, refers to the total number of hosts you are trying to scan. The second time "Scanning x hosts" appears refers to the total number of hosts that are up (if nmap is doing the default ARP ping scan). Then you could look for lines that start with "Completed SYN Stealth Scan against" (if you are doing a scan with default parameters) to see which and how many hosts were scanned. You could look for the line that starts with "Nmap done" in order to see if the scan has finished. The precondition to all this is that you always rewrite the output file when you do a new scan.

0

Cron daemon only sends email, if executed process outputs something on console - and only after the job finish. So basically you can't get such information, when nmap is still running, unless you implement it yourself, eg. by generating log file from nmap and analyzing it from another cron job each minute.

I've seen some cron web wrappers, and at least one of them (unfortunately paid) is able to give you some information about running cron jobs in realtime, but it's only generic information about cron jobs, with no details specific to cron job itself (eg. no scanned IPs).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.