4

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%.

Braiam
  • 69,112
ggalaxy
  • 102

2 Answers2

7

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.

Wilf
  • 30,732