dexsect 4.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dexsect/__init__.py +4 -0
- dexsect/__main__.py +5 -0
- dexsect/catalog/EXTRACTION_CATALOG.json +4057 -0
- dexsect/catalog/__init__.py +0 -0
- dexsect/cli.py +1272 -0
- dexsect/core/__init__.py +0 -0
- dexsect/core/config.py +177 -0
- dexsect/core/context.py +181 -0
- dexsect/core/i18n.py +40 -0
- dexsect/core/pipeline.py +153 -0
- dexsect/core/platform_utils.py +164 -0
- dexsect/core/runner.py +124 -0
- dexsect/core/theme.py +64 -0
- dexsect/core/ui.py +405 -0
- dexsect/core/utils.py +150 -0
- dexsect/inspectors/__init__.py +0 -0
- dexsect/inspectors/assets_db_inspector.py +235 -0
- dexsect/inspectors/base.py +46 -0
- dexsect/inspectors/bundle_inspector.py +55 -0
- dexsect/inspectors/code_inspector.py +341 -0
- dexsect/inspectors/custom_rules_inspector.py +178 -0
- dexsect/inspectors/dex_inspector.py +144 -0
- dexsect/inspectors/manifest_inspector.py +503 -0
- dexsect/inspectors/native_fw_inspector.py +167 -0
- dexsect/inspectors/resources_inspector.py +195 -0
- dexsect/inspectors/scanner_inspector.py +153 -0
- dexsect/inspectors/signing_inspector.py +423 -0
- dexsect/inspectors/text_scanner.py +336 -0
- dexsect/locales/__init__.py +0 -0
- dexsect/locales/ar.json +130 -0
- dexsect/locales/de.json +51 -0
- dexsect/locales/en.json +110 -0
- dexsect/locales/es.json +51 -0
- dexsect/locales/fr.json +51 -0
- dexsect/locales/ja.json +51 -0
- dexsect/locales/pt.json +51 -0
- dexsect/locales/ru.json +51 -0
- dexsect/locales/tr.json +51 -0
- dexsect/locales/zh.json +51 -0
- dexsect/parsers/__init__.py +0 -0
- dexsect/parsers/axml.py +264 -0
- dexsect/parsers/bundle.py +214 -0
- dexsect/parsers/elf.py +396 -0
- dexsect/phases/__init__.py +0 -0
- dexsect/phases/base.py +102 -0
- dexsect/phases/decode.py +507 -0
- dexsect/phases/decompile.py +408 -0
- dexsect/phases/fingerprint.py +341 -0
- dexsect/phases/frameworks.py +377 -0
- dexsect/phases/mapper.py +41 -0
- dexsect/phases/native.py +188 -0
- dexsect/plugins/__init__.py +0 -0
- dexsect/plugins/base.py +20 -0
- dexsect/plugins/diff.py +162 -0
- dexsect/plugins/inspect.py +172 -0
- dexsect/plugins/report.py +80 -0
- dexsect/plugins/trace.py +141 -0
- dexsect/reporting/__init__.py +0 -0
- dexsect/reporting/analysis_report.py +1190 -0
- dexsect/reporting/diff_report.py +144 -0
- dexsect/reporting/sarif_report.py +109 -0
- dexsect/reporting/unpack_map.py +149 -0
- dexsect/rules/__init__.py +0 -0
- dexsect/rules/anti_analysis.json +45 -0
- dexsect/rules/crypto_audit.json +41 -0
- dexsect/rules/secrets_extended.json +46 -0
- dexsect/storage/__init__.py +0 -0
- dexsect/storage/findings_db.py +460 -0
- dexsect-4.1.0.dist-info/METADATA +532 -0
- dexsect-4.1.0.dist-info/RECORD +74 -0
- dexsect-4.1.0.dist-info/WHEEL +5 -0
- dexsect-4.1.0.dist-info/entry_points.txt +2 -0
- dexsect-4.1.0.dist-info/licenses/LICENSE +21 -0
- dexsect-4.1.0.dist-info/top_level.txt +1 -0
dexsect/locales/es.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lang": "es",
|
|
3
|
+
"dir": "ltr",
|
|
4
|
+
"name": "Español",
|
|
5
|
+
"ui": {
|
|
6
|
+
"report_title": "Informe de Análisis Estático DexSect",
|
|
7
|
+
"subtitle_target": "Objetivo",
|
|
8
|
+
"subtitle_profile": "Perfil",
|
|
9
|
+
"subtitle_generated": "Generado",
|
|
10
|
+
"btn_export_json": "Exportar JSON",
|
|
11
|
+
"btn_theme": "Tema",
|
|
12
|
+
"btn_copy": "Copiar",
|
|
13
|
+
"btn_copied": "¡Copiado!",
|
|
14
|
+
"btn_load_more": "Mostrar más",
|
|
15
|
+
"search_placeholder": "Buscar valor, ID, clase o ruta de archivo...",
|
|
16
|
+
"all_units": "Todas las unidades",
|
|
17
|
+
"all_layers": "Todas las capas",
|
|
18
|
+
"show_limit": "Mostrar",
|
|
19
|
+
"showing_note": "Mostrando {shown} de {filtered} filas en \"{section}\" (Datos completos en 10_Analysis/findings.db)",
|
|
20
|
+
"capped_note": "Sección limitada a {cap} filas para fluidez; consulta los datos completos vía CLI.",
|
|
21
|
+
"empty_rows": "No hay resultados para los filtros actuales.",
|
|
22
|
+
"col_id": "ID Catálogo",
|
|
23
|
+
"col_unit": "Unidad",
|
|
24
|
+
"col_layer": "Capa",
|
|
25
|
+
"col_title": "Elemento",
|
|
26
|
+
"col_value": "Valor Extraído",
|
|
27
|
+
"col_source": "Origen / Línea"
|
|
28
|
+
},
|
|
29
|
+
"kpis": {
|
|
30
|
+
"total_findings": "Hallazgos Totales",
|
|
31
|
+
"units": "Unidades APK",
|
|
32
|
+
"domains": "Dominios",
|
|
33
|
+
"catalog_ids": "IDs Catálogo",
|
|
34
|
+
"permissions": "Permisos",
|
|
35
|
+
"components": "Componentes",
|
|
36
|
+
"network": "Red y URLs",
|
|
37
|
+
"security": "Indicadores Seguridad"
|
|
38
|
+
},
|
|
39
|
+
"sections": {
|
|
40
|
+
"executive": "Resumen Ejecutivo",
|
|
41
|
+
"overview": "Resumen e Identidad",
|
|
42
|
+
"permissions": "Permisos",
|
|
43
|
+
"components": "Componentes Android",
|
|
44
|
+
"intents": "Intents y Deep Links",
|
|
45
|
+
"network": "Red, URLs y Config",
|
|
46
|
+
"code": "Código y Recuperación",
|
|
47
|
+
"security": "Indicadores de Seguridad",
|
|
48
|
+
"native_fw": "Nativo y Frameworks",
|
|
49
|
+
"assets_db": "Assets y Bases de Datos"
|
|
50
|
+
}
|
|
51
|
+
}
|
dexsect/locales/fr.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lang": "fr",
|
|
3
|
+
"dir": "ltr",
|
|
4
|
+
"name": "Français",
|
|
5
|
+
"ui": {
|
|
6
|
+
"report_title": "Rapport d'Analyse Statique DexSect",
|
|
7
|
+
"subtitle_target": "Cible",
|
|
8
|
+
"subtitle_profile": "Profil",
|
|
9
|
+
"subtitle_generated": "Généré",
|
|
10
|
+
"btn_export_json": "Exporter JSON",
|
|
11
|
+
"btn_theme": "Thème",
|
|
12
|
+
"btn_copy": "Copier",
|
|
13
|
+
"btn_copied": "Copié !",
|
|
14
|
+
"btn_load_more": "Afficher plus",
|
|
15
|
+
"search_placeholder": "Rechercher valeur, ID, classe ou chemin...",
|
|
16
|
+
"all_units": "Toutes les unités",
|
|
17
|
+
"all_layers": "Toutes les couches",
|
|
18
|
+
"show_limit": "Afficher",
|
|
19
|
+
"showing_note": "Affichage de {shown} sur {filtered} lignes dans \"{section}\" (Données complètes dans 10_Analysis/findings.db)",
|
|
20
|
+
"capped_note": "Section limitée à {cap} lignes pour la performance ; interrogez tout via CLI.",
|
|
21
|
+
"empty_rows": "Aucun résultat pour les filtres actuels.",
|
|
22
|
+
"col_id": "ID Catalogue",
|
|
23
|
+
"col_unit": "Unité",
|
|
24
|
+
"col_layer": "Couche",
|
|
25
|
+
"col_title": "Élément",
|
|
26
|
+
"col_value": "Valeur Extraite",
|
|
27
|
+
"col_source": "Source / Ligne"
|
|
28
|
+
},
|
|
29
|
+
"kpis": {
|
|
30
|
+
"total_findings": "Total Résultats",
|
|
31
|
+
"units": "Unités APK",
|
|
32
|
+
"domains": "Domaines",
|
|
33
|
+
"catalog_ids": "IDs Catalogue",
|
|
34
|
+
"permissions": "Permissions",
|
|
35
|
+
"components": "Composants",
|
|
36
|
+
"network": "Réseau & URLs",
|
|
37
|
+
"security": "Indicateurs Sécurité"
|
|
38
|
+
},
|
|
39
|
+
"sections": {
|
|
40
|
+
"executive": "Résumé Exécutif",
|
|
41
|
+
"overview": "Aperçu & Identité",
|
|
42
|
+
"permissions": "Permissions",
|
|
43
|
+
"components": "Composants Android",
|
|
44
|
+
"intents": "Intents & Deep Links",
|
|
45
|
+
"network": "Réseau, URLs & Config",
|
|
46
|
+
"code": "Code & Récupération",
|
|
47
|
+
"security": "Indicateurs de Sécurité",
|
|
48
|
+
"native_fw": "Natif & Frameworks",
|
|
49
|
+
"assets_db": "Assets & Bases de Données"
|
|
50
|
+
}
|
|
51
|
+
}
|
dexsect/locales/ja.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lang": "ja",
|
|
3
|
+
"dir": "ltr",
|
|
4
|
+
"name": "日本語",
|
|
5
|
+
"ui": {
|
|
6
|
+
"report_title": "DexSect 静的解析レポート",
|
|
7
|
+
"subtitle_target": "対象",
|
|
8
|
+
"subtitle_profile": "プロファイル",
|
|
9
|
+
"subtitle_generated": "生成日時",
|
|
10
|
+
"btn_export_json": "JSON エクスポート",
|
|
11
|
+
"btn_theme": "テーマ切替",
|
|
12
|
+
"btn_copy": "コピー",
|
|
13
|
+
"btn_copied": "コピー完了!",
|
|
14
|
+
"btn_load_more": "さらに表示",
|
|
15
|
+
"search_placeholder": "値、カタログID、クラス名、ファイルパスで検索...",
|
|
16
|
+
"all_units": "すべてのユニット",
|
|
17
|
+
"all_layers": "すべてのレイヤー",
|
|
18
|
+
"show_limit": "表示数",
|
|
19
|
+
"showing_note": "\"{section}\" 内の {shown} / {filtered} 件を表示中(全データは 10_Analysis/findings.db に保存)",
|
|
20
|
+
"capped_note": "ブラウザ負荷軽減のため {cap} 件までに制限されています。全件は CLI から取得できます。",
|
|
21
|
+
"empty_rows": "現在のフィルター条件に一致する結果はありません。",
|
|
22
|
+
"col_id": "カタログ ID",
|
|
23
|
+
"col_unit": "ユニット",
|
|
24
|
+
"col_layer": "レイヤー",
|
|
25
|
+
"col_title": "項目",
|
|
26
|
+
"col_value": "抽出値",
|
|
27
|
+
"col_source": "ソース / 行"
|
|
28
|
+
},
|
|
29
|
+
"kpis": {
|
|
30
|
+
"total_findings": "総検出数",
|
|
31
|
+
"units": "APK ユニット",
|
|
32
|
+
"domains": "検出ドメイン",
|
|
33
|
+
"catalog_ids": "カタログ ID",
|
|
34
|
+
"permissions": "権限",
|
|
35
|
+
"components": "コンポーネント",
|
|
36
|
+
"network": "ネットワーク / URL",
|
|
37
|
+
"security": "セキュリティ指標"
|
|
38
|
+
},
|
|
39
|
+
"sections": {
|
|
40
|
+
"executive": "エグゼクティブサマリー",
|
|
41
|
+
"overview": "概要と基本情報",
|
|
42
|
+
"permissions": "権限",
|
|
43
|
+
"components": "Android コンポーネント",
|
|
44
|
+
"intents": "Intent / ディープリンク",
|
|
45
|
+
"network": "ネットワーク・URL・設定",
|
|
46
|
+
"code": "コードと復元状況",
|
|
47
|
+
"security": "セキュリティ指標",
|
|
48
|
+
"native_fw": "ネイティブ / フレームワーク",
|
|
49
|
+
"assets_db": "アセット / データベース"
|
|
50
|
+
}
|
|
51
|
+
}
|
dexsect/locales/pt.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lang": "pt",
|
|
3
|
+
"dir": "ltr",
|
|
4
|
+
"name": "Português",
|
|
5
|
+
"ui": {
|
|
6
|
+
"report_title": "Relatório de Análise Estática DexSect",
|
|
7
|
+
"subtitle_target": "Alvo",
|
|
8
|
+
"subtitle_profile": "Perfil",
|
|
9
|
+
"subtitle_generated": "Gerado em",
|
|
10
|
+
"btn_export_json": "Exportar JSON",
|
|
11
|
+
"btn_theme": "Tema",
|
|
12
|
+
"btn_copy": "Copiar",
|
|
13
|
+
"btn_copied": "Copiado!",
|
|
14
|
+
"btn_load_more": "Mostrar mais",
|
|
15
|
+
"search_placeholder": "Pesquisar valor, ID, classe ou caminho...",
|
|
16
|
+
"all_units": "Todas Unidades",
|
|
17
|
+
"all_layers": "Todas Camadas",
|
|
18
|
+
"show_limit": "Mostrar",
|
|
19
|
+
"showing_note": "Exibindo {shown} de {filtered} linhas em \"{section}\" (Dados completos em 10_Analysis/findings.db)",
|
|
20
|
+
"capped_note": "Seção limitada a {cap} linhas para desempenho; consulte tudo via CLI.",
|
|
21
|
+
"empty_rows": "Nenhum resultado encontrado para os filtros atuais.",
|
|
22
|
+
"col_id": "ID Catálogo",
|
|
23
|
+
"col_unit": "Unidade",
|
|
24
|
+
"col_layer": "Camada",
|
|
25
|
+
"col_title": "Item",
|
|
26
|
+
"col_value": "Valor Extraído",
|
|
27
|
+
"col_source": "Origem / Linha"
|
|
28
|
+
},
|
|
29
|
+
"kpis": {
|
|
30
|
+
"total_findings": "Total Achados",
|
|
31
|
+
"units": "Unidades APK",
|
|
32
|
+
"domains": "Domínios",
|
|
33
|
+
"catalog_ids": "IDs Catálogo",
|
|
34
|
+
"permissions": "Permissões",
|
|
35
|
+
"components": "Componentes",
|
|
36
|
+
"network": "Rede e URLs",
|
|
37
|
+
"security": "Segurança"
|
|
38
|
+
},
|
|
39
|
+
"sections": {
|
|
40
|
+
"executive": "Resumo Executivo",
|
|
41
|
+
"overview": "Visão Geral e Identidade",
|
|
42
|
+
"permissions": "Permissões",
|
|
43
|
+
"components": "Componentes Android",
|
|
44
|
+
"intents": "Intents e Deep Links",
|
|
45
|
+
"network": "Rede, URLs e Config",
|
|
46
|
+
"code": "Código e Recuperação",
|
|
47
|
+
"security": "Indicadores de Segurança",
|
|
48
|
+
"native_fw": "Nativo e Frameworks",
|
|
49
|
+
"assets_db": "Assets e Bancos de Dados"
|
|
50
|
+
}
|
|
51
|
+
}
|
dexsect/locales/ru.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lang": "ru",
|
|
3
|
+
"dir": "ltr",
|
|
4
|
+
"name": "Русский",
|
|
5
|
+
"ui": {
|
|
6
|
+
"report_title": "Отчет статического анализа DexSect",
|
|
7
|
+
"subtitle_target": "Цель",
|
|
8
|
+
"subtitle_profile": "Профиль",
|
|
9
|
+
"subtitle_generated": "Создан",
|
|
10
|
+
"btn_export_json": "Экспорт JSON",
|
|
11
|
+
"btn_theme": "Тема",
|
|
12
|
+
"btn_copy": "Копировать",
|
|
13
|
+
"btn_copied": "Скопировано!",
|
|
14
|
+
"btn_load_more": "Показать ещё",
|
|
15
|
+
"search_placeholder": "Поиск по значению, ID, классу или пути...",
|
|
16
|
+
"all_units": "Все модули",
|
|
17
|
+
"all_layers": "Все слои",
|
|
18
|
+
"show_limit": "Показать",
|
|
19
|
+
"showing_note": "Показано {shown} из {filtered} строк в \"{section}\" (Полная база: 10_Analysis/findings.db)",
|
|
20
|
+
"capped_note": "Ограничено {cap} строками для скорости браузера; полная выгрузка через CLI.",
|
|
21
|
+
"empty_rows": "Нет совпадений по текущим фильтрам.",
|
|
22
|
+
"col_id": "ID Каталога",
|
|
23
|
+
"col_unit": "Модуль",
|
|
24
|
+
"col_layer": "Слой",
|
|
25
|
+
"col_title": "Элемент",
|
|
26
|
+
"col_value": "Значение",
|
|
27
|
+
"col_source": "Источник / Строка"
|
|
28
|
+
},
|
|
29
|
+
"kpis": {
|
|
30
|
+
"total_findings": "Всего находок",
|
|
31
|
+
"units": "APK модули",
|
|
32
|
+
"domains": "Категории",
|
|
33
|
+
"catalog_ids": "ID каталога",
|
|
34
|
+
"permissions": "Разрешения",
|
|
35
|
+
"components": "Компоненты",
|
|
36
|
+
"network": "Сеть и URL",
|
|
37
|
+
"security": "Безопасность"
|
|
38
|
+
},
|
|
39
|
+
"sections": {
|
|
40
|
+
"executive": "Сводка анализа",
|
|
41
|
+
"overview": "Обзор и метаданные",
|
|
42
|
+
"permissions": "Разрешения",
|
|
43
|
+
"components": "Компоненты Android",
|
|
44
|
+
"intents": "Intents и Deep Links",
|
|
45
|
+
"network": "Сеть, URL и конфиги",
|
|
46
|
+
"code": "Код и покрытие",
|
|
47
|
+
"security": "Индикаторы безопасности",
|
|
48
|
+
"native_fw": "Native и фреймворки",
|
|
49
|
+
"assets_db": "Ресурсы и БД"
|
|
50
|
+
}
|
|
51
|
+
}
|
dexsect/locales/tr.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lang": "tr",
|
|
3
|
+
"dir": "ltr",
|
|
4
|
+
"name": "Türkçe",
|
|
5
|
+
"ui": {
|
|
6
|
+
"report_title": "DexSect Statik Analiz Raporu",
|
|
7
|
+
"subtitle_target": "Hedef",
|
|
8
|
+
"subtitle_profile": "Profil",
|
|
9
|
+
"subtitle_generated": "Oluşturulma",
|
|
10
|
+
"btn_export_json": "JSON Dışa Aktar",
|
|
11
|
+
"btn_theme": "Tema",
|
|
12
|
+
"btn_copy": "Kopyala",
|
|
13
|
+
"btn_copied": "Kopyalandı!",
|
|
14
|
+
"btn_load_more": "Daha Fazla Göster",
|
|
15
|
+
"search_placeholder": "Değer, Katalog ID, sınıf veya dosya yolu ara...",
|
|
16
|
+
"all_units": "Tüm Birimler",
|
|
17
|
+
"all_layers": "Tüm Katmanlar",
|
|
18
|
+
"show_limit": "Göster",
|
|
19
|
+
"showing_note": "\"{section}\" içinde {filtered} sonuçtan {shown} tanesi gösteriliyor (Tüm veri: 10_Analysis/findings.db)",
|
|
20
|
+
"capped_note": "Tarayıcı performansı için {cap} satırla sınırlandı; tam veri için CLI kullanın.",
|
|
21
|
+
"empty_rows": "Mevcut filtrelerle eşleşen bulgu yok.",
|
|
22
|
+
"col_id": "Katalog ID",
|
|
23
|
+
"col_unit": "Birim",
|
|
24
|
+
"col_layer": "Katman",
|
|
25
|
+
"col_title": "Öğe",
|
|
26
|
+
"col_value": "Çıkarılan Değer",
|
|
27
|
+
"col_source": "Kaynak / Satır"
|
|
28
|
+
},
|
|
29
|
+
"kpis": {
|
|
30
|
+
"total_findings": "Toplam Bulgu",
|
|
31
|
+
"units": "APK Birimleri",
|
|
32
|
+
"domains": "Alanlar",
|
|
33
|
+
"catalog_ids": "Katalog ID",
|
|
34
|
+
"permissions": "İzinler",
|
|
35
|
+
"components": "Bileşenler",
|
|
36
|
+
"network": "Ağ ve URL'ler",
|
|
37
|
+
"security": "Güvenlik"
|
|
38
|
+
},
|
|
39
|
+
"sections": {
|
|
40
|
+
"executive": "Yönetici Özeti",
|
|
41
|
+
"overview": "Genel Bakış ve Kimlik",
|
|
42
|
+
"permissions": "İzinler",
|
|
43
|
+
"components": "Android Bileşenleri",
|
|
44
|
+
"intents": "Intent ve Deep Linkler",
|
|
45
|
+
"network": "Ağ, URL ve Yapılandırma",
|
|
46
|
+
"code": "Kod ve Kurtarma",
|
|
47
|
+
"security": "Güvenlik Göstergeleri",
|
|
48
|
+
"native_fw": "Native ve Çatılar",
|
|
49
|
+
"assets_db": "Varlıklar ve Veritabanları"
|
|
50
|
+
}
|
|
51
|
+
}
|
dexsect/locales/zh.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lang": "zh",
|
|
3
|
+
"dir": "ltr",
|
|
4
|
+
"name": "简体中文",
|
|
5
|
+
"ui": {
|
|
6
|
+
"report_title": "DexSect 静态分析报告",
|
|
7
|
+
"subtitle_target": "目标",
|
|
8
|
+
"subtitle_profile": "分析模式",
|
|
9
|
+
"subtitle_generated": "生成时间",
|
|
10
|
+
"btn_export_json": "导出 JSON",
|
|
11
|
+
"btn_theme": "切换主题",
|
|
12
|
+
"btn_copy": "复制",
|
|
13
|
+
"btn_copied": "已复制!",
|
|
14
|
+
"btn_load_more": "显示更多",
|
|
15
|
+
"search_placeholder": "搜索值、目录 ID、类名或文件路径...",
|
|
16
|
+
"all_units": "全部模块",
|
|
17
|
+
"all_layers": "全部层级",
|
|
18
|
+
"show_limit": "显示",
|
|
19
|
+
"showing_note": "正在显示 \"{section}\" 中的 {shown} / {filtered} 条结果(完整数据保存在 10_Analysis/findings.db)",
|
|
20
|
+
"capped_note": "为保证浏览器流畅,此部分限制显示 {cap} 条;请使用 CLI 查询完整数据。",
|
|
21
|
+
"empty_rows": "当前筛选条件下无匹配结果。",
|
|
22
|
+
"col_id": "目录 ID",
|
|
23
|
+
"col_unit": "模块",
|
|
24
|
+
"col_layer": "层级",
|
|
25
|
+
"col_title": "项目",
|
|
26
|
+
"col_value": "提取值",
|
|
27
|
+
"col_source": "来源 / 行号"
|
|
28
|
+
},
|
|
29
|
+
"kpis": {
|
|
30
|
+
"total_findings": "发现总数",
|
|
31
|
+
"units": "APK 模块",
|
|
32
|
+
"domains": "命中领域",
|
|
33
|
+
"catalog_ids": "目录条目",
|
|
34
|
+
"permissions": "权限",
|
|
35
|
+
"components": "组件",
|
|
36
|
+
"network": "网络与 URL",
|
|
37
|
+
"security": "安全指标"
|
|
38
|
+
},
|
|
39
|
+
"sections": {
|
|
40
|
+
"executive": "执行摘要",
|
|
41
|
+
"overview": "概览与身份",
|
|
42
|
+
"permissions": "权限",
|
|
43
|
+
"components": "Android 组件",
|
|
44
|
+
"intents": "Intent 与深层链接",
|
|
45
|
+
"network": "网络、URL 与配置",
|
|
46
|
+
"code": "代码与恢复差异",
|
|
47
|
+
"security": "安全指标",
|
|
48
|
+
"native_fw": "原生库与跨平台框架",
|
|
49
|
+
"assets_db": "资源资产与数据库"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
File without changes
|
dexsect/parsers/axml.py
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import re
|
|
2
|
+
import struct
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Dict, List, Tuple
|
|
5
|
+
from xml.sax.saxutils import escape
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
RES_XML_TYPE = 0x0003
|
|
9
|
+
RES_STRING_POOL_TYPE = 0x0001
|
|
10
|
+
RES_XML_RESOURCE_MAP_TYPE = 0x0180
|
|
11
|
+
RES_XML_START_NAMESPACE_TYPE = 0x0100
|
|
12
|
+
RES_XML_END_NAMESPACE_TYPE = 0x0101
|
|
13
|
+
RES_XML_START_ELEMENT_TYPE = 0x0102
|
|
14
|
+
RES_XML_END_ELEMENT_TYPE = 0x0103
|
|
15
|
+
RES_XML_CDATA_TYPE = 0x0104
|
|
16
|
+
|
|
17
|
+
UTF8_FLAG = 1 << 8
|
|
18
|
+
|
|
19
|
+
# Verified AOSP android.R.attr resource IDs for AAPT2 empty-string attributes
|
|
20
|
+
ANDROID_ATTR_IDS: Dict[int, str] = {
|
|
21
|
+
0x01010000: "theme",
|
|
22
|
+
0x01010001: "label",
|
|
23
|
+
0x01010002: "icon",
|
|
24
|
+
0x01010003: "name",
|
|
25
|
+
0x01010006: "permission",
|
|
26
|
+
0x0101000B: "sharedUserId",
|
|
27
|
+
0x0101000E: "enabled",
|
|
28
|
+
0x0101000F: "debuggable",
|
|
29
|
+
0x01010010: "exported",
|
|
30
|
+
0x01010017: "excludeFromRecents",
|
|
31
|
+
0x01010018: "authorities",
|
|
32
|
+
0x0101001B: "grantUriPermissions",
|
|
33
|
+
0x0101001C: "priority",
|
|
34
|
+
0x0101001D: "launchMode",
|
|
35
|
+
0x0101001E: "screenOrientation",
|
|
36
|
+
0x0101001F: "configChanges",
|
|
37
|
+
0x01010021: "targetPackage",
|
|
38
|
+
0x01010024: "value",
|
|
39
|
+
0x01010025: "resource",
|
|
40
|
+
0x0101020C: "minSdkVersion",
|
|
41
|
+
0x0101021B: "versionCode",
|
|
42
|
+
0x0101021C: "versionName",
|
|
43
|
+
0x0101022B: "windowSoftInputMode",
|
|
44
|
+
0x01010270: "targetSdkVersion",
|
|
45
|
+
0x01010271: "maxSdkVersion",
|
|
46
|
+
0x01010272: "testOnly",
|
|
47
|
+
0x01010280: "allowBackup",
|
|
48
|
+
0x010102D3: "hardwareAccelerated",
|
|
49
|
+
0x010104EC: "usesCleartextTraffic",
|
|
50
|
+
0x0101057A: "appComponentFactory",
|
|
51
|
+
0x01010599: "foregroundServiceType",
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
DIM_UNITS = ("px", "dp", "sp", "pt", "in", "mm")
|
|
55
|
+
FRAC_UNITS = ("%", "%p")
|
|
56
|
+
RADIX_MULTS = (1.0, 1.0 / (1 << 7), 1.0 / (1 << 15), 1.0 / (1 << 23))
|
|
57
|
+
XML_CTRL_RE = re.compile(r"[\x00-\x08\x0b\x0c\x0e-\x1f]")
|
|
58
|
+
XML_NAME_SAFE_RE = re.compile(r"[^a-zA-Z0-9_.:-]")
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def is_binary_axml(data: bytes) -> bool:
|
|
62
|
+
return len(data) >= 8 and struct.unpack_from("<H", data, 0)[0] == RES_XML_TYPE
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def _clean_xml_text(txt: str) -> str:
|
|
66
|
+
return XML_CTRL_RE.sub("", txt)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def _clean_xml_name(name: str, fallback: str) -> str:
|
|
70
|
+
cleaned = XML_NAME_SAFE_RE.sub("_", name).strip()
|
|
71
|
+
if not cleaned or cleaned[0].isdigit() or cleaned[0] in (".", "-"):
|
|
72
|
+
return fallback
|
|
73
|
+
return cleaned
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def _read_len8(buf: bytes, off: int) -> Tuple[int, int]:
|
|
77
|
+
val = buf[off]
|
|
78
|
+
if val & 0x80:
|
|
79
|
+
return ((val & 0x7F) << 8) | buf[off + 1], off + 2
|
|
80
|
+
return val, off + 1
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def _read_len16(buf: bytes, off: int) -> Tuple[int, int]:
|
|
84
|
+
val = struct.unpack_from("<H", buf, off)[0]
|
|
85
|
+
if val & 0x8000:
|
|
86
|
+
hi = val & 0x7FFF
|
|
87
|
+
lo = struct.unpack_from("<H", buf, off + 2)[0]
|
|
88
|
+
return (hi << 16) | lo, off + 4
|
|
89
|
+
return val, off + 2
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def _parse_string_pool(data: bytes, chunk_off: int) -> List[str]:
|
|
93
|
+
_ctype, _hsize, _csize = struct.unpack_from("<HHI", data, chunk_off)
|
|
94
|
+
str_count, _sty_count, flags, strings_start, _styles_start = struct.unpack_from("<IIIII", data, chunk_off + 8)
|
|
95
|
+
is_utf8 = bool(flags & UTF8_FLAG)
|
|
96
|
+
offsets_base = chunk_off + 28
|
|
97
|
+
pool_base = chunk_off + strings_start
|
|
98
|
+
|
|
99
|
+
strings: List[str] = []
|
|
100
|
+
for i in range(str_count):
|
|
101
|
+
if offsets_base + i * 4 + 4 > len(data):
|
|
102
|
+
break
|
|
103
|
+
rel = struct.unpack_from("<I", data, offsets_base + i * 4)[0]
|
|
104
|
+
pos = pool_base + rel
|
|
105
|
+
try:
|
|
106
|
+
if is_utf8:
|
|
107
|
+
_, pos = _read_len8(data, pos)
|
|
108
|
+
byte_len, pos = _read_len8(data, pos)
|
|
109
|
+
strings.append(data[pos : pos + byte_len].decode("utf-8", errors="replace"))
|
|
110
|
+
else:
|
|
111
|
+
char_len, pos = _read_len16(data, pos)
|
|
112
|
+
strings.append(data[pos : pos + char_len * 2].decode("utf-16-le", errors="replace"))
|
|
113
|
+
except Exception:
|
|
114
|
+
strings.append("")
|
|
115
|
+
return strings
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def _decode_complex(raw_data: int, is_fraction: bool) -> str:
|
|
119
|
+
signed = struct.unpack("<i", struct.pack("<I", raw_data))[0]
|
|
120
|
+
mantissa = signed >> 8
|
|
121
|
+
radix = (raw_data >> 4) & 0x3
|
|
122
|
+
val = mantissa * RADIX_MULTS[radix]
|
|
123
|
+
if is_fraction:
|
|
124
|
+
val *= 100.0
|
|
125
|
+
unit = FRAC_UNITS[raw_data & 0xF] if (raw_data & 0xF) < len(FRAC_UNITS) else "%"
|
|
126
|
+
else:
|
|
127
|
+
unit = DIM_UNITS[raw_data & 0xF] if (raw_data & 0xF) < len(DIM_UNITS) else "px"
|
|
128
|
+
return f"{val:g}{unit}"
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def _format_attr_value(val_type: int, raw_data: int, raw_str_idx: int, strings: List[str]) -> str:
|
|
132
|
+
if 0 <= raw_str_idx < len(strings):
|
|
133
|
+
return _clean_xml_text(strings[raw_str_idx])
|
|
134
|
+
if val_type == 0x03:
|
|
135
|
+
return _clean_xml_text(strings[raw_data]) if 0 <= raw_data < len(strings) else ""
|
|
136
|
+
if val_type == 0x01:
|
|
137
|
+
return f"@0x{raw_data:08x}"
|
|
138
|
+
if val_type == 0x02:
|
|
139
|
+
return f"?0x{raw_data:08x}"
|
|
140
|
+
if val_type == 0x04:
|
|
141
|
+
return f"{struct.unpack('<f', struct.pack('<I', raw_data))[0]:g}"
|
|
142
|
+
if val_type == 0x05:
|
|
143
|
+
return _decode_complex(raw_data, is_fraction=False)
|
|
144
|
+
if val_type == 0x06:
|
|
145
|
+
return _decode_complex(raw_data, is_fraction=True)
|
|
146
|
+
if val_type == 0x10:
|
|
147
|
+
return str(struct.unpack("<i", struct.pack("<I", raw_data))[0])
|
|
148
|
+
if val_type == 0x11:
|
|
149
|
+
return f"0x{raw_data:x}"
|
|
150
|
+
if val_type == 0x12:
|
|
151
|
+
return "true" if raw_data != 0 else "false"
|
|
152
|
+
if 0x1C <= val_type <= 0x1F:
|
|
153
|
+
return f"#{raw_data:08x}"
|
|
154
|
+
return f"0x{raw_data:x}"
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def decode_axml_bytes(data: bytes) -> str:
|
|
158
|
+
stripped = data.lstrip()
|
|
159
|
+
if stripped.startswith(b"<"):
|
|
160
|
+
return _clean_xml_text(data.decode("utf-8", errors="replace"))
|
|
161
|
+
|
|
162
|
+
if not is_binary_axml(data):
|
|
163
|
+
raise ValueError("Input is neither plain XML nor valid Android Binary XML (AXML).")
|
|
164
|
+
|
|
165
|
+
_ctype, hdr_size, total_size = struct.unpack_from("<HHI", data, 0)
|
|
166
|
+
pos = hdr_size
|
|
167
|
+
limit = min(len(data), total_size)
|
|
168
|
+
|
|
169
|
+
strings: List[str] = []
|
|
170
|
+
res_map: List[int] = []
|
|
171
|
+
ns_uri_to_prefix: Dict[str, str] = {}
|
|
172
|
+
pending_ns: List[Tuple[str, str]] = []
|
|
173
|
+
out_lines: List[str] = ['<?xml version="1.0" encoding="utf-8"?>']
|
|
174
|
+
depth = 0
|
|
175
|
+
|
|
176
|
+
def _s(idx: int) -> str:
|
|
177
|
+
return strings[idx] if 0 <= idx < len(strings) else ""
|
|
178
|
+
|
|
179
|
+
def _resolve_attr_name(name_idx: int, ns_idx: int, idx_pos: int) -> str:
|
|
180
|
+
raw_name = _s(name_idx).strip()
|
|
181
|
+
ns_uri = _s(ns_idx)
|
|
182
|
+
pref = ns_uri_to_prefix.get(ns_uri, "")
|
|
183
|
+
if not raw_name and 0 <= name_idx < len(res_map):
|
|
184
|
+
rid = res_map[name_idx]
|
|
185
|
+
raw_name = ANDROID_ATTR_IDS.get(rid, f"attr_0x{rid:08x}")
|
|
186
|
+
if not pref and (rid >> 24) == 0x01:
|
|
187
|
+
pref = "android"
|
|
188
|
+
raw_name = _clean_xml_name(raw_name, f"attr_{idx_pos}")
|
|
189
|
+
return f"{pref}:{raw_name}" if pref else raw_name
|
|
190
|
+
|
|
191
|
+
while pos + 8 <= limit:
|
|
192
|
+
ctype, chdr, csize = struct.unpack_from("<HHI", data, pos)
|
|
193
|
+
if csize < 8 or pos + csize > limit:
|
|
194
|
+
break
|
|
195
|
+
|
|
196
|
+
if ctype == RES_STRING_POOL_TYPE:
|
|
197
|
+
strings = _parse_string_pool(data, pos)
|
|
198
|
+
elif ctype == RES_XML_RESOURCE_MAP_TYPE:
|
|
199
|
+
cnt = (csize - chdr) // 4
|
|
200
|
+
res_map = list(struct.unpack_from(f"<{cnt}I", data, pos + chdr))
|
|
201
|
+
elif ctype == RES_XML_START_NAMESPACE_TYPE:
|
|
202
|
+
pref_idx, uri_idx = struct.unpack_from("<ii", data, pos + 16)
|
|
203
|
+
pref, uri = _s(pref_idx), _s(uri_idx)
|
|
204
|
+
if uri:
|
|
205
|
+
ns_uri_to_prefix[uri] = pref
|
|
206
|
+
pending_ns.append((pref, uri))
|
|
207
|
+
elif ctype == RES_XML_END_NAMESPACE_TYPE:
|
|
208
|
+
pass
|
|
209
|
+
elif ctype == RES_XML_START_ELEMENT_TYPE:
|
|
210
|
+
ns_idx, name_idx, attr_start, attr_size, attr_count, _, _, _ = struct.unpack_from(
|
|
211
|
+
"<iiHHHHHH", data, pos + 16
|
|
212
|
+
)
|
|
213
|
+
tag_name = _clean_xml_name(_s(name_idx), "node")
|
|
214
|
+
ns_uri = _s(ns_idx)
|
|
215
|
+
if ns_uri and ns_uri_to_prefix.get(ns_uri):
|
|
216
|
+
tag_name = f"{ns_uri_to_prefix[ns_uri]}:{tag_name}"
|
|
217
|
+
|
|
218
|
+
attrs: List[str] = []
|
|
219
|
+
seen_attr_names = set()
|
|
220
|
+
for p_pref, p_uri in pending_ns:
|
|
221
|
+
ak = f"xmlns:{p_pref}" if p_pref else "xmlns"
|
|
222
|
+
if ak not in seen_attr_names:
|
|
223
|
+
seen_attr_names.add(ak)
|
|
224
|
+
attrs.append(f'{ak}="{escape(_clean_xml_text(p_uri))}"')
|
|
225
|
+
pending_ns.clear()
|
|
226
|
+
|
|
227
|
+
attr_pos = pos + 16 + attr_start
|
|
228
|
+
step = max(20, attr_size)
|
|
229
|
+
for i in range(attr_count):
|
|
230
|
+
cur = attr_pos + i * step
|
|
231
|
+
if cur + 20 > pos + csize:
|
|
232
|
+
break
|
|
233
|
+
a_ns, a_name, a_raw, _tsize, _res0, a_type, a_data = struct.unpack_from("<iiiHBBI", data, cur)
|
|
234
|
+
aname = _resolve_attr_name(a_name, a_ns, i)
|
|
235
|
+
if aname in seen_attr_names:
|
|
236
|
+
continue
|
|
237
|
+
seen_attr_names.add(aname)
|
|
238
|
+
aval = _format_attr_value(a_type, a_data, a_raw, strings)
|
|
239
|
+
attrs.append(f'{aname}="{escape(aval)}"')
|
|
240
|
+
|
|
241
|
+
indent = " " * depth
|
|
242
|
+
out_lines.append(f"{indent}<{tag_name} {' '.join(attrs)}>" if attrs else f"{indent}<{tag_name}>")
|
|
243
|
+
depth += 1
|
|
244
|
+
elif ctype == RES_XML_END_ELEMENT_TYPE:
|
|
245
|
+
depth = max(0, depth - 1)
|
|
246
|
+
ns_idx, name_idx = struct.unpack_from("<ii", data, pos + 16)
|
|
247
|
+
tag_name = _clean_xml_name(_s(name_idx), "node")
|
|
248
|
+
ns_uri = _s(ns_idx)
|
|
249
|
+
if ns_uri and ns_uri_to_prefix.get(ns_uri):
|
|
250
|
+
tag_name = f"{ns_uri_to_prefix[ns_uri]}:{tag_name}"
|
|
251
|
+
out_lines.append(f"{' ' * depth}</{tag_name}>")
|
|
252
|
+
elif ctype == RES_XML_CDATA_TYPE:
|
|
253
|
+
raw_idx = struct.unpack_from("<i", data, pos + 16)[0]
|
|
254
|
+
txt = _clean_xml_text(_s(raw_idx)).strip()
|
|
255
|
+
if txt:
|
|
256
|
+
out_lines.append(f"{' ' * depth}{escape(txt)}")
|
|
257
|
+
|
|
258
|
+
pos += csize
|
|
259
|
+
|
|
260
|
+
return "\n".join(out_lines) + "\n"
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
def decode_axml_file(path: Path) -> str:
|
|
264
|
+
return decode_axml_bytes(path.read_bytes())
|