ROOT ON FIRE Security, Monitoring, Networking, Linux

25Nov/090

Nmap 5.0 – Howto Teil 6: Debugging & ausführliche Ausgabe

Die folgenden Beispiele werden mit der aktuellen Nmap Version 5.0 durchgeführt.
Wie man Nmap 5.0 auf einem aktuellen Debian System installiert, habe ich hier erklärt.
Das Nmap Security Scanner Projekt und Insecure.org erlauben ausdrücklich, dass
man den Host scanme.nmap.org mit Nmap zu Testzwecken scannen darf.
Ich habe für die unten gezeigten Beispiele ausschließlich scanme.nmap.org und meine eigenen Rechner benutzt!

Nmap bietet zur Fehlersuche verschiedene Debugging Möglichkeiten. Dies ist oft hilfreich wenn man die Ausgabe eines Scans nicht nachvollziehen kann oder wenn man gerne mehr über Nmap und wie es arbeitet erfahren will. Um die unterschiedliche Komplexität darzustellen habe ich zu jeder Ausgabenstufe ein Beispiel angehängt.

Zum Vergleich die Ausgabe eines Standard-Scans ohne weitere Optionen:

r-o-f:~# nmap scanme.nmap.org

Starting Nmap 5.00 ( http://nmap.org ) at 2009-11-24 20:20 CET
Interesting ports on scanme.nmap.org (64.13.134.52):
Not shown: 994 filtered ports
PORT      STATE  SERVICE
25/tcp    closed smtp
53/tcp    open   domain
70/tcp    closed gopher
80/tcp    open   http
113/tcp   closed auth
31337/tcp closed Elite

Nmap done: 1 IP address (1 host up) scanned in 30.36 seconds

-v (Ausführliche Ausgabe)
Nmap gibt mit diesem Parameter mehr Informationen über den laufenden Scan aus. Bereits während des Scans, gibt Nmap Informationen zu offenen Ports und der geschätzten Restdauer des Scans aus. Zusätzlich erhält man am Ende noch die Information, wieviele Pakete verschickt bzw. empfangen wurden und welche Datenmenge dabei transferiert wurde. Man kann den Parameter auch zweimal oder öfters angeben, um noch mehr Informationen zum laufenden Scan zu bekommen.

r-o-f:~# nmap -v scanme.nmap.org

Starting Nmap 5.00 ( http://nmap.org ) at 2009-11-24 20:32 CET
NSE: Loaded 0 scripts for scanning.
Initiating Ping Scan at 20:32
Scanning 64.13.134.52 [4 ports]
Completed Ping Scan at 20:32, 0.21s elapsed (1 total hosts)
Initiating Parallel DNS resolution of 1 host. at 20:32
Completed Parallel DNS resolution of 1 host. at 20:32, 0.00s elapsed
Initiating SYN Stealth Scan at 20:32
Scanning scanme.nmap.org (64.13.134.52) [1000 ports]
Discovered open port 80/tcp on 64.13.134.52
Discovered open port 53/tcp on 64.13.134.52
Completed SYN Stealth Scan at 20:33, 29.41s elapsed (1000 total ports)
Host scanme.nmap.org (64.13.134.52) is up (0.20s latency).
Interesting ports on scanme.nmap.org (64.13.134.52):
Not shown: 994 filtered ports
PORT      STATE  SERVICE
25/tcp    closed smtp
53/tcp    open   domain
70/tcp    closed gopher
80/tcp    open   http
113/tcp   closed auth
31337/tcp closed Elite

Read data files from: /usr/local/share/nmap
Nmap done: 1 IP address (1 host up) scanned in 29.83 seconds
Raw packets sent: 3008 (132.328KB) | Rcvd: 19 (756B)

-d [Debugging-Level 1 - 9] (verschiedene Debugging Stufen)

Die Option -d[1-9] liefert je nach Stufe deutlich mehr Informationen als die ausführliche Ausgabe (-v).
Zum Vergleich, habe ich einen einfachen Nmap Scan auf mit allen verfügbaren Stufen druchgeführt:

AufrufZeilenWörter
nmap scanme.nmap.org1353
nmap -d1 scanme.nmap.org47350
nmap -d2 scanme.nmap.org205710483
nmap -d3 scanme.nmap.org575353834
nmap -d4 scanme.nmap.org11236108477
nmap -d5 scanme.nmap.org798976304
nmap -d6 scanme.nmap.org633556851
nmap -d7 scanme.nmap.org650058457
nmap -d8 scanme.nmap.org603054579
nmap -d9scanme.nmap.org914785599
r-o-f:~# nmap -d1 scanme.nmap.org

Starting Nmap 5.00 ( http://nmap.org ) at 2009-11-24 20:42 CET
PORTS: Using top 1000 ports found open (TCP:1000, UDP:0, SCTP:0)
--------------- Timing report ---------------
  hostgroups: min 1, max 100000
  rtt-timeouts: init 1000, min 100, max 10000
  max-scan-delay: TCP 1000, UDP 1000, SCTP 1000
  parallelism: min 0, max 0
  max-retries: 10, host-timeout: 0
  min-rate: 0, max-rate: 0
---------------------------------------------
NSE: Loaded 0 scripts for scanning.
Initiating Ping Scan at 20:42
Scanning 64.13.134.52 [4 ports]
Packet capture filter (device eth0): dst host 192.168.178.7 and (icmp or ((tcp or udp or sctp) and (src host 64.13.134.52)))
We got a ping packet back from 64.13.134.52: id = 12871 seq = 0 checksum = 52664
Completed Ping Scan at 20:42, 0.20s elapsed (1 total hosts)
Overall sending rates: 19.48 packets / s, 740.22 bytes / s.
mass_rdns: Using DNS server 192.168.178.2
Initiating Parallel DNS resolution of 1 host. at 20:42
mass_rdns: 0.00s 0/1 [#: 1, OK: 0, NX: 0, DR: 0, SF: 0, TR: 1]
Completed Parallel DNS resolution of 1 host. at 20:42, 0.00s elapsed
DNS resolution of 1 IPs took 0.01s. Mode: Async [#: 1, OK: 1, NX: 0, DR: 0, SF: 0, TR: 1, CN: 0]
Initiating SYN Stealth Scan at 20:42
Scanning scanme.nmap.org (64.13.134.52) [1000 ports]
Packet capture filter (device eth0): dst host 192.168.178.7 and (icmp or ((tcp or udp or sctp) and (src host 64.13.134.52)))
Discovered open port 80/tcp on 64.13.134.52
Discovered open port 53/tcp on 64.13.134.52
Completed SYN Stealth Scan at 20:43, 19.23s elapsed (1000 total ports)
Overall sending rates: 104.25 packets / s, 4586.81 bytes / s.
Host scanme.nmap.org (64.13.134.52) is up, received echo-reply (0.20s latency).
Scanned at 2009-11-24 20:42:53 CET for 19s
Interesting ports on scanme.nmap.org (64.13.134.52):
Not shown: 995 filtered ports
Reason: 995 no-responses
PORT    STATE  SERVICE REASON
25/tcp  closed smtp    reset
53/tcp  open   domain  syn-ack
70/tcp  closed gopher  reset
80/tcp  open   http    syn-ack
113/tcp closed auth    reset
Final times for host: srtt: 199135 rttvar: 12541  to: 249299

Read from /usr/local/share/nmap: nmap-services.
Nmap done: 1 IP address (1 host up) scanned in 19.65 seconds
           Raw packets sent: 2009 (88.372KB) | Rcvd: 13 (516B)

--reason (Grund für Port- oder Hostzustand)

Nmap gibt einen Grund für eine Zustandsbeurteilung eines Ports bzw. Hosts an. Es wird die Paketart angezeigt, die Nmap von dem Host oder Port als Antwort bekommen hat. Je nach Scan-Typ ist die Ausgabe mehr oder weniger detailliert, z.B. SYN- und SYN-Ping-Scans liefern sehr detaillierte Ergebnisse. Die Debug-Option aktiviert diesen Parameter automatisch mit.

r-o-f:~# nmap --reason scname.nmap.org

Starting Nmap 5.00 ( http://nmap.org ) at 2009-11-24 22:01 CET
Interesting ports on nmap.org (64.13.134.48):
Not shown: 995 filtered ports
Reason: 995 no-responses
PORT      STATE  SERVICE REASON
25/tcp    closed smtp    reset
70/tcp    closed gopher  reset
80/tcp    open   http    syn-ack
113/tcp   closed auth    reset
31337/tcp closed Elite   reset

Nmap done: 1 IP address (1 host up) scanned in 20.48 seconds

--stats-every (alle x Sekunden Status ausgeben)
Mit dieser Option kann man Nmap z.B. alle x Sekunden eine Status Meldung zum aktuellen Scan und eine geschätze Restlaufzeit ausgeben lassen.

r-o-f:~# nmap --stats-every 2s scanme.nmap.org

Starting Nmap 5.00 ( http://nmap.org ) at 2009-11-24 22:05 CET
Stats: 0:00:02 elapsed; 0 hosts completed (1 up), 1 undergoing SYN Stealth Scan
SYN Stealth Scan Timing: About 0.95% done
Stats: 0:00:04 elapsed; 0 hosts completed (1 up), 1 undergoing SYN Stealth Scan
SYN Stealth Scan Timing: About 8.55% done; ETC: 22:05 (0:00:32 remaining)
Stats: 0:00:06 elapsed; 0 hosts completed (1 up), 1 undergoing SYN Stealth Scan
SYN Stealth Scan Timing: About 28.90% done; ETC: 22:05 (0:00:12 remaining)
Stats: 0:00:08 elapsed; 0 hosts completed (1 up), 1 undergoing SYN Stealth Scan
SYN Stealth Scan Timing: About 48.10% done; ETC: 22:05 (0:00:08 remaining)
Stats: 0:00:10 elapsed; 0 hosts completed (1 up), 1 undergoing SYN Stealth Scan
SYN Stealth Scan Timing: About 53.20% done; ETC: 22:05 (0:00:08 remaining)
Stats: 0:00:12 elapsed; 0 hosts completed (1 up), 1 undergoing SYN Stealth Scan
SYN Stealth Scan Timing: About 68.80% done; ETC: 22:05 (0:00:05 remaining)
Stats: 0:00:14 elapsed; 0 hosts completed (1 up), 1 undergoing SYN Stealth Scan
SYN Stealth Scan Timing: About 85.35% done; ETC: 22:05 (0:00:02 remaining)
Stats: 0:00:16 elapsed; 0 hosts completed (1 up), 1 undergoing SYN Stealth Scan
SYN Stealth Scan Timing: About 93.40% done; ETC: 22:05 (0:00:01 remaining)
Stats: 0:00:18 elapsed; 0 hosts completed (1 up), 1 undergoing SYN Stealth Scan
SYN Stealth Scan Timing: About 96.50% done; ETC: 22:05 (0:00:01 remaining)
Interesting ports on scanme.nmap.org (64.13.134.52):
Not shown: 994 filtered ports
PORT      STATE  SERVICE
25/tcp    closed smtp
53/tcp    open   domain
70/tcp    closed gopher
80/tcp    open   http
113/tcp   closed auth
31337/tcp closed Elite

Nmap done: 1 IP address (1 host up) scanned in 19.97 seconds

--packet-trace (Pakete mitverfolgen)
Ermöglicht eine genau Paket- und Datenverfolgung bzw. Analyse der von Nmap gesendeten und empfangenen Pakete. Dient in erster Linie zur Fehlersuche.

r-o-f:~# nmap --packet-trace -p 80 scanme.nmap.org

Starting Nmap 5.00 ( http://nmap.org ) at 2009-11-24 22:10 CET
SENT (0.1900s) ICMP 192.168.178.7 > 64.13.134.52 echo request (type=8/code=0) ttl=41 id=7268 iplen=28
SENT (0.1910s) TCP 192.168.178.7:37434 > 64.13.134.52:443 S ttl=48 id=60502 iplen=44  seq=4230340190 win=1024 <mss 1460>
SENT (0.1920s) TCP 192.168.178.7:37434 > 64.13.134.52:80 A ttl=41 id=55745 iplen=40  seq=4230340190 win=2048 ack=3150697107
SENT (0.1930s) ICMP 192.168.178.7 > 64.13.134.52 Timestamp request (type=13/code=0) ttl=51 id=40393 iplen=40
RCVD (0.3810s) ICMP 64.13.134.52 > 192.168.178.7 echo reply (type=0/code=0) ttl=52 id=13566 iplen=28
NSOCK (0.3840s) UDP connection requested to 192.168.178.2:53 (IOD #1) EID 8
NSOCK (0.3840s) Read request from IOD #1 [192.168.178.2:53] (timeout: -1ms) EID 18
NSOCK (0.3840s) Write request for 43 bytes to IOD #1 EID 27 [192.168.178.2:53]: .............52.134.13.64.in-addr.arpa.....
NSOCK (0.3860s) nsock_loop() started (timeout=500ms). 3 events pending
NSOCK (0.3870s) Callback: CONNECT SUCCESS for EID 8 [192.168.178.2:53]
NSOCK (0.3870s) Callback: WRITE SUCCESS for EID 27 [192.168.178.2:53]
NSOCK (0.3890s) Callback: READ SUCCESS for EID 18 [192.168.178.2:53] (184 bytes)
NSOCK (0.3890s) Read request from IOD #1 [192.168.178.2:53] (timeout: -1ms) EID 34
SENT (0.3920s) TCP 192.168.178.7:37434 > 64.13.134.52:80 S ttl=59 id=35157 iplen=44  seq=2763183854 win=4096 <mss 1460>
RCVD (0.5970s) TCP 64.13.134.52:80 > 192.168.178.7:37434 SA ttl=52 id=0 iplen=44  seq=3727728905 win=5840 ack=2763183855 <mss 1460>
Interesting ports on scanme.nmap.org (64.13.134.52):
PORT   STATE SERVICE
80/tcp open  http

Nmap done: 1 IP address (1 host up) scanned in 0.60 seconds

--open (nur offene Ports ausgeben)
Nmap gibt hier nur die als offen, offen|gefiltert und ungefiltert markierten Ports aus, geschlossene und gefilterte Ports werden nicht angezeigt

r-o-f:~# nmap -open scanme.nmap.org

Starting Nmap 5.00 ( http://nmap.org ) at 2009-11-24 22:14 CET
Interesting ports on scanme.nmap.org (64.13.134.52):
Not shown: 994 filtered ports, 4 closed ports
PORT   STATE SERVICE
53/tcp open  domain
80/tcp open  http

Nmap done: 1 IP address (1 host up) scanned in 41.52 seconds

Quelle: nmap.org


Nmap 5.0 - Howto Teil 1: Ziele richtig definieren

Nmap 5.0 - Howto Teil 2: Host-Erkennung
Nmap 5.0 - Howto Teil 3: Port-Scans
Nmap 5.0 – Howto Teil 4: Dienst- und Versionserkennung
Nmap 5.0 – Howto Teil 5: Betriebssystem-Erkennung

Nmap Grundlagen: Port-Zustände
Nmap Grundlagen: Nmap 5.0 Installation

   
Get Adobe Flash playerPlugin by wpburn.com wordpress themes