forked from startagain2016/Londly01-safety-tool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
londly.py
190 lines (175 loc) · 5.73 KB
/
londly.py
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#coding:utf-8
import os
import time
import argparse
import shutil
def biaoti():
splash1 = """
__ __ __
| \ | \| \
| $$ ______ _______ ____| $$| $$ __ __
| $$ / \ | \ / $$| $$| \ | \
| $$ | $$$$$$\| $$$$$$$\| $$$$$$$| $$| $$ | $$
| $$ | $$ | $$| $$ | $$| $$ | $$| $$| $$ | $$
| $$____| $$__/ $$| $$ | $$| $$__| $$| $$| $$__/ $$
| $$ \$$ $$| $$ | $$ \$$ $$| $$ \$$ $$
\$$$$$$$$\$$$$$$ \$$ \$$ \$$$$$$$ \$$ _\$$$$$$$
| \__| $$
\$$ $$
\$$$$$$
"""
print(splash1)
def args():
parser = argparse.ArgumentParser(description='Masscan2Httpx2Nuclei')
#help换行
parser.add_argument('-i', '--input', help='参考masscan -iL', required=True)
parser.add_argument('-p', '--port',help='参考masscan -p', required=True)
parser.add_argument('-rate','--rate', help='参考masscan速率rate', required=True)
args = parser.parse_args()
return args
def update():
splash00 = """
+----------------------------------+
| 正在更新nuclei&xray
+----------------------------------+
"""
print(splash00)
os.system('./nuclei -update')
os.system('./xray_linux_amd64 upgrade')
splash03 = """
+----------------------------------+
| 检查完毕,解放双手!!
+----------------------------------+
"""
print(splash03)
def check_args(args):
if not os.path.exists(args.input):
print('ip文件不存在')
exit()
if not args.port:
print('请输入端口参数')
exit()
if not args.rate:
print('请输入扫描速率(例:-rate 2000)')
exit()
return args
def masscan2httpx2nuclei(args):
args = check_args(args)
input_file = args.input
port = args.port
rate = args.rate
os.system('masscan -iL ' + input_file + ' -p' + port + ' -oL masscan.txt --rate ' + rate)
def cdn():
os.system('python3 cdn.py list.txt')
def masscan2httpx2nuclei_main():
while True:
if os.path.exists("masscan.txt"):
break
else:
time.sleep(1)
if os.path.getsize("masscan.txt") == 0:
splash3 = """
+----------------------------------+
| 无端口开放,程序已退出!
+----------------------------------+
"""
print(splash3)
exit()
else :
splash4 = """
+----------------------------------------+
| Masscan扫描结果解析并调用httpx
+----------------------------------------+
"""
print(splash4)
masscanfile = open("masscan.txt", "r")
masscanfile.seek(0)
for line in masscanfile:
if line.startswith("#"):
continue
if line.startswith("open"):
line = line.split(" ")
with open("masscanconvert.txt", "a") as f:
f.write(line[3]+":"+line[2]+"\n")
f.close()
masscanfile.close()
if os.path.exists("masscan.txt"):
os.system('./httpx -l masscanconvert.txt -nc -o httpxresult.txt')
os.remove("masscan.txt")
splash2 = """
+----------------------------------+
| Httpx is done !
+----------------------------------+
"""
print(splash2)
else:
splash5 = """
+----------------------------------+
| 未发现解析后的masscan端口结果
+----------------------------------+
"""
print(splash5)
exit()
def observer():
os.system('./observer -f masscanconvert.txt -c observer.txt')
def Finger():
path=os.getcwd()
os.system('python3 Finger/Finger.py -f ' + path + r"/masscanconvert.txt")
files = path + r"/Finger/output/"
b = os.listdir(files)
new = path
for f in b:
shutil.move(files + f, new)
def fscan():
os.system('./fscan64 -hf ip.txt -o fscan.txt')
def nu():
if os.path.exists("httpxresult.txt"):
os.system('./nuclei -l httpxresult.txt -s medium,high,critical -o nucleiresult.txt')
os.system('./xray_linux_amd64 webscan -url-file httpxresult.txt --html-output xray.html')
os.remove("httpxresult.txt")
os.remove("masscanconvert.txt")
else:
print("扫描结果未发现http协议")
exit()
if os.path.exists("nucleiresult.txt"):
splash6 = """
+----------------------------------+
| 扫描完成,请查看nucleiresult.txt
+----------------------------------+
"""
print(splash6)
else:
splash7 = """
+----------------------------------+
| nuclei未发现中高危漏洞
+----------------------------------+
"""
print(splash7)
if os.path.exists("xray.html"):
splash8 = """
+----------------------------------+
| 扫描完成,请查看xray.html
+----------------------------------+
"""
print(splash8)
else:
splash9 = """
+----------------------------------+
| xray未发现漏洞
+----------------------------------+
"""
print(splash9)
exit()
def main():
biaoti()
update()
cdn()
masscan2httpx2nuclei(args())
masscan2httpx2nuclei_main()
observer()
Finger()
fscan()
nu()
if __name__ == '__main__':
main()
exit()