Cody Blog

Software development

nmap 筆記

NAMP 是一套網路掃描的工具

Nmap

$ nmap ip

$ nmap [ip1 ip2]

$ namp 192.168.10.1/24

隨機掃描目標(慎用)

$ nmap -iR 3

Ping

$ nmap 172.16.21.134 172.16.21.135 -sP

Starting Nmap 6.40 ( http://nmap.org ) at 2014-04-24 09:38 CST Nmap scan report for 172.16.21.134 Host is up (0.00084s latency). Nmap done: 2 IP addresses (1 host up) scanned in 1.21 seconds

Traceroute

# sudo nmap 8.8.8.8 --traceroute

Starting Nmap 6.40 ( http://nmap.org ) at 2014-04-24 09:39 CST
Nmap scan report for google-public-dns-a.google.com (8.8.8.8)
Host is up (0.012s latency).
Not shown: 999 filtered ports
PORT   STATE SERVICE
53/tcp open  domain

TRACEROUTE (using port 53/tcp)
HOP RTT      ADDRESS
1   5.03 ms  140.92.62.1
2   2.25 ms  140.92.12.22
3   2.40 ms  140.92.12.30
4   3.07 ms  h254.s98.ts.hinet.net (168.95.98.254)
5   20.43 ms h102.s24.ts.hinet.net (168.95.24.102)
6   9.05 ms  tpdt-3011.hinet.net (220.128.1.246)
7   4.31 ms  tyfo-3011.hinet.net (220.128.8.81)
8   3.45 ms  tyfo-3301.hinet.net (220.128.8.249)
9   6.73 ms  74.125.49.158
10  12.86 ms 209.85.243.30
11  8.06 ms  209.85.243.21
12  ...
13  13.71 ms google-public-dns-a.google.com (8.8.8.8)

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

TCP SYN Ping

當系統把 ICMP PING 關掉的時間可以改試 TCP SYN PING。

$ nmap -PS135 172.16.21.131

UDP Ping

# nmap -PU 172.16.21.131

偵測作業系統

# mmap -O 172.16.21.134

結果不一定準確,實際測試 Windows 7:

$ sudo nmap -O 172.16.21.131

Starting Nmap 6.40 ( http://nmap.org ) at 2014-04-24 09:49 CST
Nmap scan report for 172.16.21.131
Host is up (0.0012s latency).
Not shown: 998 filtered ports
PORT     STATE SERVICE
135/tcp  open  msrpc
3389/tcp open  ms-wbt-server
MAC Address: 00:0C:29:53:99:FF (VMware)
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
Device type: general purpose
Running: Microsoft Windows Vista|2008|7
OS CPE: cpe:/o:microsoft:windows_vista::- cpe:/o:microsoft:windows_vista::sp1 cpe:/o:microsoft:windows_server_2008::sp1 cpe:/o:microsoft:windows_7
OS details: Microsoft Windows Vista SP0 or SP1, Windows Server 2008 SP1, or Windows 7, Microsoft Windows Vista SP2, Windows 7 SP1, or Windows Server 2008
Network Distance: 1 hop

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

以及 Ubuntu 13.10:

$ sudo nmap -O 172.16.21.134

Starting Nmap 6.40 ( http://nmap.org ) at 2014-04-24 09:53 CST
Nmap scan report for 172.16.21.134
Host is up (0.00056s latency).
Not shown: 996 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
80/tcp   open  http
3260/tcp open  iscsi
3306/tcp open  mysql
MAC Address: 00:0C:29:2C:B2:55 (VMware)
No exact OS matches for host (If you know what OS is running on it, see http://nmap.org/submit/ ).
TCP/IP fingerprint:
OS:SCAN(V=6.40%E=4%D=4/24%OT=22%CT=1%CU=33986%PV=Y%DS=1%DC=D%G=Y%M=000C29%T
OS:M=53586E8E%P=x86_64-unknown-linux-gnu)SEQ(SP=105%GCD=1%ISR=10F%TI=Z%CI=I
OS:%II=I%TS=8)OPS(O1=M5B4ST11NW7%O2=M5B4ST11NW7%O3=M5B4NNT11NW7%O4=M5B4ST11
OS:NW7%O5=M5B4ST11NW7%O6=M5B4ST11)WIN(W1=7120%W2=7120%W3=7120%W4=7120%W5=71
OS:20%W6=7120)ECN(R=Y%DF=Y%T=40%W=7210%O=M5B4NNSNW7%CC=Y%Q=)T1(R=Y%DF=Y%T=4
OS:0%S=O%A=S+%F=AS%RD=0%Q=)T2(R=N)T3(R=N)T4(R=Y%DF=Y%T=40%W=0%S=A%A=Z%F=R%O
OS:=%RD=0%Q=)T5(R=Y%DF=Y%T=40%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)T6(R=Y%DF=Y%T=40
OS:%W=0%S=A%A=Z%F=R%O=%RD=0%Q=)T7(R=Y%DF=Y%T=40%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q
OS:=)U1(R=Y%DF=N%T=40%IPL=164%UN=0%RIPL=G%RID=G%RIPCK=G%RUCK=G%RUD=G)IE(R=Y
OS:%DFI=N%T=40%CD=S)

Network Distance: 1 hop

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

只有 Windows 7 可以被偵測出來,此時可以使用另一個選項 --osscan-guess,nmap會列出可能作業系統的機率

$ sudo nmap -O --osscan-guess localhost

Starting Nmap 6.40 ( http://nmap.org ) at 2014-04-24 09:56 CST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000070s latency).
Not shown: 997 closed ports
PORT     STATE SERVICE
631/tcp  open  ipp
902/tcp  open  iss-realsecure
4242/tcp open  vrml-multi-use
Aggressive OS guesses: Linux 3.7 - 3.9 (98%), Netgear DG834G WAP or Western Digital WD TV media player (96%), Linux 3.8 (95%), Linux 3.1 (93%), Linux 3.2 (93%), AXIS 210A or 211 Network Camera (Linux 2.6) (92%), Linux 3.7 (92%), Linux 3.9 (91%), Crestron XPanel control system (91%), Linux 2.4.26 (Slackware 10.0.0) (91%)
No exact OS matches for host (If you know what OS is running on it, see http://nmap.org/submit/ ).
TCP/IP fingerprint:
OS:SCAN(V=6.40%E=4%D=4/24%OT=631%CT=1%CU=44228%PV=N%DS=0%DC=L%G=Y%TM=53586F
OS:70%P=x86_64-unknown-linux-gnu)SEQ(SP=105%GCD=1%ISR=10D%TI=Z%CI=I%II=I%TS
OS:=8)OPS(O1=MFFD7ST11NW7%O2=MFFD7ST11NW7%O3=MFFD7NNT11NW7%O4=MFFD7ST11NW7%
OS:O5=MFFD7ST11NW7%O6=MFFD7ST11)WIN(W1=AAAA%W2=AAAA%W3=AAAA%W4=AAAA%W5=AAAA
OS:%W6=AAAA)ECN(R=Y%DF=Y%T=40%W=AAAA%O=MFFD7NNSNW7%CC=Y%Q=)T1(R=Y%DF=Y%T=40
OS:%S=O%A=S+%F=AS%RD=0%Q=)T2(R=N)T3(R=N)T4(R=Y%DF=Y%T=40%W=0%S=A%A=Z%F=R%O=
OS:%RD=0%Q=)T5(R=Y%DF=Y%T=40%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)T6(R=Y%DF=Y%T=40%
OS:W=0%S=A%A=Z%F=R%O=%RD=0%Q=)T7(R=Y%DF=Y%T=40%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=
OS:)U1(R=Y%DF=N%T=40%IPL=164%UN=0%RIPL=G%RID=G%RIPCK=G%RUCK=G%RUD=G)IE(R=Y%
OS:DFI=N%T=40%CD=S)

Network Distance: 0 hops

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

zenmap

GUI 介面的 zenmap

Testing

Related Posts

Comments