-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmy_xray.py
More file actions
33 lines (31 loc) · 1.13 KB
/
my_xray.py
File metadata and controls
33 lines (31 loc) · 1.13 KB
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
# -!- coding: utf-8 -!-
import re
import subprocess
import os
from colorama import init,Fore,Back,Style
init(autoreset=True)
def sh(command, print_msg=True):
VulnType=[] #漏洞类型存在这里
Target=[] #漏洞站点存在这里
p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
lines = []
for line in iter(p.stdout.readline, b''):
line = line.rstrip().decode('utf-8')
if print_msg:
print(">>>", line)
if "[Vuln:" in line:
Target.append(line)
elif "Target" in line:
Target.append(line)
elif "VulnType" in line:
Target.append(line)
else:
pass
lines.append(line)
#如果line里面的记录不是空的则写入到文件
for vuln in Target:
w = open(os.getcwd()+"\log\\vulns.txt", 'a+') # 存储漏洞信息的txt
w.write(vuln+"\n")
return lines
if __name__ == '__main__':
sh('xray.exe webscan {0} --html-output wwwwwwwwwww.html --basic-crawler'.format(input("网站:")))