0xma Cyber Security Articles

August 3, 2021

Read Targets from a File

In this tutorial, we will see how to read a list of targets from a text file and run nmap scan against all of the hosts. Nmap will take each entry from this list and run a scan against it.

This shows a text file that contains four entries or four hosts that we want to run a nmap scan against.

Text file containing a target list.

The nmap command -iL targets.txt will read the targets from this file. The following three screenshots shows the scan results for the following hosts in the file:, and

Nmap scan results. Nmap scan results. Nmap scan results.

We can also use a range to specify our targets. In this case, nmap will scan all the hosts between to

You can follow me on Twitter mujtabareads.