0

I want to use nmap in such a way that I could check bunch of server's port at once for checking whether their particular port is open or not? right now I have 10 ip addresses but in future this could be more . I know the very basic command in linux like cat/nano/piping but I don't know how can I feed to nmap the list of my servers to open them one by one and return the result.

Vahid Hashemi
  • 207
  • 2
  • 11

2 Answers2

4

Say you have a file named "server_ips" with the IPs listed as such:

1.2.3.4
2.3.4.5
3.4.5.6
4.5.6.7
etc...

Then you could do the following:

$ cat server_ips | xargs nmap <nmap_options>
EEAA
  • 109,363
  • 18
  • 175
  • 245
  • You can also use the -iL option which accepts a file containing one IP/hostname/netblock per line. – jah Mar 08 '11 at 23:35
0

Write a target list of IPs or domains in a file, then

nmap -iL targetfile 

This way nmap will take care of optimization and performance.

blau
  • 738
  • 4
  • 9