0x01 安装 xray 和 rad 版本 1.0 基础功能 2022.2.24
版本 2.0 增加 screen 2022.8.13
运行环境
xray https://github.com/chaitin/xray
rad https://github.com/chaitin/rad
安装就不用多说了,安装Linux版的就行了
0x02 运行脚本 脚本介绍:rad+xray 融合,探测批量目标
这个脚本是在 window下运行的,所以你要把xray.exe该成你Linux版xray的名字
根据你自己需要选择即可
https://github.com/timwhitez/rad-xray
运行脚本会发现出现错误,no chrome found,因为 rad 运行需要 chrome 浏览器,所以要安装chrome浏览器
防脚本丢失-将原文贴过来了(如有侵权请邮箱联系我删除)。
社区版用户 url一行一个放url.txt中,和rad放同文件夹
xray开启监听,
./xray webscan –listen 127.0.0.1:7777 –html-output report__datetime__.html
运行py
python3 rad+xray.py
注意:单个任务结束后会kill所有的chrome进程
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 import subprocessimport platformimport osimport timedef main (data1 ): target = data1 print (target + " Start Crawling" ) cmd = ["./rad" ,"-t" ,target,"--auto-index" , "--http-proxy" , "127.0.0.1:7777" , "--no-banner" ] try : output = subprocess.check_output(cmd, timeout=3600 ) print (output.decode("utf-8" )) except Exception as e: return if __name__=='__main__' : sysstr = platform.system() file = open ("url.txt" ) for text in file.readlines(): data1=text.strip('\n' ) main(data1) print (data1 + " Finish" ) time.sleep(10 ) try : if (sysstr =="Windows" ): os.system("taskkill /f /IM chrome*" ) elif (sysstr =="Linux" ): os.system("ps aux | awk '/chrome/ { print $2 } ' | xargs kill -9" ) except : pass
高级版用户 url一行一个放url.txt中
xray+rad.py 和 xray 和 rad 放同一文件夹
运行py:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 import subprocessdef main (data1 ): target = data1 cmd = ["./xray" ,"webscan" ,"--browser-crawler" ,target,"--html-output" ,"report__datetime__.html" ] rsp=subprocess.Popen(cmd) output, error = rsp.communicate() print (output) if __name__=='__main__' : file = open ("url.txt" ) for text in file.readlines(): data1=text.strip('\n' ) main(data1)
解决方案 安装 Chrome
centos7 安装
1 2 3 4 5 6 7 8 9 10 11 wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm yum install -y google-chrome-stable_current_x86_64.rpm yum install libpcap-devel -y cp /usr/lib64/libpcap.so /usr/lib64/libpcap.so.0.8 yum update glib2 -y /opt/google/chrome/chrome --version yum autoremove -y google-chrome
ubuntu 安装
1 2 wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb sudo apt install ./google-chrome-stable_current_amd64.deb
再次运行xray你会发现又出现错误了,
1 [launcher] Failed to get the debug url: [0224/025251.434358:ERROR:zygote_host_impl_linux.cc(90)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
原因是chrome的沙箱问题,不能以root用户运行。
解决方案 修改 /usr/bin/ 目录下的 google-chrome 配置文件
1 2 3 4 5 6 7 8 vim /usr/bin/google-chrome # 找到如下 exec -a "$0" "$HERE/chrome" "$@" # exec -a "$0 " "$HERE /chrome" "$@ " 注释掉 # 添加 exec -a "$0" "$HERE/chrome" "$@" --user-data-dir --no-sandbox
重新运行xray脚本即可
0x03 扩展:脚本后台运行 如果不使用此命令,如果断开 shell 终端,任务会结束
具体的可以参考这个 nohup
后台运行方式一:nohup 1.后台运行
1 nohup python3 browerscan.py &
2.查看项目生成的数据
动态显示数据进程
3.查看后台运行
4.杀死后台
1 2 ps -aux | grep python3 kill python3 的UID
后台运行方式二:screen(推荐) 系统管理员经常需要SSH 或者telent 远程登录到Linux 服务器,经常运行一些需要很长时间才能完成的任务,比如系统备份、ftp 传输等等。通常情况下我们都是为每一个这样的任务开一个远程终端窗口,因为它们执行的时间太长了。必须等待它们执行完毕,在此期间不能关掉窗口或者断开连接,否则这个任务就会被杀掉。
参考链接 https://www.cnblogs.com/mchina/archive/2013/01/30/2880680.html
安装
1 2 3 4 5 yum install screen -y sudo apt-get install screen -y
使用
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 screen screen -S test screen vi test.txt ctrl+a,d exit screen -ls screen -r 2276 screen -wipe screen -d **** [root@localhost ~] �*B00000000000000 先按Ctrl+a键,然后释放,然后再按[键即可进入翻页模式。使用鼠标可以滚动 切回之前模式 Ctrl+c
快捷键
1 2 3 4 5 6 Ctrl + a,d Ctrl + a,c Ctrl + a,w Ctrl + a,p Ctrl + a,n Ctrl + a,0-9
所有命令参数
1 2 3 4 5 6 7 8 9 10 11 12 -A 将所有的视窗都调整为目前终端机的大小。 -d <作业名称> 将指定的screen作业离线。 -h <行数> 指定视窗的缓冲区行数。 -m 即使目前已在作业中的screen作业,仍强制建立新的screen作业。 -r <作业名称> 恢复离线的screen作业。 -R 先试图恢复离线的作业。若找不到离线的作业,即建立新的screen作业。 -s 指定建立新视窗时,所要执行的shell。 -S <作业名称> 指定screen作业的名称。 -v 显示版本信息。 -x 恢复之前离线的screen作业。 -ls或--list 显示目前所有的screen作业。 -wipe 检查目前所有的screen作业,并删除已经无法使用的screen作业。
参考链接
https://github.com/timwhitez/rad-xray
https://blog.csdn.net/yelllowcong/article/details/80159963
https://blog.csdn.net/weixin_42250835/article/details/119983347