信息收集工具recon-ng详细使用教程
前言:
最近在找Recon-ng詳細(xì)一點(diǎn)的教程,可是Google才發(fā)現(xiàn)資料都很零散而且不詳細(xì),所以我打算具體寫(xiě)一下。Recon-ng在滲透過(guò)程中主要扮演信息收集工作的角色,同時(shí)也可以當(dāng)作滲透工具,不過(guò)相關(guān)的攻擊模塊很少,只有自己擴(kuò)展。其實(shí)Recon-ng最大的優(yōu)點(diǎn)就是模塊化,功能可以自己任意擴(kuò)展。只要想象力夠豐富,這個(gè)就可以成為神器,下面為詳細(xì)教程。
0×01安裝
1. 安裝recon-ng及依賴文件:
gitclone https://bitbucket.org/LaNMaSteR53/recon-ng.git #然后把其中的文件移動(dòng)到你希望的目錄即可,并加入path即可
到其目錄下運(yùn)行recon-ng文件即可
./recon-ng
#第一次啟動(dòng)時(shí)你可能會(huì)被告知有什么依賴沒(méi)有安裝,根據(jù)提示把依賴安裝即可
pipinstallxlsxwriter#ie
#然后根據(jù)提示安裝完即可
0×02 模塊使用
1. 啟動(dòng)部分
recon-ng-h
可以看到上面的具體參數(shù),常用的就‘-w’參數(shù),我們這里新開(kāi)一個(gè)工作區(qū)ptest
Recon-ng-wptest
輸入help可查看幫助,下面用法已解釋得很清楚.
2. 模塊
Recon-ng有偵查,發(fā)現(xiàn),匯報(bào),和攻擊四大塊(import沒(méi)發(fā)現(xiàn)有多大的用處,所以暫時(shí)為四大塊),可用showmodules查看有哪些模塊。下面我具體介紹下各板塊下比較好用的模塊和具體用法。
(1) 偵查版塊
Profiler模塊: 查詢某個(gè)用戶名在那些網(wǎng)站(知名)有注冊(cè)。
可用searchprofiler查詢?cè)诰唧w路徑
使用模塊:userecon/profiles-profiles/profiler
查看用法:showinfo
根據(jù)提示,需要設(shè)置SOURCE選項(xiàng),用命令:setSOURCEcesign
然后運(yùn)行:run
查看結(jié)果(根據(jù)提示更新了profiles表,查看表的命令為show<tables>):showprofiles
這是我的用戶名,上面的網(wǎng)站好像我只有注冊(cè)過(guò)兩個(gè)。這個(gè)腳本是可以擴(kuò)展的,所以你可以擴(kuò)展你想要查找的網(wǎng)站,關(guān)于模塊的創(chuàng)建后面解釋。
Hashes_org模塊:反查哈希加密
#這個(gè)模塊需要apikey才能用,下面提一下apikey的添加和刪除
Keyslist#查看現(xiàn)有的apikeys
Keysaddhashes_apiakshdkahsdhkhasdkjfhkshfdkasdf
Keyslist#可看到api已被添加進(jìn)去
Keysdeletehashes_api#刪除key
#對(duì)于delete還可以刪除表,如刪除profiles的1-2行
Deleteprofiles1-2#Api被添加進(jìn)去后就可以用了(api的申請(qǐng)我就不介紹了)
Setsourcee13dd027be0f2152ce387ac0ea83d863
Run #可以看到被解,加密i方式為md5
Metacrawler模塊:網(wǎng)站文件搜索(如pdf,xlsx文件等,其實(shí)就是googlehack技術(shù))
Searchmetacrawler
Userecon/domains-contacts/metacrawler
Setsourcehdu.edu.cn
run
Dev_diver模塊:查找某個(gè)用戶是否存在某些代碼庫(kù)
Searchdev_diver
Usepath-to/dev_diver
Showinfo
Setsourcecesign
Run#結(jié)果如圖所示
Ipinfodb模塊:查詢ip的相關(guān)信息,如地理位置(這個(gè)功能要api)
Searchipinfodb
Usepath-to/ipinfodb
Showinfo
Setsource104.238.148.9
run
Brute_hosts模塊:暴力破解子域名
Searchbrute_hosts
Usepath-to/brute_hosts
Showinfo
Setsourcehdu.edu.cn
Run
Showhosts
Google_site_web模塊:相關(guān)域名查詢(子域名)
Searchgoogle_site_web
Usepath-to/google_site_web
Showinfo
Setsource****
Run
Showoptions:列出可用的選
(2)發(fā)現(xiàn)版塊
Interesting_files模塊:查找某網(wǎng)站的敏感文件
命令跟前面一樣
Searchinteresting_files
Usediscovery/info_disclosure/interesting_files
Showinfo#查看用法,可以看到參數(shù)比較多,含義我就不解釋了
我這里嘗試一下自己的網(wǎng)站(可以自己添加敏感文件)
Setsourcejwcesign.studio
Setport80
Setprotocolhttp
Run
結(jié)果如下(沒(méi)有敏感文件)
(3)攻擊版塊
command_injector模塊:命令注入,多用于木馬文件
Searchcommand_injector
Usepath-to/command_injector
Showinfo#可以看到具體的參數(shù)
setbase_urlhttp://172.16.227.128/other/a.php
木馬文件a.php代碼如下:
Setparameterscmd=<rce>
run
(4)報(bào)告版塊
Html模塊:把運(yùn)行的結(jié)果生成html文件
Searchhtml
Usepath-to/html
Showinfo
Setcreatorcesign
Setcustomercesign
run
0×03模塊的構(gòu)建
前面都是軟件自帶的模塊,如果我們想自己建立模塊,該怎么辦呢?
下面是教程
如果要建立自己的模塊,在home目錄下的’.recon-ng’下建立modules文件夾,然后在分別根據(jù)模塊屬性來(lái)建立文件,如建立偵查板塊,需要建立recon文件夾,下面以我建立一個(gè)模塊為例:
Cd~
Cd.rcon-ng
Mkdirmodules
Cdmodules
Mkdirrecon
Cdrecon
Mkdirfindproxy
Cdfindproxy
Vimfind_proxy.py
模塊文件主要的格式就是
fromrecon.core.moduleimportBaseModule
classModule(BaseModule):
meta={
'name':'something...',
'author':‘something...’,
'description':'something...',
'query':something...' ##這個(gè)最好寫(xiě)清楚,方便別人查看用法
}
defmudule_run(self[,type]):
#somecode,self參數(shù)可以用來(lái)獲取一些apikey等,type含有source的數(shù)據(jù)
Pass
下面是我具體的代碼,這是一個(gè)找代理的模塊(httpproxy,httpsproxy,socks4proxy,sockts5proxy)
#-*-coding:utf-8-*-
fromrecon.core.moduleimportBaseModule
importre
fromseleniumimportwebdriver
fromselenium.webdriver.common.desired_capabilitiesimportDesiredCapabilities
frombs4importBeautifulSoup
importsubprocess
importos
importurllib
importcopy
importtime
importjsbeautifier
classModule(BaseModule):
meta={
'name':'Findfreeproxy...',
'author':'Cesign',
'description':'finddefferentproxy,therearefourkindsofproxy,http,https,socks4andsocks5,andthecodeish,s,4,5....Enjoy!!!',
'query':'finddefferentproxy,therearefourkindsofproxy,http,https,socks4andsocks5,andthecodeish,s,4,5....Enjoy!!!'
}
defmodule_run(self,type):
STYLE={
'fore':
{#前景色
'black':30,#黑色
'red':31,#紅色
'green':32,#綠色
'yellow':33,#黃色
'blue':34,#藍(lán)色
'purple':35,#紫紅色
'cyan':36,#青藍(lán)色
'white':37,#白色
},
'back':
{#背景
'black':40,#黑色
'red':41,#紅色
'green':42,#綠色
'yellow':43,#黃色
'blue':44,#藍(lán)色
'purple':45,#紫紅色
'cyan':46,#青藍(lán)色
'white':47,#白色
},
'mode':
{#顯示模式
'mormal':0,#終端默認(rèn)設(shè)置
'bold':1,#高亮顯示
'underline':4,#使用下劃線
'blink':5,#閃爍
'invert':7,#反白顯示
'hide':8,#不可見(jiàn)
},
'default':
{
'end':0,
},
}
defUseStyle(string,mode='',fore='',back=''):
mode='%s'%STYLE['mode'][mode]ifSTYLE['mode'].has_key(mode)else''
fore='%s'%STYLE['fore'][fore]ifSTYLE['fore'].has_key(fore)else''
back='%s'%STYLE['back'][back]ifSTYLE['back'].has_key(back)else''
style=';'.join([sforsin[mode,fore,back]ifs])
style='33[%sm'%styleifstyleelse''
end='33[%sm'%STYLE['default']['end']ifstyleelse''
return'%s%s%s'%(style,string,end)
print'[*]Pleasewait,itwilltakeabout2minutes...'
dcap=dict(DesiredCapabilities.PHANTOMJS)
dcap["phantomjs.page.settings.userAgent"]=(
"Mozilla/5.0(X11;Linuxx86_64;rv:45.0)Gecko/20100101Firefox/45.0"
)
driver=webdriver.PhantomJS(desired_capabilities=dcap,service_log_path=r"/home/cesign/watchlog.log")
driver.set_window_size(1920,1080)
driver.get('https://hidemy.name/en/proxy-list/?type='+str(type[0])+'#list')
time.sleep(1)
soup=BeautifulSoup(driver.page_source,'html.parser')
allurl=soup.find_all(name='td')
result={
'h':lambdax:'http',
's':lambdax:'https',
'4':lambdax:'socks4',
'5':lambdax:'socks5',
}
i=0
printUseStyle('[*]Searchproxy:type:'+result[str(type[0])]('hello'),fore='blue')
printUseStyle('[*]IPadress---Port---Country,City---Speed---Type---Anonymity---Lastcheck',fore='blue')
whileTrue:
try:
part=[]
part=allurl[i:i+7]
i=i+7
printUseStyle('[*]'+part[0].text+'---'+part[1].text+'---'+part[2].text+'---'+part[3].text+'---'+part[4].text+'---'+part[5].text+'---'+part[6].text,fore='green')
except:
break
driver.quit()
然后調(diào)用模塊:
Reload
Searchfind_proxy
Usepath-to/find_proxy
Showinfo
Setsourceh
Run
可以看到如此多的http代理,匿名做事就不成問(wèn)題了
0×04感言
這款軟件擴(kuò)展性比較大,自帶的模塊功能有限。
總結(jié)
以上是生活随笔為你收集整理的信息收集工具recon-ng详细使用教程的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: oracle通过执行计划cost,Ora
- 下一篇: 解决win10中chm内容显示为空白的问