2

I would like to know if there is a way to use "pipe viewer" with "Nmap" together.

Example:

pv | Nmap -sP 192.168.1.0/24

But I couldn't get the progress bar working properly. I mean it should be telling me the percentage of Nmap. Starts from 0%, when Namp is done, it will be 100%.

5

Pipe viewer is for reporting percentage completion of files, pipes, and other file-like things. Nmap's completion times depend on network latencies, bandwidth, responsiveness of targets, and the features used to scan.

You can get a periodic status update with the --stats-every flag, like so: nmap --stats-every 10s, which gives an update every 10 seconds. You can get more verbose output from Nmap with the -v flag.

-1

I doubt you could do a progress bar for NMap, as it scans for IPs and stuff, and that depends on network speeds, etc.

But you could do a simple bash script to send a notification when it has finished instead:

#!/bin/bash
nmap "$@";
notify-send 'Notifaction' 'Nmap has finished!'
echo "Finished!"
exit

Save it to a file called ~/.nmap or something.

Make it executable with chmod +x ~/.nmap.

Execute it with the options you normally give for nmap, but with ~/.nmap instead - for example:

~/.nmap -A 192.168.1.5

then it will do a notification to say it has finished:

enter image description here

I find this is useful after a network reset, and I need to find the new IP of the network printer in a hurry. This is probably not the answer you are looking for, but I though it may be of help and of interest.

3
  • Well thank you very much for the answer. I know how to do it in Notify-send. But, I wanted first to have a progress bar, then at the end of my scan, I will send a notification to my desktop. Again thank you. – ggalaxy Jan 17 '14 at 18:14
  • 1
    @ggalaxy - sadly, I don't think you can, as most of the time nmap spends is sending and receiving data , pinging IPs, etc. This depends on network speeds, security measures on the computers being scanned and stuff. This can vary so much that it would be very hard and inaccurate to time it, and to estimate the time remaining. The large amount of options nmap has aswell would greater increase the variability in timing. If you look in man pv, there is an example for use on tar & gzip, which is does mention may cause the programmer to overheat, but it might work in this scenario... – Wilf Jan 17 '14 at 18:21
  • 1
    @wi : Now I got the whole idea and I was assuming that "pv" would not give me exact percentage. So yes you are right. I have another idea, I am going to try it...if it doesn't work, I will let you know. Thx – ggalaxy Jan 17 '14 at 18:29

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.