Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
R00tS3c
GitHub Repository: R00tS3c/DDOS-RootSec
Path: blob/master/Botnets/Exploits/GOAHEAD/mklist.py
5038 views
1
#!/usr/bin/python
2
import sys, time, os, ssl, socket
3
from threading import Thread
4
if len(sys.argv) < 3:
5
print "Usage: python "+sys.argv[0]+" <input> <threads> <output>"
6
sys.exit()
7
ips = map(lambda s: s.strip(), open(sys.argv[1], "r").readlines())
8
threads = int(sys.argv[2])
9
thread_count = len(ips) / threads
10
thread_chunks = [ips[x:x+thread_count] for x in xrange(0, len(ips), thread_count)]
11
output = sys.argv[3]
12
found = 0
13
cons = 0
14
fails = 0
15
proc = 0
16
port = 81
17
buf = 4096
18
19
headers = "GET /ftptest.cgi HTTP/1.0\r\n\r\n"
20
21
def checkhost_headers(host):
22
global found
23
global cons
24
global fails
25
host = host.strip("\n")
26
cons += 1
27
try:
28
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
29
try:
30
sock.settimeout(5)
31
sock.connect((host, port))
32
except:
33
failed += 1
34
sock.close()
35
sock.send(headers)
36
time.sleep(2)
37
resp = sock.recv(1024)
38
if "GoAhead-Webs" in resp:
39
file = open(output, "a+")
40
file.write(host+"\n")
41
file.close()
42
found += 1
43
sock.close()
44
cons -= 1
45
except:
46
cons -= 1
47
fails += 1
48
pass
49
def worker(count):
50
global cons
51
global failed
52
global sent
53
global proc
54
global cons
55
count = int(count)
56
for i in thread_chunks[count]:
57
try:
58
proc += 1
59
checkhost_headers(i)
60
except:
61
pass
62
for x in xrange(threads):
63
try:
64
t = Thread(target=worker, args=(x,))
65
t.start()
66
except KeyboardInterrupt:
67
sys.exit()
68
except:
69
pass
70
while True:
71
try: #prints the information like how many devices its tried
72
i = found
73
sys.stdout.write("\r\033[33mProccessed \033[92m[\033[93m"+str(proc)+"\033[92m]\033[33m || \033[33mFound \033[92m[\033[93m"+str(i)+"\033[92m]\033[33m || Conns \033[92m[\033[93m"+str(cons)+"\033[92m] || Fails \033[92m[\033[93m"+str(fails)+"\033[92m]\033[0m")
74
sys.stdout.flush()
75
time.sleep(0.25)
76
except KeyboardInterrupt:
77
sys.exit("Exiting On User Input")
78
except:
79
pass
80
81