Android自动化渗透测试指令生成,可解析AndroidManifest文件并生成Drozer测试指令

admin 2026-04-22 05:42:08 网络安全文章 来源:ZONE.CI 全球网 0 阅读模式

文章总结: DrozerForge是一款Android自动化渗透测试工具,通过解析APK反编译后的AndroidManifest.xml文件自动识别安全风险并生成Drozer测试指令。工具核心功能包括全局安全风险扫描(如allowBackup、debuggable检测)、越权漏洞自动化测试、DeepLink挖掘、拒绝服务Fuzzing以及提权与数据泄露探测,支持通过命令行指定文件路径并内置XXE攻击防护机制。 综合评分: 82 文章分类: 移动安全,渗透测试,安全工具,漏洞分析


cover_image

Android 自动化渗透测试指令生成,可解析 AndroidManifest文件并生成 Drozer 测试指令

黑白之道

2026年4月21日 09:25 江西

在小说阅读器读本章

去阅读

工具介绍

DrozerForge,Android 自动化渗透测试指令生成,可解析 AndroidManifest文件并生成 Drozer 测试指令。

它通过解析 App 的 AndroidManifest.xml 文件,自动识别攻击暴露面,并输出可以直接在Drozer(https://github.com/WithSecureLabs/drozer) 控制台中执行的Payload 测试指令。

核心特性 / Features

  • 🛡️ 全局安全风险扫描:自动检测 allowBackupdebuggable 以及潜在的 StrandHogg 任务劫持风险。

  • 🔓 越权漏洞自动化(Activity):提取未加权限保护的导出 Activity,一键生成页面绕过/越权访问测试命令。

  • 🔗 DeepLink 深度挖掘(WebView):智能提取 Scheme/Host/Path,一键生成带有恶意 URL 参数的测试链路,直击任意 URL 跳转与 XSS 漏洞。

  • 💣 拒绝服务 Fuzzing(Service/Receiver):不仅提供基础启动命令,更内置了针对空对象异常(NullPointerException)的 DoS Fuzzing 专属 Payload。

  • 🗄️ 提权与数据泄露探测(Content Provider):精准识别 Exported 或拥有 GrantUriPermission 风险的 Provider,直接生成物理目录遍历(../../etc/hosts)和 SQL 注入探测命令。

  • 🧽 高保真降噪:自动过滤正常的 MAIN 启动页,聚焦真正具有潜在风险的组件。

    快速开始 / Quick Start ### 依赖安装 建议安装 defusedxml 以防御恶意 AndroidManifest 文件可能带来的 XXE 攻击: “`bash pip install defusedxml

使用方法

将需要测试的 APK 反编译(如使用 jadx),提取出 AndroidManifest.xml 文件。

默认读取当前目录下的 AndroidManifest.xml

python3 DrozerForge.py

或者通过 -f 参数指定文件路径

python3 DrozerForge.py -f /path/to/AndroidManifest.xml

DrozerForge.py

import sys
import os
import argparse
try:
    from defusedxml import ElementTree as ET # 防御 XXE 攻击
except ImportError:
    print("[!] 警告: 未安装 defusedxml,将使用原生 ET,可能存在 XML 解析安全风险。建议执行: pip install defusedxml")
    import xml.etree.ElementTree as ET

# 终端颜色代码
class Colors:
    RED = '\033[91m'
    GREEN = '\033[92m'
    YELLOW = '\033[93m'
    BLUE = '\033[94m'
    MAGENTA = '\033[95m'
    CYAN = '\033[96m'
    RESET = '\033[0m'
    BOLD = '\033[1m'

def print_banner():
    banner = rf"""{Colors.CYAN}
    ____                                 ______
   / __ \_________  ____  ___  _____    / ____/___  _________ ____
  / / / / ___/ __ \/_  / / _ \/ ___/   / /_  / __ \/ ___/ __ `/ _ \
 / /_/ / /  / /_/ / / /_/  __/ /      / __/ / /_/ / /  / /_/ /  __/
/_____/_/   \____/ /___/\___/_/      /_/    \____/_/   \__, /\___/
                                                      /____/
=====================================================================
  🎯 Android 自动化渗透测试指令生成 | 漏洞 Fuzz & 暴露面探测 v1.0
====================================================================={Colors.RESET}
    """
    print(banner)

def parse_android_manifest(xml_file):
    if not os.path.exists(xml_file):
        return None, f"未找到文件: {xml_file},请检查路径是否正确!", None, None, None, None, None

    android_ns = "http://schemas.android.com/apk/res/android"
    ns = {'android': android_ns}

    attr_exported = f'{{{android_ns}}}exported'
    attr_name = f'{{{android_ns}}}name'
    attr_scheme = f'{{{android_ns}}}scheme'
    attr_host = f'{{{android_ns}}}host'
    attr_path = f'{{{android_ns}}}path'
    attr_pathPrefix = f'{{{android_ns}}}pathPrefix'
    attr_pathPattern = f'{{{android_ns}}}pathPattern'
    attr_permission = f'{{{android_ns}}}permission'
    attr_authorities = f'{{{android_ns}}}authorities'
    attr_allowBackup = f'{{{android_ns}}}allowBackup'
    attr_debuggable = f'{{{android_ns}}}debuggable'

    try:
        tree = ET.parse(xml_file)
        root = tree.getroot()
        package_name = root.get('package', 'com.unknown.package')

        target_sdk = 30
        uses_sdk = root.find("uses-sdk")
        if uses_sdk is not None:
            target_sdk = int(uses_sdk.get(f'{{{android_ns}}}targetSdkVersion', 30))

        app_node = root.find("application")
        if app_node is None:
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;return&nbsp;None,&nbsp;"未找到 <application> 标签,XML 文件格式异常。", None, None, None, None, None

&nbsp; &nbsp; &nbsp; &nbsp; security_configs = {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;"allowBackup": app_node.get(attr_allowBackup,&nbsp;"true").lower() ==&nbsp;"true",
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;"debuggable": app_node.get(attr_debuggable,&nbsp;"false").lower() ==&nbsp;"true"
&nbsp; &nbsp; &nbsp; &nbsp; }

&nbsp; &nbsp; &nbsp; &nbsp; explicit_activities, implicit_activities, main_activities = [], [], []
&nbsp; &nbsp; &nbsp; &nbsp; dos_targets, provider_targets = [],[]

&nbsp; &nbsp; &nbsp; &nbsp; def check_exported(node, comp_type=""):
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exported_val = node.get(attr_exported)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; intent_filters = node.findall("intent-filter")
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;comp_type ==&nbsp;"provider"&nbsp;and exported_val is None:
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;return&nbsp;target_sdk < 17, intent_filters
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;exported_val ==&nbsp;"true":&nbsp;return&nbsp;True, intent_filters
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;elif&nbsp;exported_val ==&nbsp;"false":&nbsp;return&nbsp;False, intent_filters
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;elif&nbsp;exported_val is None and len(intent_filters) > 0:&nbsp;return&nbsp;True, intent_filters
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;return&nbsp;False, intent_filters

&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;# 1. 解析 Activity
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;for&nbsp;activity&nbsp;in&nbsp;root.findall(".//activity") + root.findall(".//activity-alias"):
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name = activity.get(attr_name)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;not name:&nbsp;continue
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; is_exported, intent_filters = check_exported(activity)

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; task_affinity = activity.get(f'{{{android_ns}}}taskAffinity')
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; launch_mode = activity.get(f'{{{android_ns}}}launchMode')
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;is_exported and task_affinity and launch_mode&nbsp;in&nbsp;["singleTask",&nbsp;"singleInstance"]:
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; security_configs["task_hijacking"] = name

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;not is_exported:&nbsp;continue

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; is_main = False
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;for&nbsp;filter_node&nbsp;in&nbsp;intent_filters:
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; actions =[a.get(attr_name)&nbsp;for&nbsp;a&nbsp;in&nbsp;filter_node.findall("action")&nbsp;if&nbsp;a.get(attr_name)]
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if"android.intent.action.MAIN"in&nbsp;actions:
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; is_main = True
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;break
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;is_main:
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; main_activities.append(name)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;continue

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; deep_links =[]
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;for&nbsp;filter_node&nbsp;in&nbsp;intent_filters:
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;for&nbsp;data&nbsp;in&nbsp;filter_node.findall("data"):
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; scheme = data.get(attr_scheme)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;scheme:
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; path = data.get(attr_path) or data.get(attr_pathPrefix) or data.get(attr_pathPattern)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; deep_links.append({"scheme": scheme,&nbsp;"host": data.get(attr_host),&nbsp;"path": path})

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;deep_links:
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; implicit_activities.append({"name": name,&nbsp;"links": deep_links})
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;else:
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; permission = activity.get(attr_permission)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; explicit_activities.append({"name": name,&nbsp;"permission": permission})

&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;# 2. 解析 Service & Receiver
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;for&nbsp;component&nbsp;in&nbsp;root.findall(".//service") + root.findall(".//receiver"):
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name = component.get(attr_name)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;not name:&nbsp;continue
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; comp_type =&nbsp;"service"if&nbsp;component.tag ==&nbsp;"service"else"broadcast"
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; is_exported, intent_filters = check_exported(component)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; permission = component.get(attr_permission)

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;permission and ("BIND_ACCESSIBILITY_SERVICE"in&nbsp;permission or&nbsp;"BIND_DEVICE_ADMIN"in&nbsp;permission):
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;continue

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;is_exported:
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; first_action = None
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;for&nbsp;filter_node&nbsp;in&nbsp;intent_filters:
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; actions =[a.get(attr_name)&nbsp;for&nbsp;a&nbsp;in&nbsp;filter_node.findall("action")&nbsp;if&nbsp;a.get(attr_name)]
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;actions:
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; first_action = actions[0]
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;break
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dos_targets.append({"name": name,&nbsp;"type": comp_type,&nbsp;"permission": permission,&nbsp;"action": first_action})

&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;# 3. 解析 Content Provider
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;for&nbsp;provider&nbsp;in&nbsp;root.findall(".//provider"):
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; is_exported, _ = check_exported(provider, comp_type="provider")
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; permission = provider.get(attr_permission)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; authorities = provider.get(attr_authorities)

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; grant_uri = provider.get(f'{{{android_ns}}}grantUriPermissions') ==&nbsp;"true"
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; grant_nodes = provider.findall("grant-uri-permission")
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; has_grant = grant_uri or len(grant_nodes) > 0

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;authorities and (is_exported or has_grant):
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;for&nbsp;auth&nbsp;in&nbsp;authorities.split(';'):
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; provider_targets.append({
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;"name": provider.get(attr_name),&nbsp;"authority": auth,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;"permission": permission,&nbsp;"is_exported": is_exported,&nbsp;"has_grant": has_grant
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; })

&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;return&nbsp;package_name, explicit_activities, implicit_activities, main_activities, dos_targets, provider_targets, security_configs

&nbsp; &nbsp; except Exception as e:
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;return&nbsp;None, f"XML 解析错误: {e}", None, None, None, None, None

def print_results(package_name, explicit, implicit, main_acts, dos_targets, provider_targets, security_configs):
&nbsp; &nbsp;&nbsp;print(f"\n{Colors.GREEN}[i] 已锁定目标包名: {package_name}{Colors.RESET}")

&nbsp; &nbsp;&nbsp;print(f"\n{Colors.BOLD}[+] 1. 全局应用安全配置风险{Colors.RESET}")
&nbsp; &nbsp;&nbsp;print("-"&nbsp;* 69)
&nbsp; &nbsp;&nbsp;if&nbsp;security_configs.get("allowBackup"):
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;print(f"🚨 {Colors.RED}[高危] 发现 allowBackup=\"true\",可通过 ADB 备份窃取 App 敏感数据{Colors.RESET}")
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;print(f"💻 测试命令: {Colors.CYAN}adb backup -f backup.ab -noapk {package_name}{Colors.RESET}")
&nbsp; &nbsp;&nbsp;if&nbsp;security_configs.get("debuggable"):
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;print(f"🚨 {Colors.RED}[严重] 发现 debuggable=\"true\",App 处于完全可调试状态,存在极高风险!{Colors.RESET}")
&nbsp; &nbsp;&nbsp;if&nbsp;security_configs.get("task_hijacking"):
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;print(f"⚠️ &nbsp;{Colors.YELLOW}[中危] 发现 Activity 组合缺陷可能导致 StrandHogg 任务劫持: {security_configs['task_hijacking']}{Colors.RESET}")
&nbsp; &nbsp;&nbsp;if&nbsp;not any(security_configs.values()):
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;print(f"✅ {Colors.GREEN}全局安全配置未见明显异常。{Colors.RESET}")

&nbsp; &nbsp;&nbsp;print(f"\n{Colors.BOLD}[+] 2. Activity 配置错误 (越权访问 / 页面绕过){Colors.RESET}")
&nbsp; &nbsp;&nbsp;print("-"&nbsp;* 69)
&nbsp; &nbsp;&nbsp;for&nbsp;act&nbsp;in&nbsp;explicit:
&nbsp; &nbsp; &nbsp; &nbsp; perm_str = f"(受 {act['permission']} 保护)"if&nbsp;act['permission']&nbsp;else&nbsp;f"{Colors.YELLOW}(无权限保护 🔓){Colors.RESET}"
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;print(f"📄 Activity: {act['name']} {perm_str}")
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;print(f"💻 测试命令: {Colors.CYAN}dz> run app.activity.start --component {package_name} {act['name']}{Colors.RESET}\n")

&nbsp; &nbsp;&nbsp;print(f"\n{Colors.BOLD}[+] 3. DeepLink 与 WebView (任意 URL 跳转 / XSS / RCE){Colors.RESET}")
&nbsp; &nbsp;&nbsp;print("-"&nbsp;* 69)
&nbsp; &nbsp;&nbsp;for&nbsp;item&nbsp;in&nbsp;implicit:
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;print(f"🔗 分发组件: {item['name']}")
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;for&nbsp;link&nbsp;in&nbsp;item['links']:
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; scheme = link['scheme']
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; host = link['host']&nbsp;if&nbsp;link['host']&nbsp;else""
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; path = link['path']&nbsp;if&nbsp;link['path']&nbsp;else""
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;path and not path.startswith('/'): path =&nbsp;'/'&nbsp;+ path

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; uri = f"{scheme}://{host}{path}?url=http://hacker.com"
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;print(f"💻 测试命令: {Colors.CYAN}dz> run app.activity.start --action android.intent.action.VIEW --data-uri \"{uri}\"{Colors.RESET}")
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;print("")

&nbsp; &nbsp;&nbsp;print(f"\n{Colors.BOLD}[+] 4. Service/Receiver 暴露 (拒绝服务 DoS / 非法越权){Colors.RESET}")
&nbsp; &nbsp;&nbsp;print("-"&nbsp;* 69)
&nbsp; &nbsp;&nbsp;for&nbsp;comp&nbsp;in&nbsp;dos_targets:
&nbsp; &nbsp; &nbsp; &nbsp; perm_str = f"权限保护: {comp['permission']}"if&nbsp;comp['permission']&nbsp;else&nbsp;f"{Colors.YELLOW}无 🔓{Colors.RESET}"
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;print(f"⚙️ &nbsp;{comp['type'].upper()}: {comp['name']} ({perm_str})")
&nbsp; &nbsp; &nbsp; &nbsp; cmd_type =&nbsp;"app.service.start"if&nbsp;comp['type'] ==&nbsp;"service"else"app.broadcast.send"

&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;print(f"💻 基础触发: {Colors.CYAN}dz> run {cmd_type} --component {package_name} {comp['name']}{Colors.RESET}")
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;print(f"💣 {Colors.MAGENTA}DoS Fuzz: dz> run {cmd_type} --component {package_name} {comp['name']} --extra string testFuzz null{Colors.RESET}")

&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;comp['action']:
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;print(f"💻 隐式触发: {Colors.CYAN}dz> run {cmd_type} --action {comp['action']}{Colors.RESET}")
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;print("")

&nbsp; &nbsp;&nbsp;print(f"\n{Colors.BOLD}[+] 5. Content Provider 暴露 (SQL注入 / 目录遍历){Colors.RESET}")
&nbsp; &nbsp;&nbsp;print("-"&nbsp;* 69)
&nbsp; &nbsp;&nbsp;if&nbsp;not provider_targets:
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;print("未发现高危暴露的 Content Provider。")
&nbsp; &nbsp;&nbsp;for&nbsp;prov&nbsp;in&nbsp;provider_targets:
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;print(f"🗄️ &nbsp;Provider: {prov['name']}")
&nbsp; &nbsp; &nbsp; &nbsp; risk_tags = []
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;prov['is_exported']: risk_tags.append(f"{Colors.RED}Exported 🔓{Colors.RESET}")
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;prov['has_grant']: risk_tags.append(f"{Colors.YELLOW}GrantUriPermission(提权) ⚠️{Colors.RESET}")
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;print(f"📌 Authority: {prov['authority']} | 风险: {' + '.join(risk_tags)}")

&nbsp; &nbsp; &nbsp; &nbsp; auth = prov['authority']
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;print(f"💻 列出 URI : {Colors.CYAN}dz> run scanner.provider.finduris -a {package_name}{Colors.RESET}")
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;prov['has_grant']:
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;print(f"💻 物理遍历 : {Colors.RED}dz> run app.provider.read content://{auth}/../../../../../../../../etc/hosts{Colors.RESET}")
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;print(f"💻 扫描遍历 : {Colors.CYAN}dz> run scanner.provider.traversal -a {package_name}{Colors.RESET}")
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;print(f"💻 扫描注入 : {Colors.CYAN}dz> run scanner.provider.injection -a {package_name}{Colors.RESET}\n")

&nbsp; &nbsp;&nbsp;print(f"{Colors.GREEN}=====================================================================")
&nbsp; &nbsp;&nbsp;print(f"[i] 已智能过滤 {len(main_acts)} 个 MAIN 启动页组件。Enjoy Hack!")
&nbsp; &nbsp;&nbsp;print(f"====================================================================={Colors.RESET}")

if&nbsp;__name__ ==&nbsp;"__main__":
&nbsp; &nbsp; print_banner()

&nbsp; &nbsp;&nbsp;# 引入命令行参数解析
&nbsp; &nbsp; parser = argparse.ArgumentParser(description="Android 自动化渗透测试指令锻造炉")
&nbsp; &nbsp; parser.add_argument("-f",&nbsp;"--file",&nbsp;help="指定 AndroidManifest.xml 文件的路径", default="AndroidManifest.xml")
&nbsp; &nbsp; args = parser.parse_args()

&nbsp; &nbsp; pkg, exp, imp, mains, dos, provs, sec_configs = parse_android_manifest(args.file)

&nbsp; &nbsp;&nbsp;if&nbsp;pkg is None:
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;print(f"{Colors.RED}[!] {exp}{Colors.RESET}")
&nbsp; &nbsp; &nbsp; &nbsp; sys.exit(1)
&nbsp; &nbsp;&nbsp;else:
&nbsp; &nbsp; &nbsp; &nbsp; print_results(pkg, exp, imp, mains, dos, provs, sec_configs)

工具获取

https://github.com/hsggg/DrozerForge/tree/main

文章来源:夜组安全

黑白之道发布、转载的文章中所涉及的技术、思路和工具仅供以安全为目的的学习交流使用,任何人不得将其用于非法用途及盈利等目的,否则后果自行承担!

如侵权请私聊我们删文

END


免责声明:

本文所载程序、技术方法仅面向合法合规的安全研究与教学场景,旨在提升网络安全防护能力,具有明确的技术研究属性。

任何单位或个人未经授权,将本文内容用于攻击、破坏等非法用途的,由此引发的全部法律责任、民事赔偿及连带责任,均由行为人独立承担,本站不承担任何连带责任。

本站内容均为技术交流与知识分享目的发布,若存在版权侵权或其他异议,请通过邮件联系处理,具体联系方式可点击页面上方的联系我

本文转载自:黑白之道 《Android 自动化渗透测试指令生成,可解析 AndroidManifest文件并生成 Drozer 测试指令》

网络安全文章

文章总结: 本文介绍CyberStrikeAI这一AI原生安全测试平台,支持自然语言指令全自动完成渗透测试。该平台集成100余款安全工具,内置多种预设角色与专业
评论:0   参与:  0