netscan is a TCP port scanner intended for normal users to run on Linux systems. The goal of netscan is to find open ports quickly for later testing and deep analysis (Nmap, Nessus, etc.).
$ wc -l ports.txt
1 ports.txt
$ wc -l ips.txt
65536 ips.txt
$ time netscan ips.txt ports.txt > /dev/null
real 0m2.851s
user 0m10.816s
sys 0m3.428s$ go build netscan.go$ go run netscan.go ips.txt ports.txt
$ netscan ips.txt ports.txt > results.txt
$ netscan ips.txt ports.txt | grep Success
$ netscan ips.txt ports.txt | grep Success | awk -F , '{print $3}' > ips.txtTo scan large networks, you'll need to increase the number of open files for the user who runs netscan. 150,000 works well for 10.0.0.0/16 networks (2^16 hosts). Experiment to find a suitable number of open files on your scanner system for your networks. Here's an example from /etc/security/limits.conf:
user_name soft nofile 150000
user_name hard nofile 150000The file ips.txt should be a plain text file with one IP address per line. It must contain one or more IP addresses. and should look something like this:
192.168.1.54
192.168.1.98
192.168.1.134The file ports.txt should be a plain text file with one TCP port number per line. It must contain one or more port numbers and should look something like this:
21
22
23
80
443
445
3389netscan does not support CIDR notation.