Filters
Zo zoek je
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • "twee woorden" vindt precies die zin.
  • --naam of -x vindt een optie.
  • #woord zoekt alleen in commando's.
  • @grep vindt lessen en labs die grep gebruiken.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Zet ! voor een woord om het weg te laten. OR tussen woorden betekent één ervan.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken

nmap

The network mapper: find hosts, open ports, running services and versions, and check TLS — to audit your own network.

Niveau
DevSecOps-service
Groep
Beveiligingsscans en hardening
Root nodig
Voor wijzigingen
Pakket
nmap

Dit deel is nog niet vertaald. Je ziet de Engelse tekst.

Wat het doet

nmap sends probes to hosts and ports and reports which ports are open, closed or filtered. With -sV it detects service versions, with -O the OS, and the NSE scripts add checks (TLS ciphers, HTTP headers, SSH algorithms, known CVEs). DevSecOps use: check that only the ports you expect are open after a deployment, find forgotten services, and verify firewall rules from the outside.

Scan only networks you own or are allowed to test.

Zo schrijf je het

nmap [SCAN TYPE] [OPTIONS] TARGETS

Belangrijkste delen

Scan types

-sS
TCP SYN scan (default as root; fast, half-open).
-sT
TCP connect scan (default as normal user).
-sU
UDP scan (slow).
-sn
Host discovery only, no ports.
-sV
Detect service versions.
-O
Detect the OS.
-A
-O -sV -sC --traceroute together.
-sC / --script NAME
Default / chosen NSE scripts.

Opties 10

Meest gebruikt

Options

-p PORTS / -p-
Ports (22,80,443 / 1-65535 / all).
--top-ports N
The N most common ports.
-Pn
Skip ping (hosts that block ICMP).
-T0 … -T5
Timing (T3 default, T4 faster).
-oN / -oX / -oG / -oA FILE
Output: normal, XML, grepable, all.
--open
Show only open ports.
-iL FILE
Targets from a file.
--exclude HOSTS
Skip hosts.
-6
IPv6.
--reason
Why a port has its state.

Voorbeelden 10

$ als gewone gebruiker# als root (of met sudo)

  1. 1Which hosts are up in the lab?

    nmap -sn 192.168.122.0/24
  2. 2Open ports and versions on one server

    sudo nmap -sS -sV --open 192.168.122.11
  3. 3All TCP ports

    sudo nmap -p- --open -T4 192.168.122.11
  4. 4Check what the internet sees (run from outside)

    nmap -Pn --top-ports 100 --open shop.example.com
  5. 5TLS versions and ciphers

    nmap --script ssl-enum-ciphers -p 443 shop.example.com
  6. 6SSH algorithms

    nmap --script ssh2-enum-algos -p 22 192.168.122.11
  7. 7HTTP security headers and title

    nmap --script http-security-headers,http-title -p 80,443 shop.example.com
  8. 8UDP services (DNS, NTP, SNMP)

    sudo nmap -sU -p 53,123,161 192.168.122.1
  9. 9Compare two scans after a change

    sudo nmap -sS -p- -oX before.xml 192.168.122.11
    sudo nmap -sS -p- -oX after.xml 192.168.122.11
    ndiff before.xml after.xml
  10. 10Scan a list of servers and save all formats

    sudo nmap -sV -iL servers.txt -oA weekly-$(date +%F)

Let op

  • Scanning networks without permission can be illegal and can trigger security alerts.
  • "filtered" means a firewall drops the probes — not that the port is safe.

Bestanden

/usr/share/nmap/scripts/
NSE scripts.

Tips om te onthouden

  • Put a weekly nmap + ndiff of your public IPs into a pipeline and alert on new open ports.

Exitcodes

0Success.
1Error.