1

I'm trying to run nmap from a Bash script, in a way so that when Enter is pressed it should give some output, as happens when running directly from the commandline.

When calling a few different nmap scans from a Bash script, pressing Enter will not show the time remaining as it would if I ran it directly from the command line.

An example line from my script:

nmap -T4 -iL input.txt -PN -sS -oA tcp_top_1000

Running nmap like this via the command line, and then hitting Enter results in this type of output:

$ nmap -T4 -iL input.txt -PN -sS -oA tcp_top_1000

Starting Nmap 5.21 ( http://nmap.org ) at 2013-10-18 01:21 EDT
Stats: 0:00:01 elapsed; 0 hosts completed (0 up), 1 undergoing ARP Ping Scan
Parallel DNS resolution of 1 host. Timing: About 0.00% done
Stats: 0:00:01 elapsed; 0 hosts completed (0 up), 1 undergoing ARP Ping Scan
Parallel DNS resolution of 1 host. Timing: About 0.00% done
Stats: 0:00:02 elapsed; 0 hosts completed (0 up), 1 undergoing ARP Ping Scan
Parallel DNS resolution of 1 host. Timing: About 0.00% done

However running that same nmap command in a shell script inhibits it's ability to do the above.

Is there any way to solve this?

  • Try to specify -i option in she-bang. It may help you. – rush Oct 17 '13 at 22:11
  • Please provide us with an example of what you're doing. – slm Oct 17 '13 at 22:39
  • @slm, I did provide an example. Calling nmap to do a scan from a script. The scan type or parameters don't matter. – Sonny Ordell Oct 17 '13 at 23:51
  • Yeah that's not enough, please provide a couple of lines from the script. – slm Oct 18 '13 at 0:07
  • @slm are you familiar with nmap? Really, the command doesn't matter, even "nmap host" will return output when enter is pressed while it is running. Besides, the problem isn't specific to a particular program. "nmap -sU host" is a fine example of a line from the script.. – Sonny Ordell Oct 18 '13 at 0:49

Your Answer

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

Browse other questions tagged or ask your own question.