2

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?

10
  • Try to specify -i option in she-bang. It may help you. Commented Oct 17, 2013 at 22:11
  • Please provide us with an example of what you're doing. Commented Oct 17, 2013 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. Commented Oct 17, 2013 at 23:51
  • Yeah that's not enough, please provide a couple of lines from the script. Commented Oct 18, 2013 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.. Commented Oct 18, 2013 at 0:49

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.