nmap
system monitor
會有更詳細的輸出:
nmap -v www.hinet.net
nmap 也可以直接從檔案讀取要掃描的主機,假設我們有一個主機列表檔案 hostlist.txt,其內容為:
www.hinet.net
192.168.0.123
www.google.com.tw
nmap -iL hostlist.txt
如果要偵測主機的作業系統與各種服務的版本,可以加上 -A 參數:
nmap -A scanme.nmap.org
如果只需要作業系統資訊,可以使用 -O 參數:
nmap -O scanme.nmap.org
若只需要各種服務的版本:
nmap -sV scanme.nmap.org
Nmap 可以透過 TCP ACK 掃描,偵測主機是否有啟用防火牆:
nmap -sA scanme.nmap.org
掃描整個網路,偵測所有有開機的主機(ping scan):
nmap -sP 140.115.35.0/24
加快掃描的速度:
nmap -F www.hinet.net
nmap -T5 192.168.1.0/24
掃描連接埠 80:
nmap -p 80 192.168.1.1
nmap -p 80-200 192.168.1.1
掃描前 10 個常用的連接埠:
nmap --top-ports 10 192.168.1.1
只查詢網域中所有的主機名稱,不做任何主機與連接埠的偵測:
nmap -sL 192.168.1.0/24
Nmap进行完整全面的扫描:
nmap –T4 –A –v
其中-A选项用于使用进攻性(Aggressive)方式扫描;-T4指定扫描过程使用的时序(Timing),总有6个级别(0-5),级别越高,扫描速度越快,但也容易被防火墙或IDS检测并屏蔽掉,在网络通讯状况良好的情况推荐使用T4;-v表示显示冗余(verbosity)信息,在扫描过程中显示扫描的细节,从而让用户了解当前的扫描状态。
路由跟踪:
nmap -traceroute <target ip>
Nmap 結果輸出:
結果輸出到 outputfile.txt
nmap -oN outputfile.txt 192.168.1.1
儲存到XML
nmap -oX outputfile.xml 192.168.1.1
nmap -oG outputfile.txt 192.168.1.1
nmap -oA outputfile 192.168.1.1
** Output only the IP addresses of the online machines with nmap:
nmap -n -sn 192.0.2.0/24 -oG - | awk '/Up$/{print $2}' 1>outputfile.txt &
Quick rundown of options and commands:
-n turns off reverse name resolution, since you just want IP addresses. On a local LAN this is probably the slowest step, too, so you get a good speed boost.
-sn means "Don't do a port scan." It's the same as the older, deprecated -sP with the mnemonic "ping scan."
-oG - sends "grepable" output to stdout, which gets piped to awk.
/Up$/ selects only lines which end with "Up", representing hosts that are online.
{print $2} prints the second whitespace-separated field, which is the IP address.
常用指令碼使用案例
掃描伺服器的常見漏洞
nmap --script vuln
檢查FTP是否開啟匿名登陸
nmap --script ftp-anon.nse
PORT STATE SERVICE
21/tcp open ftp
| ftp-anon: Anonymous FTP login allowed (FTP code 230)
| -rw-r--r-- 1 1170 924 31 Mar 28 2001 .banner
| d--x--x--x 2 root root 1024 Jan 14 2002 bin
| d--x--x--x 2 root root 1024 Aug 10 1999 etc
| drwxr-srwt 2 1170 924 2048 Jul 19 18:48 incoming [NSE: writeable]
| d--x--x--x 2 root root 1024 Jan 14 2002 lib
| drwxr-sr-x 2 1170 924 1024 Aug 5 2004 pub
|_Only 6 shown. Use --script-args ftp-anon.maxlist=-1 to see all.
nmap -p 21 --script ftp-brute.nse
PORT STATE SERVICE
21/tcp open ftp
| ftp-brute:
| Accounts
| root:root - Valid credentials
| Statistics
|_ Performed 510 guesses in 610 seconds, average tps: 0
nmap -p 22 --script sshv1.nse
PORT STATE SERVICE
22/tcp open ssh
|_sshv1: Server supports SSHv1
=====================================
Nmap在实际中应用场合如下:
1、 通过对设备或者防火墙的探测来审计它的安全性
2、 探测目标主机所开放的端口
3、 通过识别新的服务器审计网络的安全性
4、 探测网络上的主机
端口扫描工具,即借助工具,试图了解所扫描IP提供的计算机网络服务类型(网络服务均与端口号相关),从而发现攻击弱点,常见服务对应端口号:
HTTP 80
HTTPS 443
Telnet 23
FTP 21
SSH(安全登录)、SCP(文件传输)、端口重定向 22
SMTP 25
POP3 110
WebLogic 7001
TOMCAT 8080
WIN2003远程登录 3389
Oracle数据库1521
MS SQL* SEVER数据库sever 1433
MySQL 数据库sever 3306
=====================================
會有更詳細的輸出:
nmap -v www.hinet.net
nmap 也可以直接從檔案讀取要掃描的主機,假設我們有一個主機列表檔案 hostlist.txt,其內容為:
www.hinet.net
192.168.0.123
www.google.com.tw
nmap -iL hostlist.txt
Scan a single IP | nmap 192.168.1.1 |
---|---|
Scan a host | nmap www.testhostname.com |
Scan a range of IPs | nmap 192.168.1.1-20 |
Scan a subnet | nmap 192.168.1.0/24 |
Scan targets from a text file | nmap -iL list-of-ips.txt |
如果要偵測主機的作業系統與各種服務的版本,可以加上 -A 參數:
nmap -A scanme.nmap.org
如果只需要作業系統資訊,可以使用 -O 參數:
nmap -O scanme.nmap.org
若只需要各種服務的版本:
nmap -sV scanme.nmap.org
Nmap 可以透過 TCP ACK 掃描,偵測主機是否有啟用防火牆:
nmap -sA scanme.nmap.org
掃描整個網路,偵測所有有開機的主機(ping scan):
nmap -sP 140.115.35.0/24
加快掃描的速度:
nmap -F www.hinet.net
nmap -T5 192.168.1.0/24
掃描連接埠 80:
nmap -p 80 192.168.1.1
nmap -p 80-200 192.168.1.1
掃描前 10 個常用的連接埠:
nmap --top-ports 10 192.168.1.1
只查詢網域中所有的主機名稱,不做任何主機與連接埠的偵測:
nmap -sL 192.168.1.0/24
Nmap进行完整全面的扫描:
nmap –T4 –A –v
其中-A选项用于使用进攻性(Aggressive)方式扫描;-T4指定扫描过程使用的时序(Timing),总有6个级别(0-5),级别越高,扫描速度越快,但也容易被防火墙或IDS检测并屏蔽掉,在网络通讯状况良好的情况推荐使用T4;-v表示显示冗余(verbosity)信息,在扫描过程中显示扫描的细节,从而让用户了解当前的扫描状态。
路由跟踪:
nmap -traceroute <target ip>
Nmap 結果輸出:
結果輸出到 outputfile.txt
nmap -oN outputfile.txt 192.168.1.1
儲存到XML
nmap -oX outputfile.xml 192.168.1.1
nmap -oG outputfile.txt 192.168.1.1
nmap -oA outputfile 192.168.1.1
** Output only the IP addresses of the online machines with nmap:
nmap -n -sn 192.0.2.0/24 -oG - | awk '/Up$/{print $2}' 1>outputfile.txt &
Quick rundown of options and commands:
-n turns off reverse name resolution, since you just want IP addresses. On a local LAN this is probably the slowest step, too, so you get a good speed boost.
-sn means "Don't do a port scan." It's the same as the older, deprecated -sP with the mnemonic "ping scan."
-oG - sends "grepable" output to stdout, which gets piped to awk.
/Up$/ selects only lines which end with "Up", representing hosts that are online.
{print $2} prints the second whitespace-separated field, which is the IP address.
常用指令碼使用案例
掃描伺服器的常見漏洞
nmap --script vuln
檢查FTP是否開啟匿名登陸
nmap --script ftp-anon.nse
PORT STATE SERVICE
21/tcp open ftp
| ftp-anon: Anonymous FTP login allowed (FTP code 230)
| -rw-r--r-- 1 1170 924 31 Mar 28 2001 .banner
| d--x--x--x 2 root root 1024 Jan 14 2002 bin
| d--x--x--x 2 root root 1024 Aug 10 1999 etc
| drwxr-srwt 2 1170 924 2048 Jul 19 18:48 incoming [NSE: writeable]
| d--x--x--x 2 root root 1024 Jan 14 2002 lib
| drwxr-sr-x 2 1170 924 1024 Aug 5 2004 pub
|_Only 6 shown. Use --script-args ftp-anon.maxlist=-1 to see all.
nmap -p 21 --script ftp-brute.nse
PORT STATE SERVICE
21/tcp open ftp
| ftp-brute:
| Accounts
| root:root - Valid credentials
| Statistics
|_ Performed 510 guesses in 610 seconds, average tps: 0
nmap -p 22 --script sshv1.nse
PORT STATE SERVICE
22/tcp open ssh
|_sshv1: Server supports SSHv1
nmap --script ip-geolocation-* <target>
nmap --script ip-geolocation-geoplugin <target>
| ip-geolocation-geoplugin: | 74.207.244.221 (scanme.nmap.org) | coordinates (lat,lon): 39.4208984375,-74.497703552246 |_ state: New Jersey, United States
=====================================
Nmap在实际中应用场合如下:
1、 通过对设备或者防火墙的探测来审计它的安全性
2、 探测目标主机所开放的端口
3、 通过识别新的服务器审计网络的安全性
4、 探测网络上的主机
端口扫描工具,即借助工具,试图了解所扫描IP提供的计算机网络服务类型(网络服务均与端口号相关),从而发现攻击弱点,常见服务对应端口号:
HTTP 80
HTTPS 443
Telnet 23
FTP 21
SSH(安全登录)、SCP(文件传输)、端口重定向 22
SMTP 25
POP3 110
WebLogic 7001
TOMCAT 8080
WIN2003远程登录 3389
Oracle数据库1521
MS SQL* SEVER数据库sever 1433
MySQL 数据库sever 3306
=====================================
留言
發佈留言