For doing Internet-wide surveys like Shodan or Scans.io, you need very-high-bandwidth access, legal approval (or at least a blind eye turned) from your ISP, and likely an asynchronous scanner like Zmap or masscan. Nmap is a decent alternative with the --min-rate
argument. Anything using the default TCP stack on your OS (e.g. curl
, netcat
, or Perl solutions) will not be able to keep up with the high packet volume and number of targets required.
If, however, you want to scan a smaller network (say a /16 with 65K addresses), then Nmap is up to the job, requires less setup than the asynchronous scanners (since they require firewall settings to prevent the native TCP stack from responding to returned probes), and is widely available. You could get reasonable performance with this command:
sudo nmap -v -T5 -PS80 -p80 -sS --script http-server-header -oA scan-results-%D%T 10.10.0.0/16
This breaks down to:
-v
- verbose output
-T5
- Fastest timing options. This may be too much for some networks; try -T4
if you suspect lost results.
-PS80
- Only consider hosts that respond on port 80 (open or closed).
-p80
- Scan port 80 on alive hosts
-sS
- Use Nmap's half-open SYN scan, which has the best timing performance
--script http-server-header
- This script will grab the Server header from a basic GET request. Alternatively you could use http-headers
to get all headers, or use -sV --version-light
to do basic version detection from probe responses.
-oA scan-results-%D%T
- Output 3 formats into separate timestamped files. You can process results with one of the many tools that imports Nmap XML output.