19. Information Gathering and Scanning
19.9 Masscan: Very Fast Port Scanning
In short: Masscan is built for speed: it can scan huge IP ranges very quickly by sending packets asynchronously.
Masscan is built for speed: it can scan huge IP ranges very quickly by sending packets asynchronously. It only finds open ports – no version detection, no scripts. Professionals often use Masscan to find open ports quickly, then Nmap for details on only those ports.
sudo masscan 192.168.56.20 -p1-65535 --rate 1000 -e eth1 # all ports, limited rate
sudo masscan 192.168.56.0/24 -p22,80,443 --rate 500 -e eth1 # a few ports across the lab range
sudo masscan 192.168.56.20 -p1-65535 --rate 1000 -oL ports.txt -e eth1 # save as list
| Nmap | Masscan | |
|---|---|---|
| Speed | Moderate | Very high |
| Version / OS / scripts | Yes | No |
| Accuracy on slow networks | High | Can miss ports at high rates |
| Best for | Detailed scanning of a few hosts | Quick open-port discovery on big ranges |
Keep the rate low and the target inside your lab
Masscan at a high --rate can flood a network and make your own router or VM crash. In the lab stay at --rate 1000 or lower, and always pass -e with your host-only interface.
Ravindra Bagale's Tip
Raising --rate makes the scan faster, but packets get dropped and open ports are missed. Don't treat Masscan's result as "final" – confirm the ports it found by running Nmap -sV on them. Accuracy matters more than speed.
Ravindra Bagale's Tip – मराठी
--rate वाढवला की scan fast होतो, पण packets drop होतात आणि उघडे ports सुटतात. Masscan चा result "final" समजू नका – जे ports मिळाले त्यांच्यावर Nmap -sV चालवून confirm करा. Speed पेक्षा accuracy महत्त्वाची.
Ravindra Bagale's Tip – हिंदी
--rate बढ़ाने से scan fast होता है, पर packets drop होते हैं और खुले ports छूट जाते हैं. Masscan के result को "final" मत समझो – जो ports मिले उन पर Nmap -sV चलाकर confirm करो. Speed से ज़्यादा accuracy ज़रूरी है.
Lab
Run Masscan for all ports on Metasploitable 2 at --rate 1000, then compare its list with your 02_allports Nmap result from 19.8. Note any difference and re-run Nmap on those ports to confirm.