Nmap bestpractice: Unterschied zwischen den Versionen

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen
 
(69 dazwischenliegende Versionen von 3 Benutzern werden nicht angezeigt)
Zeile 1: Zeile 1:
=basics=
=basics=
*https://nmap.org/man/de/man-port-scanning-basics.html
https://nmap.org/man/de/man-port-scanning-basics.html
=reine pings scan=
*nmap -sP 192.168.66.0/24


=schneller scan mit weniger Ports=
=ping scan=
*nmap -F 192.168.66.0/24
Im gleichen Netz wird ARP genutzt, ansonsten ICMP.
*nmap -sn 10.88.215.0/24
=nur anzeigen der Rechner die online sind=
*nmap -sn 10.88.215.0/24 -oG  - |  grep Up | awk '{ print  $2 }' > secure.local.list


=vollständiger connect=
=vollständiger connect=
SYN - SYN/ACK - ACK - RST
SYN - SYN/ACK - ACK - RST
*nmap -sT 192.168.66.52
*nmap -sT 10.88.215.61


=einfacher scan=
=einfacher scan=
SYN - SYN/ACK - RST (ohne root rechte nicht möglich)=
SYN - SYN/ACK - RST (ohne Root-Rechte nicht möglich)
*nmap -sS 192.168.66.52
*nmap -sS 10.88.215.61


=udp scan=
=udp scan=
ports von 50 bis 70 werden gescanned (zeigte keine gewünschte ergebnisse)
Ports von 50 bis 70 werden gescannt (zeigte keine gewünschten Ergebnisse)
*nmap -sU 192.168.66.52 -p 50-70
*nmap -sU 10.88.215.61 -p 50-70
 
=tcp und udp scan=
=tcp und udp scan=
*nmap -sTU 192.168.66.52
TCP und UDP gleichzeitig prüfen
=bestimmer Ports scannen=
*nmap -sTU 10.88.215.61
*nmap -p21,22,80 192.168.66.52
 
=bestimmte Ports scannen=
Scant gezielt bestimmte Ports
*nmap -sS 10.88.215.61 -p 21,22,139
 
=alle Ports scannen=
=alle Ports scannen=
*nmap -p- 192.168.66.52
Scan aller 65535 Ports
=reverse auflösung der host=
*nmap -sS 10.88.215.61 -p-
*nmap -sL 192.168.66.50-60
 
=Angabe von Source Address und Interface=
=Angabe von Source Address und Interface=
*nmap -e eth0  -S 192.168.66.54 -P0 -sS 192.168.66.53
Eigene IP + Interface definieren
=kompletter scan in numerischer reihenfolge=
*nmap -e enp0s3 -Pn -S 172.26.213.X  -sS 10.88.215.61
-r numerische reihenfolge -p- alle ports  -v verbose
 
*nmap -v -r -p- -sS 192.168.66.52
=kompletter Scan in numerischer Reihenfolge=
=os detection=
-r = Reihenfolge, -p- = alle Ports, -v = verbose
*nmap -O 192.168.66.53
*nmap -v -r -p- -sS 10.88.215.61
<pre>
Starting Nmap 6.40 ( http://nmap.org ) at 2015-10-14 14:05 CEST
Nmap scan report for 192.168.242.50
Host is up (0.00013s latency).
Not shown: 991 closed ports
PORT      STATE SERVICE
135/tcp  open  msrpc
139/tcp  open  netbios-ssn
445/tcp  open  microsoft-ds
49152/tcp open  unknown
49153/tcp open  unknown
49154/tcp open  unknown
49155/tcp open  unknown
49156/tcp open  unknown
49157/tcp open  unknown
MAC Address: 48:5B:39:AD:8A:F3 (Asustek Computer)
Device type: general purpose
Running: Microsoft Windows 2008|7
OS CPE: cpe:/o:microsoft:windows_server_2008::sp2 cpe:/o:microsoft:windows_7::- cpe:/o:microsoft:windows_7::sp1 cpe:/o:microsoft:windows_8
OS details: Microsoft Windows Server 2008 SP2, Microsoft Windows 7 SP0 - SP1, Windows Server 2008 SP1, or Windows 8
Network Distance: 1 hop


OS detection performed. Please report any incorrect results at http://nmap.org/submit/ .
=Zeigt nur Rechner mit offenem Port 22=
Nmap done: 1 IP address (1 host up) scanned in 83.95 seconds
Erkennt offene SSH-Zugänge
</pre>
*nmap -sS 10.88.215.0/24 -p 22 --open


=Aktiviert OS detection und Version detection, Script scanning und Traceroute=
=Webserver detection=
-T 4 timing
Versionserkennung für HTTP
*nmap -A -T 4 192.168.242.50
*nmap -sV 10.88.215.61 -p 80


<pre>
=Nameserver detection=
Starting Nmap 6.40 ( http://nmap.org ) at 2015-10-14 14:22 CEST
BIND erkennen auf DNS-Port
Nmap scan report for 192.168.242.50
*nmap -sV 10.88.215.1 -p 53
Host is up (0.00015s latency).
Not shown: 991 closed ports
PORT      STATE SERVICE    VERSION
135/tcp  open  msrpc      Microsoft Windows RPC
139/tcp  open  netbios-ssn
445/tcp  open  netbios-ssn
49152/tcp open  msrpc      Microsoft Windows RPC
49153/tcp open  msrpc      Microsoft Windows RPC
49154/tcp open  msrpc      Microsoft Windows RPC
49155/tcp open  msrpc      Microsoft Windows RPC
49156/tcp open  msrpc      Microsoft Windows RPC
49157/tcp open  msrpc      Microsoft Windows RPC
MAC Address: 48:5B:39:AD:8A:F3 (Asustek Computer)
Device type: general purpose
Running: Microsoft Windows 2008|7
OS CPE: cpe:/o:microsoft:windows_server_2008::sp2 cpe:/o:microsoft:windows_7::- cpe:/o:microsoft:windows_7::sp1 cpe:/o:microsoft:windows_8
OS details: Microsoft Windows Server 2008 SP2, Microsoft Windows 7 SP0 - SP1, Windows Server 2008 SP1, or Windows 8
Network Distance: 1 hop
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows


Host script results:
=SSH Server detection=
|_nbstat: NetBIOS name: WIN-VJCRWQXC6A7, NetBIOS user: <unknown>, NetBIOS MAC: 48:5b:39:ad:8a:f3 (Asustek Computer)
OpenSSH identifizieren
| smb-os-discovery:
*nmap -sV 10.88.215.61 -p 22
|  OS: Windows Server (R) 2008 Enterprise 6001 Service Pack 1 (Windows Server (R) 2008 Enterprise 6.0)
|  OS CPE: cpe:/o:microsoft:windows_server_2008::sp1
|  Computer name: WIN-VJCRWQXC6A7
|  NetBIOS computer name: WIN-VJCRWQXC6A7
|  Workgroup: WORKGROUP
|_ System time: 2015-10-14T14:23:23+02:00
| smb-security-mode:
|  Account that was used for smb scripts: guest
|  User-level authentication
|  SMB Security: Challenge/response passwords supported
|_  Message signing disabled (dangerous, but default)
|_smbv2-enabled: Server supports SMBv2 protocol


TRACEROUTE
=os detection=
HOP RTT    ADDRESS
==Linux==
1  0.16 ms 192.168.242.50
Ermittelt Linux-Kernel-Version
*nmap -O -v 10.88.215.61 --osscan-guess


OS and Service detection performed. Please report any incorrect results at http://nmap.org/submit/ .
==Windows==
Nmap done: 1 IP address (1 host up) scanned in 64.83 seconds
Windows-Systeme durch TCP/IP-Stack erkennen
</pre>
*nmap -O -v 10.88.215.5 --osscan-guess
=Timing Template=
Timing Templates werden benutzt wenn man vermutet das die Firewall einen Portscan erkennt und man deshalb verzögert scannen will. Oder man aggressiver an die Sache rangehen will.


*nmap -A -T sneaky 192.168.242.50
Es gibt folgende Templates
*paranoid (0) - verhindert IDS Erkennung
*sneaky (1) - verhindert IDS Erkennung
*polite (2) - langsamer Scan
*normal (3) - normaler Scan
*aggressive (4) - setzt schnelles Netzwerk voraus
*insane (5) - setzt sehr schnelles Netzwerk voraus
=ssl-enum-ciphers=
=ssl-enum-ciphers=
*nmap -sV --script ssl-enum-ciphers -p 443 www.xinux.de
Zeigt unterstützte Ciphers auf HTTPS-Port
*nmap -sV --script ssl-enum-ciphers -p 443 xinux.de
 
<pre>
<pre>
Starting Nmap 7.80 ( https://nmap.org ) at 2020-12-09 10:44 CET
Starting Nmap 7.80 ( https://nmap.org ) at 2020-12-09 10:44 CET
Zeile 184: Zeile 131:
Nmap done: 1 IP address (1 host up) scanned in 15.85 seconds
Nmap done: 1 IP address (1 host up) scanned in 15.85 seconds
</pre>
</pre>
=Lese das TLS-Zertifikat=
*nmap -sV --script ssl-cert -p 443 xinux.de
<pre>Starting Nmap 7.93 ( https://nmap.org ) at 2026-05-06 19:35 CEST
Nmap scan report for xinux.de (194.59.156.162)
Host is up (0.011s latency).
PORT    STATE SERVICE  VERSION
443/tcp open  ssl/http Golang net/http server (Go-IPFS json-rpc or InfluxDB API)
|_http-server-header: Apache/2.4.56 (Debian)
| ssl-cert: Subject: commonName=xinux.de
| Subject Alternative Name: DNS:*.xinux.de, DNS:xinux.de
| Issuer: commonName=R13/organizationName=Let's Encrypt/countryName=US
| Public Key type: rsa
| Public Key bits: 4096
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2026-03-16T05:24:22
| Not valid after:  2026-06-14T05:24:21
| MD5:  28144e705895a1e9b43e304e22021818
|_SHA-1: e11e158230336ce050c7d070e50c1f77039fb04
</pre>
=Alle Schwachstellen=
Nutzt CVE-Datenbank über vulners NSE-Script
*nmap -sV --script vulners 10.88.215.61
=schneller Scan mit weniger Ports=
Fast Scan (-F) nutzt Nmaps Standard-Portliste
*nmap -F 10.88.215.0/24
=Ziele aus einer Datei lesen=
Zielsysteme aus Datei nutzen
*vi secure.local.list
10.88.215.1
10.88.215.5
10.88.215.29
10.88.215.34
10.88.215.35
10.88.215.60
10.88.215.61
10.88.215.101
10.88.215.103
10.88.215.170
=Anwenden=
Scan der IP-Liste ohne Ping
*nmap -sP -iL secure.local.list
=Export im XML Format=
*nmap -sP -iL secure.local.list -oX secure.local.xml
=ICMP Timestamp Request Remote Date Disclosure=
ICMP-Zeitprüfung zur Systemuhr-Abfrage
*nmap -sP -PE --script=icmp-timestamp 10.88.215.61


=Links=
=Links=
*http://wiki.ubuntuusers.de/nmap
http://wiki.ubuntuusers.de/nmap
*https://nmap.org/man/de/
https://nmap.org/man/de/

Aktuelle Version vom 24. September 2026, 11:53 Uhr

basics

https://nmap.org/man/de/man-port-scanning-basics.html

ping scan

Im gleichen Netz wird ARP genutzt, ansonsten ICMP.

  • nmap -sn 10.88.215.0/24

nur anzeigen der Rechner die online sind

  • nmap -sn 10.88.215.0/24 -oG - | grep Up | awk '{ print $2 }' > secure.local.list

vollständiger connect

SYN - SYN/ACK - ACK - RST

  • nmap -sT 10.88.215.61

einfacher scan

SYN - SYN/ACK - RST (ohne Root-Rechte nicht möglich)

  • nmap -sS 10.88.215.61

udp scan

Ports von 50 bis 70 werden gescannt (zeigte keine gewünschten Ergebnisse)

  • nmap -sU 10.88.215.61 -p 50-70

tcp und udp scan

TCP und UDP gleichzeitig prüfen

  • nmap -sTU 10.88.215.61

bestimmte Ports scannen

Scant gezielt bestimmte Ports

  • nmap -sS 10.88.215.61 -p 21,22,139

alle Ports scannen

Scan aller 65535 Ports

  • nmap -sS 10.88.215.61 -p-

Angabe von Source Address und Interface

Eigene IP + Interface definieren

  • nmap -e enp0s3 -Pn -S 172.26.213.X -sS 10.88.215.61

kompletter Scan in numerischer Reihenfolge

-r = Reihenfolge, -p- = alle Ports, -v = verbose

  • nmap -v -r -p- -sS 10.88.215.61

Zeigt nur Rechner mit offenem Port 22

Erkennt offene SSH-Zugänge

  • nmap -sS 10.88.215.0/24 -p 22 --open

Webserver detection

Versionserkennung für HTTP

  • nmap -sV 10.88.215.61 -p 80

Nameserver detection

BIND erkennen auf DNS-Port

  • nmap -sV 10.88.215.1 -p 53

SSH Server detection

OpenSSH identifizieren

  • nmap -sV 10.88.215.61 -p 22

os detection

Linux

Ermittelt Linux-Kernel-Version

  • nmap -O -v 10.88.215.61 --osscan-guess

Windows

Windows-Systeme durch TCP/IP-Stack erkennen

  • nmap -O -v 10.88.215.5 --osscan-guess

ssl-enum-ciphers

Zeigt unterstützte Ciphers auf HTTPS-Port

  • nmap -sV --script ssl-enum-ciphers -p 443 xinux.de
Starting Nmap 7.80 ( https://nmap.org ) at 2020-12-09 10:44 CET
Nmap scan report for www.xinux.de (94.130.248.212)
Host is up (0.027s latency).
Other addresses for www.xinux.de (not scanned): 2a01:4f8:13b:1e15:8000:0:212:1
rDNS record for 94.130.248.212: thor.tuxmen.de

PORT    STATE SERVICE VERSION
443/tcp open  ssl/ssl Apache httpd (SSL-only mode)
|_http-server-header: Apache/2.4.29 (Ubuntu)
| ssl-enum-ciphers: 
|   TLSv1.0: 
|     ciphers: 
|       TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (ecdh_x25519) - A
|       TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (ecdh_x25519) - A
|       TLS_DHE_RSA_WITH_AES_128_CBC_SHA (dh 2048) - A
|       TLS_DHE_RSA_WITH_AES_256_CBC_SHA (dh 2048) - A
|       TLS_RSA_WITH_AES_128_CBC_SHA (rsa 2048) - A
|       TLS_RSA_WITH_AES_256_CBC_SHA (rsa 2048) - A
|     compressors: 
|       NULL
|     cipher preference: server
|   TLSv1.1: 
|     ciphers: 
|       TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (ecdh_x25519) - A
|       TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (ecdh_x25519) - A
|       TLS_DHE_RSA_WITH_AES_128_CBC_SHA (dh 2048) - A
|       TLS_DHE_RSA_WITH_AES_256_CBC_SHA (dh 2048) - A
|       TLS_RSA_WITH_AES_128_CBC_SHA (rsa 2048) - A
|       TLS_RSA_WITH_AES_256_CBC_SHA (rsa 2048) - A
|     compressors: 
|       NULL
|     cipher preference: server
|   TLSv1.2: 
|     ciphers: 
|       TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (ecdh_x25519) - A
|       TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (ecdh_x25519) - A
|       TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (ecdh_x25519) - A
|       TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 (dh 2048) - A
|       TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 (dh 2048) - A
|       TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 (ecdh_x25519) - A
|       TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 (ecdh_x25519) - A
|       TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (ecdh_x25519) - A
|       TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (ecdh_x25519) - A
|       TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 (dh 2048) - A
|       TLS_DHE_RSA_WITH_AES_128_CBC_SHA (dh 2048) - A
|       TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 (dh 2048) - A
|       TLS_DHE_RSA_WITH_AES_256_CBC_SHA (dh 2048) - A
|       TLS_RSA_WITH_AES_128_GCM_SHA256 (rsa 2048) - A
|       TLS_RSA_WITH_AES_256_GCM_SHA384 (rsa 2048) - A
|       TLS_RSA_WITH_AES_128_CBC_SHA256 (rsa 2048) - A
|       TLS_RSA_WITH_AES_256_CBC_SHA256 (rsa 2048) - A
|       TLS_RSA_WITH_AES_128_CBC_SHA (rsa 2048) - A
|       TLS_RSA_WITH_AES_256_CBC_SHA (rsa 2048) - A
|     compressors: 
|       NULL
|     cipher preference: server
|_  least strength: A

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 15.85 seconds

Lese das TLS-Zertifikat

  • nmap -sV --script ssl-cert -p 443 xinux.de
Starting Nmap 7.93 ( https://nmap.org ) at 2026-05-06 19:35 CEST
Nmap scan report for xinux.de (194.59.156.162)
Host is up (0.011s latency).

PORT    STATE SERVICE  VERSION
443/tcp open  ssl/http Golang net/http server (Go-IPFS json-rpc or InfluxDB API)
|_http-server-header: Apache/2.4.56 (Debian)
| ssl-cert: Subject: commonName=xinux.de
| Subject Alternative Name: DNS:*.xinux.de, DNS:xinux.de
| Issuer: commonName=R13/organizationName=Let's Encrypt/countryName=US
| Public Key type: rsa
| Public Key bits: 4096
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2026-03-16T05:24:22
| Not valid after:  2026-06-14T05:24:21
| MD5:   28144e705895a1e9b43e304e22021818
|_SHA-1: e11e158230336ce050c7d070e50c1f77039fb04

Alle Schwachstellen

Nutzt CVE-Datenbank über vulners NSE-Script

  • nmap -sV --script vulners 10.88.215.61

schneller Scan mit weniger Ports

Fast Scan (-F) nutzt Nmaps Standard-Portliste

  • nmap -F 10.88.215.0/24

Ziele aus einer Datei lesen

Zielsysteme aus Datei nutzen

  • vi secure.local.list
10.88.215.1
10.88.215.5
10.88.215.29
10.88.215.34
10.88.215.35
10.88.215.60
10.88.215.61
10.88.215.101
10.88.215.103
10.88.215.170

Anwenden

Scan der IP-Liste ohne Ping

  • nmap -sP -iL secure.local.list

Export im XML Format

  • nmap -sP -iL secure.local.list -oX secure.local.xml

ICMP Timestamp Request Remote Date Disclosure

ICMP-Zeitprüfung zur Systemuhr-Abfrage

  • nmap -sP -PE --script=icmp-timestamp 10.88.215.61

Links

http://wiki.ubuntuusers.de/nmap https://nmap.org/man/de/