====== Ubuntu - nmap - Scan list of Hosts from a File ======
If you have more hosts to scan and all host details are written in a file, you can directly ask nmap to read that file and perform scans.
Create a text file called “nmaptest.txt” and define all the IP addresses or hostname of the server that you want to do a scan.
cat nmaptest.txt
result:
192.168.1.100
192.168.1.141
192.168.1.169
Next, run the following command with the **iL** option with nmap command to scan all listed IP address in the file.
nmap -iL nmaptest.txt
result:
Starting Nmap 6.40 ( http://nmap.org ) at 2016-07-07 23:47 BST
Nmap scan report for 192.168.1.100
Host is up (0.025s latency).
Not shown: 989 closed ports
PORT STATE SERVICE
80/tcp open http
139/tcp open netbios-ssn
443/tcp open https
445/tcp open microsoft-ds
515/tcp open printer
631/tcp open ipp
6839/tcp open unknown
7435/tcp open unknown
8080/tcp open http-proxy
9100/tcp open jetdirect
9220/tcp open unknown
Nmap scan report for android-d8443dafc4d5d365 (192.168.1.141)
Host is up (0.021s latency).
All 1000 scanned ports on android-d8443dafc4d5d365 (192.168.1.141) are closed
Nmap scan report for RP-AC52 (192.168.1.169)
Host is up (0.019s latency).
Not shown: 998 closed ports
PORT STATE SERVICE
53/tcp open domain
80/tcp open http
Nmap done: 3 IP addresses (3 hosts up) scanned in 2.39 seconds