Search code examples
linuxbashnetwork-programmingipnmap

nmap to scan specific ports on specific list of IPs


I am using nmap to scan all open ports on all IPs connected with local network.

I want to check specific ports on a list of IPs which is being picked from a text file.

Is it possible to specify a list of ports along with a list of IPs?

I'm looking for something like this:

nmap (specfic ports) -sS -iL ip_list.txt

Solution

  • You can use -p:

    nmap -p80,443 -sS -iL ip_list.txt
    

    From the documentation:

    -p : Only scan specified ports Ex: -p22; -p1-65535; -p U:53,111,137,T:21-25,80,139,8080,S:9

    If you just want the open ports, you can add --open:

    nmap -p80,443 --open -sS -iL ip_list.txt