# AppSentinel **Repository Path**: wangbing69/AppSentinel ## Basic Information - **Project Name**: AppSentinel - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-09-20 - **Last Updated**: 2026-09-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 🛡️ AppSentinel - Android应用安全漏洞自动检测系统 > 融合DLP(数据防泄漏)、静态分析、动态沙箱、SCA组件分析、统计风险评分的全链路安全检测平台 --- ## 📋 系统架构 ``` ┌──────────────────────────────────────────────────────────┐ │ API Gateway (FastAPI) │ │ http://localhost:8000/docs │ └────────┬──────────┬──────────┬──────────┬────────────────┘ │ │ │ │ ┌────▼───┐ ┌───▼────┐ ┌───▼────┐ ┌───▼────┐ │ Static │ │Dynamic │ │ SCA │ │ DLP │ │Analyzer│ │Sandbox │ │Checker │ │ Engine │ └────┬───┘ └───┬────┘ └───┬────┘ └───┬────┘ │ │ │ │ └──────────┴──────────┴──────────┘ │ ┌─────▼─────┐ │ Stats │ │ Engine │ └─────┬─────┘ │ ┌─────▼─────┐ │ Report │ │ Generator │ └───────────┘ ``` --- ## 🚀 快速开始 ### 环境要求 - Python 3.10+ - Java JRE 11+ (FlowDroid依赖) - Docker & Docker Compose (可选,用于部署) - Android SDK (可选,用于动态分析) ### 1. 安装依赖 ```bash cd AppSentinel pip install -r requirements.txt ``` ### 2. 初始化 ```bash python main.py init ``` ### 3. 启动API服务 ```bash python main.py serve # API文档: http://localhost:8000/docs ``` ### 4. CLI分析APK ```bash # 分析单个APK python main.py analyze /path/to/app.apk # 批量分析 python main.py batch /path/to/apk_dir/ # 测试DLP分类器 python main.py dlp-test "13800138000" ``` ### 5. Docker一键部署 ```bash docker-compose -f docker/docker-compose.yml up -d ``` --- ## 📦 项目结构 ``` AppSentinel/ ├── main.py # 主入口 (CLI + API启动) ├── requirements.txt # Python依赖 │ ├── core/ # 核心模块 │ └── models.py # 数据模型定义 │ ├── config/ # 配置管理 │ └── settings.py # 全局配置 (支持YAML+环境变量) │ ├── dlp_engine/ # DLP数据防泄漏引擎 │ ├── classifier.py # 敏感数据分类器 (正则+AC自动机+校验算法) │ └── grpc_server.py # DLP gRPC/HTTP服务 │ ├── static_analyzer/ # 静态分析模块 │ ├── apk_preprocessor.py # APK预处理/解压 │ ├── manifest_auditor.py # AndroidManifest安全审计 │ └── taint_analyzer.py # 污点分析 (FlowDroid集成) │ ├── dynamic_sandbox/ # 动态分析沙箱 │ └── hook_agent.py # Frida Hook代理 │ ├── sca_checker/ # 软件成分分析 │ └── component_analyzer.py # 第三方库漏洞检测 │ ├── stats_engine/ # 统计评分引擎 │ └── risk_scorer.py # 加权风险评分 + Apriori关联规则 │ ├── report_generator/ # 报告生成 │ └── generator.py # HTML/PDF/SARIF/JSON报告 │ ├── api_gateway/ # API网关 │ └── main.py # FastAPI应用 (RESTful API) │ ├── docker/ # Docker部署 │ ├── Dockerfile │ ├── docker-compose.yml │ └── init-db.sql │ ├── plugins/ # 插件目录 ├── tests/ # 测试 ├── docs/ # 文档 ├── data/ # 数据目录 └── reports/ # 报告输出 ``` --- ## 🔑 核心特性 ### 1. DLP数据防泄漏引擎 - ✅ 身份证号识别(含校验算法GB11643-1999) - ✅ 手机号、邮箱、银行卡号(Luhn算法) - ✅ IMEI/IMSI设备标识检测 - ✅ 密码明文、API密钥检测 - ✅ AC自动机高性能多模式匹配 - ✅ 上下文感知的策略违规判定 ### 2. 静态分析 - ✅ AndroidManifest安全审计(组件导出、权限、调试模式) - ✅ 基于FlowDroid的污点分析 - ✅ DLP增强的Source/Sink标注 - ✅ 已知SDK路径剪枝优化 - ✅ 过度权限检测 ### 3. 动态分析 - ✅ Frida运行时Hook - ✅ 网络层监控(HttpURLConnection, OkHttp, HttpsURLConnection) - ✅ 文件I/O监控(FileOutputStream, SharedPreferences) - ✅ 数据库操作监控(SQLiteDatabase) - ✅ 敏感API调用追踪 ### 4. SCA组件分析 - ✅ Android第三方库已知漏洞数据库 - ✅ OWASP Dependency-Check集成 - ✅ CVE漏洞映射 ### 5. 统计风险评分 - ✅ 加权评分模型:RiskScore = Σ(W_i × X_i) - ✅ CVSS评分 + DLP敏感度 + 路径复杂度 + 组件导出 - ✅ Apriori关联规则挖掘 - ✅ 风险等级:LOW / MEDIUM / HIGH / CRITICAL ### 6. 报告生成 - ✅ HTML报告(可视化面板) - ✅ JSON报告(程序化处理) - ✅ SARIF格式(CI/CD集成) - ✅ PDF报告(WeasyPrint) --- ## 🔧 API接口示例 ### 上传并分析APK ```bash curl -X POST http://localhost:8000/api/v1/analyze/upload \ -F "file=@app.apk" ``` ### 查询任务状态 ```bash curl http://localhost:8000/api/v1/tasks/{task_id}/status ``` ### 下载报告 ```bash curl http://localhost:8000/api/v1/tasks/{task_id}/report?format=html ``` ### DLP分类测试 ```bash curl -X POST "http://localhost:8000/api/v1/dlp/test?text=13800138000" ``` --- ## 🔒 安全与合规 - 🔐 TLS 1.3 加密传输 - 🔐 AES-256 静态数据加密 - 🔐 JWT + MFA 双因素认证 - 🔐 RBAC角色权限控制 - 🔐 WORM防篡改审计日志 - 🔐 敏感数据自动脱敏 - 🔐 30天日志保留策略 --- ## 📊 风险评分说明 | 评分范围 | 风险等级 | 建议操作 | |---------|---------|---------| | 0 - 2.9 | LOW 🟢 | 常规关注 | | 3.0 - 5.9 | MEDIUM 🟡 | 建议修复 | | 6.0 - 8.9 | HIGH 🟠 | 尽快修复 | | 9.0 - 10.0 | CRITICAL 🔴 | 立即修复 | --- ## 🧩 插件开发 ```python # plugins/custom_leak_detector.py def register(plugin_manager): """注册自定义插件""" plugin_manager.register_hook( phase="static_post_taint", callback=my_custom_analyzer, permissions=["read_taint_graph"] ) ``` --- ## ⚠️ 免责声明 AppSentinel **仅限授权安全测试使用**。禁止用于: - 未授权应用的安全检测 - 恶意开发和漏洞利用 - 侵犯用户隐私的行为 --- ## 📄 许可证 本项目基于Apache 2.0协议开源(根据设计文档中引用的第三方库协议)。