DEV Community

Cover image for Nmap Cheatsheet for Hackers
Rocky Sah
Rocky Sah

Posted on

Nmap Cheatsheet for Hackers

πŸŽ₯ Nmap Basics for Hackers: Watch the video

Nmap (Network Mapper) is one of the most powerful tools for network scanning and reconnaissance. Whether you are a penetration tester, bug bounty hunter, or cybersecurity enthusiast, mastering Nmap can give you an edge in discovering vulnerabilities and mapping network infrastructures.

πŸ”Ή Basic Scanning Commands

  1. Scan a single IP
   nmap 192.168.1.1
Enter fullscreen mode Exit fullscreen mode
  1. Scan a range of IPs
   nmap 192.168.1.1-100
Enter fullscreen mode Exit fullscreen mode
  1. Scan an entire subnet
   nmap 192.168.1.0/24
Enter fullscreen mode Exit fullscreen mode
  1. Scan a specific port
   nmap -p 22 192.168.1.1
Enter fullscreen mode Exit fullscreen mode
  1. Scan multiple ports
   nmap -p 22,80,443 192.168.1.1
Enter fullscreen mode Exit fullscreen mode
  1. Scan all 65535 ports
   nmap -p- 192.168.1.1
Enter fullscreen mode Exit fullscreen mode

πŸ”Ή Host Discovery

  1. Ping Scan (Discover live hosts without scanning ports)
   nmap -sn 192.168.1.0/24
Enter fullscreen mode Exit fullscreen mode
  1. Disable host discovery (Scan only specified targets)
   nmap -Pn 192.168.1.1
Enter fullscreen mode Exit fullscreen mode

πŸ”Ή Advanced Scanning Techniques

  1. Service and version detection
   nmap -sV 192.168.1.1
Enter fullscreen mode Exit fullscreen mode
  1. Operating system detection

    nmap -O 192.168.1.1
    
  2. Aggressive scan (OS detection, version detection, script scanning, and traceroute)

    nmap -A 192.168.1.1
    
  3. Scan a target behind a firewall

    nmap -sS 192.168.1.1
    

πŸ”Ή Script Scanning

  1. Use default scripts

    nmap -sC 192.168.1.1
    
  2. Use specific scripts (e.g., to detect vulnerabilities)

    nmap --script=vuln 192.168.1.1
    
  3. Run multiple scripts

    nmap --script=ftp*,http* 192.168.1.1
    

πŸ”Ή Performance Optimization

  1. Increase speed (Use higher timing templates)

    nmap -T4 192.168.1.1
    
  2. Maximum speed (Be cautious, may be detected by IDS/IPS)

    nmap -T5 192.168.1.1
    

πŸ”Ή Firewall Evasion & Stealth Scanning

  1. Fragment packets (Bypass simple packet filters)

    nmap -f 192.168.1.1
    
  2. Decoy scan (Make it appear as if multiple hosts are scanning)

    nmap -D RND:10 192.168.1.1
    
  3. Spoof source IP

    nmap -S 192.168.100.100 192.168.1.1
    
  4. Use custom packets

    nmap --data-length 50 192.168.1.1
    

πŸ”Ή Output and Reporting

  1. Save scan results to a text file

    nmap -oN scan_results.txt 192.168.1.1
    
  2. Save results in XML format

    nmap -oX scan_results.xml 192.168.1.1
    
  3. Save results in all formats

    nmap -oA scan_results 192.168.1.1
    

πŸ”Ή Conclusion

Nmap is an essential tool for cybersecurity professionals. Whether you are conducting penetration testing, vulnerability assessments, or ethical hacking, understanding Nmap’s powerful features will enhance your reconnaissance skills.

πŸ“Œ Watch the Nmap Basics for Hackers video to get a practical walkthrough and start using Nmap effectively!

πŸš€ Happy Hacking! πŸ”₯

Top comments (0)