零基礎(chǔ)學(xué)黑客,搜索公眾號(hào):白帽子左一
另,免費(fèi)領(lǐng)取黑客入門學(xué)習(xí)資料包及練手靶場!
xray是北京長亭科技其下的一款漏洞掃描工具,工具很好用只是沒有批量掃描的功能,今天就帶大家一起批量掃描。
官方網(wǎng)站:https://xray.cool/
直接下載就好
xray使用:
cd E:\滲透工具\(yùn)xray_windows_amd64.exe
基本爬蟲掃描
./xray_windows_amd64.exe webscan —basic-crawler url —html-output 1.html
代理模式與瀏覽器聯(lián)動(dòng)
.\xray_windows_amd64.exe webscan —listen 127.0.0.1:8080 —html-output 123.html
批量檢查的 1.file 中的目標(biāo), 一行一個(gè)目標(biāo),帶端口 沒有基本爬蟲功能?。。?/p>
./xray_windows_amd64.exe webscan —url-file 60.txt —html-output 1.html
python pppXray.py -r target.txt
有這些就夠用了
我習(xí)慣使用powershell運(yùn)行xray,因?yàn)閜owershell顏色分明更好看一些。
第一次使用的時(shí)候要初始化一下。
cd 到xray的目錄?
比如:cd E:\滲透工具\(yùn)xray_windows_amd64.exe
之后./xray_windows_amd64.exe webscan —basic-crawler {要掃描的url} —html-output 1.html
初始化完會(huì)出現(xiàn)config.yaml的配置文件
xray默認(rèn)是不掃描edu.cn的,想挖教育src的需要手動(dòng)更改
要更改的地方長這樣,在config.yaml里,把edu.cn刪掉就好了,應(yīng)該一共有兩處。
當(dāng)然以上都不是重點(diǎn)
重點(diǎn):github上有這樣一款工具可以讓xray批量進(jìn)行掃描
下載鏈接:
https://github.com/Cl0udG0d/pppXray
運(yùn)行需要python3的環(huán)境
pppXray和xray要放在相同的文件夾下
首先要pip安裝click
cmd運(yùn)行:pip install click
還有幾個(gè)位置是需要手動(dòng)更改的,在pppXray.py中
這個(gè)位置要改成你電腦里xray的名字
使用工具時(shí)輸入
python pppXray.py -r target.txt
target.txt里可以直接放url,沒有http:// 的也可以工具會(huì)自動(dòng)加上。
運(yùn)行時(shí)大概就是這樣的
—basic-crawler是基本爬蟲掃描會(huì)使用xray自帶的爬蟲爬取url進(jìn)行漏洞掃描
—html-output
是以html形式輸出漏洞報(bào)告, E:\滲透工具
\xray_windows_amd64.exe\save\a41c7ff9f598c880a1fa99ca9fbdc65a.html是輸出文件路徑和文件名,這一步是自動(dòng)的。
之后我魔改了一下原版的pppXray
import hashlib
import re
import time
import os
import click
import config
import winsound
@click.command()
@click.option('-r', '--readfile',default='target.txt',help='xray批量掃描讀取文件名,按行讀取',type=str)
@click.option('--plugins',help='自定義xray插件 plugins')
def init(readfile,plugins):
? ? """pppXray : xray 批量掃描\n
? ? ? https://github.com/Cl0udG0d/pppXray
? ? """
? ? try:
? ? ? ? if not os.path.exists(config.saveDir):
? ? ? ? ? ? os.makedirs(config.saveDir)
? ? ? ? config.targetFileName=readfile
? ? ? ? if plugins:
? ? ? ? ? ? config.plugins=plugins
? ? ? ? click.echo("讀取文件 {} ".format(readfile))
? ? except Exception as e:
? ? ? ? print(e)
? ? ? ? pass
def xrayScan(targeturl,outputfilename="test"):
? ? scanCommand = "xray_windows_amd64.exe? webscan {} --basic-crawler {} --html-output {}\\{}.html".format('--plugins {}'.format(config.plugins) if config.plugins else '',targeturl, config.saveDir,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? outputfilename)
? ? print(scanCommand)
? ? os.system(scanCommand)
? ? return
def pppGet():
? ? f = open(config.targetFileName)
? ? lines = f.readlines()
? ? pattern = re.compile(r'^http')
? ? for line in lines:
? ? ? ? try:
? ? ? ? ? ? if not pattern.match(line.strip()):
? ? ? ? ? ? ? ? targeturl="https://"+line.strip()
? ? ? ? ? ? else:
? ? ? ? ? ? ? ? targeturl=line.strip()
? ? ? ? ? ? print(targeturl.strip())
? ? ? ? ? ? outputfilename=hashlib.md5(targeturl.encode("utf-8"))
? ? ? ? ? ? xrayScan(targeturl.strip(), outputfilename.hexdigest())
? ? ? ? ? ? # print(type(line))
? ? ? ? except Exception as e:
? ? ? ? ? ? print(e)
? ? ? ? ? ? pass
? ? f.close()
? ? print("Xray Scan End~")
? ? winsound.Beep(600,5000)
? ? return
def main():
? ? try:
? ? ? ? print(config.logo())
? ? ? ? init.main(standalone_mode=False)
? ? ? ? pppGet()
? ? except Exception as e:
? ? ? ? print(e)
? ? ? ? pass
? ? return
if __name__ == '__main__':
? ? main()
導(dǎo)入包
import winsound
掃描結(jié)束時(shí)
winsound.Beep(600,5000)
系統(tǒng)beep響5秒鐘
掃描漏洞的時(shí)候人可以一邊休息,掃完有提示音的時(shí)候再回來看就好了。
漏洞報(bào)告會(huì)在pppxray下的一個(gè)save文件夾里
之后漏洞報(bào)告是這樣的
圖中表示漏洞為XSS觸發(fā)參數(shù)為colurnmid