πŸ‘¨β€πŸ’»
Jawad's Notes
  • πŸ‘¨β€πŸ«INFOSEC
    • πŸ•ΈοΈWeb
      • Burp Suite: Setting Foxyproxy
      • XSS
      • Wappalyzer
      • Directory Traversal
      • LFI
        • PHP Wrappers
        • RFI
      • Reverse Shell
        • Command Injection Quick Tips
      • File Upload
      • WPScan
      • SQL Injection
        • Schemas
        • SQLmap
        • MSSQL
        • MySQL
        • PostgreSQL
    • πŸ”§Tools
      • Whois
      • DNSRecon
      • DNSenum
      • nslookup
      • Netcat
        • Powercat
      • Nmap
        • Nmap Scripting Engine
        • Test-NetConnection
        • Grep
      • Server Message Block (SMB)
      • SNMP
      • SMTP
      • ExifTool
      • Search Engine Hacking
      • Source Control Hacking
      • Nessus
      • Canarytokens
      • Qualys SSL Server Test
      • Security Headers
      • theHarvester
      • Shodan
      • Gobuster
        • Dirb
      • Searchsploit
      • Password Cracking
        • Hashcat
        • John The Ripper
        • Hydra
        • hashID
        • CPU vs GPU
    • 🐧Linux
      • Symbols
      • cat
      • curl
      • openvpn
      • tcpdump
      • Remote Desktop
      • SmbShare
      • Tmux
      • Convert Windows-style line endings (CRLF) to Unix-style (LF)
      • SSH
    • πŸ–₯️Macros in Office
    • 🍎Enhancing Your MacOS Terminal Experience
    • 🚩CTF
      • SQL Injection
        • WHERE clause allowing retrieval of hidden data
        • Allowing login bypass
        • UNION attack, determining the number of columns returned by the query
        • UNION attack, finding a column containing text
        • UNION attack, retrieving data from other tables
        • UNION attack, retrieving multiple values in a single column
        • Querying the database type and version on Oracle
Powered by GitBook
On this page
  1. INFOSEC
  2. Tools

Nmap

Nmap (Network Mapper) is a powerful open-source tool for network exploration and security auditing. It allows users to discover hosts, services, and vulnerabilities on a network by employing various scan types and techniques.

Usage:

nmap [Scan Type(s)] [Options] {target specification}

Target Specification:

  • Can include hostnames, multiple IP addresses, networks, etc.

    • Ex: scanme.nmap.org, microsoft.com/24, 192.168.0.1; 10.0.0-255.1-254

Host Discovery:

  • -sn: Ping Scan (disable port scan)

  • -Pn: Treat all hosts as online (skip host discovery)

  • -PS/PA/PU/PY[portlist]: TCP SYN/ACK, UDP, or SCTP discovery to given ports

  • -PE/PP/PM: ICMP echo, timestamp, and netmask request discovery probes

  • -PO[protocol list]: IP Protocol Ping

  • -A: Traceroute

Scan Techniques:

  • -sS/sT/sA/sW/sM: TCP SYN/Connect()/ACK/Window/Maimon scans

  • -sU: UDP Scan

  • -sN/sF/sX: TCP Null (Network sweeping, begins with broad scans then use detailed ones), FIN, and Xmas scans

  • --scanflags <flags>: Customize TCP scan flags

  • -sI <zombie host[:probeport]>: Idle scan

  • -sY/sZ: SCTP INIT/COOKIE-ECHO scans

  • -sO: IP protocol scan

  • -b <FTP relay host>: FTP bounce scan

Port Specification and Scan Order:

  • -p <port ranges>: Only scan specified ports

    • Ex: -p22, -p1-65535, -p U:53,111,137,T:21-25,80,139,8080,S:9

  • --exclude <host1[,host2][,host3],...>: Exclude hosts/networks

  • --top-ports:10 : scans top 10 ports

Output Options:

  • -oG <filename>: Output in greppable format

  • -oN <filename>: Normal output

  • -oX <filename>: Output in XML format

OS Fingerprinting:

  • -O: Enable OS detection

Examples:

  • TCP SYN scan on ports 80 and 443, output to greppable file:

    nmap -sS -p 80,443 -oG output.txt example.com
  • UDP scan on default ports, enable OS detection:

    nmap -sU -O example.com
  • Fingerprinting web servers on port80

    kali@kali:~$ sudo nmap -p80  -sV example.com
    Starting Nmap 7.92 ( https://nmap.org ) at 2023-12-28 05:13 EDT
    Nmap scan report for example.com
    Host is up (0.11s latency).
    
    PORT   STATE SERVICE VERSION
    80/tcp open  http    Apache httpd 2.4.41 ((Ubuntu))
  • Extract information using grep from the greppable output:

    grep "Host:" output.txt

Nmap provides extensive options, including output formatting and OS detection. Always use responsibly and adhere to ethical hacking guidelines.

Resources:

PreviousPowercatNextNmap Scripting Engine

Last updated 1 year ago

πŸ‘¨β€πŸ«
πŸ”§
https://nmap.org/