diff --git a/apk/bin/deadnet-1.0-arm64-v8a_armeabi-v7a-debug.apk b/apk/bin/deadnet-1.0-arm64-v8a_armeabi-v7a-debug.apk index 972f4a8..d3eb8f2 100644 Binary files a/apk/bin/deadnet-1.0-arm64-v8a_armeabi-v7a-debug.apk and b/apk/bin/deadnet-1.0-arm64-v8a_armeabi-v7a-debug.apk differ diff --git a/apk/deadnet_apk.py b/apk/deadnet_apk.py index ff94bca..59e0d84 100755 --- a/apk/deadnet_apk.py +++ b/apk/deadnet_apk.py @@ -7,11 +7,12 @@ import ipaddress import subprocess import platform as pt -from threading import Condition from utils import * from android.permissions import request_permissions, Permission +request_permissions([Permission.WRITE_EXTERNAL_STORAGE, Permission.INTERNET, Permission.ACCESS_WIFI_STATE, + Permission.ACCESS_NETWORK_STATE, Permission.ACCESS_FINE_LOCATION, Permission.CHANGE_WIFI_STATE]) logging.getLogger("scapy.runtime").setLevel(logging.ERROR) # suppress warnings from scapy.all import * @@ -38,17 +39,12 @@ class DeadNetAPK: "aarch64": "arm64", "i386": "i386", } - MISSING_ANDROID_PERMISSIONS = [Permission.WRITE_EXTERNAL_STORAGE, Permission.INTERNET, Permission.ACCESS_WIFI_STATE, - Permission.ACCESS_NETWORK_STATE, Permission.ACCESS_FINE_LOCATION, - Permission.CHANGE_WIFI_STATE] - CONDITION_ANDROID_PERMISSIONS = Condition() def __init__(self, iface, gateway_ipv4, gateway_ipv6, gateway_mac=None, print_mtd=None): - self.print_mtd = print_mtd - self.network_interface = iface conf.iface = self.network_interface + self.print_mtd = print_mtd self.my_mac = netifaces.ifaddresses(iface)[netifaces.AF_LINK][0]['addr'] self.loop_count = 0 @@ -102,16 +98,6 @@ def __init__(self, iface, gateway_ipv4, gateway_ipv6, gateway_mac=None, print_mt f"IPv4 subnet range - {self.subnet_ipv4_sr}\n" \ f"IPv4 gateway - {self.gateway_ipv4}\n\n" - @staticmethod - def permissions_callback(permissions, results): - DeadNetAPK.MISSING_ANDROID_PERMISSIONS.clear() - if not all(results): - for perm, result in zip(permissions, results): - if not result: - DeadNetAPK.MISSING_ANDROID_PERMISSIONS.append(perm) - with DeadNetAPK.CONDITION_ANDROID_PERMISSIONS: - DeadNetAPK.CONDITION_ANDROID_PERMISSIONS.notify() - def get_ipv6_data(self): prefix, preflen = str(), int() try: @@ -172,12 +158,3 @@ def start_attack(self): self.print_mtd(f"{self.abort}", True) else: self.print_mtd(f"{self.intro}{self.abort}") - - -def request_user_permissions(): - request_permissions(DeadNetAPK.MISSING_ANDROID_PERMISSIONS, DeadNetAPK.permissions_callback) - with DeadNetAPK.CONDITION_ANDROID_PERMISSIONS: - DeadNetAPK.CONDITION_ANDROID_PERMISSIONS.wait() - - -request_user_permissions() diff --git a/apk/main.py b/apk/main.py index 2ca6c26..267b5f9 100644 --- a/apk/main.py +++ b/apk/main.py @@ -2,10 +2,9 @@ import threading import netifaces import subprocess -import traceback from utils import * -from deadnet_apk import DeadNetAPK, request_user_permissions +from deadnet_apk import DeadNetAPK from kivy.app import App from jnius import autoclass @@ -19,13 +18,13 @@ def __init__(self, **kwargs): self.ssid_name = "undefined" self._abort_lck = threading.RLock() + self.setup_network_data() self._deadnet_ins = None self._root_status = False try: subprocess.call(["su"]) # test root self._root_status = True - self.setup_network_data() # if not root - should not get here except (PermissionError, FileNotFoundError): pass @@ -64,25 +63,28 @@ def set_ssid_name(self): @staticmethod def init_gateway(): gateway_ipv4, gateway_ipv6, iface, gateway_hwaddr = "undefined", "undefined", "undefined", "undefined" - gateways = netifaces.gateways() - ipv4_data = gateways[netifaces.AF_INET][0] # take first for IPv4 - gateway_ipv4 = ipv4_data[0] - iface = ipv4_data[1] - - ipv6_data = gateways.get(netifaces.AF_INET6, list()) - for d in ipv6_data: - if d[1] == iface: - gateway_ipv6 = d[0] - - result = subprocess.run(['ip', 'neighbor', 'show', 'default'], capture_output=True, text=True) - output = result.stdout.strip() - - for line in output.split('\n'): - columns = line.split() - if len(columns) >= 4: - if columns[3] == 'lladdr' and columns[4] != '' and columns[2] == iface: - gateway_hwaddr = columns[4] - break + try: + gateways = netifaces.gateways() + ipv4_data = gateways[netifaces.AF_INET][0] # take first for IPv4 + gateway_ipv4 = ipv4_data[0] + iface = ipv4_data[1] + + ipv6_data = gateways.get(netifaces.AF_INET6, list()) + for d in ipv6_data: + if d[1] == iface: + gateway_ipv6 = d[0] + + result = subprocess.run(['ip', 'neighbor', 'show', 'default'], capture_output=True, text=True) + output = result.stdout.strip() + + for line in output.split('\n'): + columns = line.split() + if len(columns) >= 4: + if columns[3] == 'lladdr' and columns[4] != '' and columns[2] == iface: + gateway_hwaddr = columns[4] + break + except Exception as exc: + pass return gateway_ipv4, gateway_ipv6, gateway_hwaddr, iface @@ -92,12 +94,6 @@ def is_root(self): return False return True - def has_permissions(self): - if len(DeadNetAPK.MISSING_ANDROID_PERMISSIONS) > 0: - self.printf(f"Mandatory permissions are not granted:\n{','.join(DeadNetAPK.MISSING_ANDROID_PERMISSIONS)}") - return False - return True - def on_ref_credit_press(self, *args, **kwargs): import webbrowser webbrowser.open("https://github.com/flashnuke") @@ -106,19 +102,8 @@ def on_start_press(self): if self.is_root(): threading.Thread(target=self.do_attack, args=tuple()).start() - def ssid_is_set(self): - if "" in self.ssid_name: - self.setup_network_data() - return "" not in self.ssid_name - def do_attack(self): - if self.is_root(): - if not self.has_permissions(): - request_user_permissions() - self.setup_network_data() - return - if not self.ssid_is_set(): - return + if self.is_root() and "" not in self.ssid_name: with self._abort_lck: if self._deadnet_ins: return @@ -126,7 +111,7 @@ def do_attack(self): self._deadnet_ins = DeadNetAPK(self._IFACE, self._GATEWAY_IPV4, self._GATEWAY_IPV6, self._GATEWAY_HWDDR, self.printf) except Exception as exc: - self.printf(f"error during setup -> {exc}\n{traceback.format_exc()}") + self.printf(f"error during setup -> {exc}") return self._deadnet_ins.start_attack()