When performing a port scan against an IT infrastructure, we must assume that services can be accessed via any IP address. As a result, we must scan every IT system, even if we have received a server list from the client. Documentation can be incomplete, especially if the network has grown historically and was managed by multiple administrators. However, since we usually have limited time for a pentest, the choice of port scanner depends on the size of the network. While Nmap can be used to efficiently identify all services on an IT system, the tool is not optimized for a wide scan of several thousand IP addresses. However, this size is often used for internal IT infrastructures because the three private IPv4 address ranges can be used:

  • 10.0.0.0/8 (16.777.216 IPs)
  • 172.16.0.0/12 (1.048.576 IPs)
  • 192.168.0.0/16 (65.536 IPs)

For such cases, tools like masscan have been developed, which, according to their own statement, can scan the entire Internet for the accessibility of one port in only 3 minutes (see man page). This statement can be quite realistic if one would have an exceptionally good routing and network connection. As an example, web servers on the 192.168.0.0/16 network can be identified within a few minutes using the following command, since 2000 SYN packets are sent per second:

sudo masscan -p80,443 --rate=2000 -e tun0 192.168.0.0/16
-p: specifies the port(s) to be scanned
--rate: specifies the desired rate for transmitting packets per second.
-e: use the named raw network interface, such as "eth0" or "dna1"

However, care must be taken when configuring the rate limit, as we may negatively affect the availability of firewalls or other network devices. With masscan we are basically able to identify common services such as DNS servers, web servers, SSH servers, etc. in large network areas in a foreseeable time, while we can then use Nmap to carry out a complete port scan for the active IP addresses.

Last modified: Dec. 15, 2022

Penetation Testing Course

About Pentest Training

Discover the world of penetration testing. Learn how to infiltrate networks and successfully penetrate systems and applications. Acquire the necessary hacking skills and use them when conducting professional penetration tests. Become a real penetration tester. Here you will find the free documents for the Pentest Training of binsec academy GmbH. The binsec academy GmbH offers the corresponding security training lab environments and certifications. However, the knowledge and wiki articles on hacking and penetration testing is universal.

About binsec academy GmbH

binsec academy GmbH is the European provider of online security training with virtual laboratory environments. The core component of all security training is the focus on practice, practice and more practice. In the wiki here you will find the public and freely available course materials. You can put the theory into practice at binsec-academy.com.