anais-apk-forensic 1.0.0

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.
Files changed (104) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +249 -0
  3. package/anais.sh +669 -0
  4. package/analysis_tools/__pycache__/apk_basic_info.cpython-313.pyc +0 -0
  5. package/analysis_tools/__pycache__/apk_basic_info.cpython-314.pyc +0 -0
  6. package/analysis_tools/__pycache__/check_zip_encryption.cpython-313.pyc +0 -0
  7. package/analysis_tools/__pycache__/check_zip_encryption.cpython-314.pyc +0 -0
  8. package/analysis_tools/__pycache__/detect_obfuscation.cpython-313.pyc +0 -0
  9. package/analysis_tools/__pycache__/detect_obfuscation.cpython-314.pyc +0 -0
  10. package/analysis_tools/__pycache__/dex_payload_hunter.cpython-314.pyc +0 -0
  11. package/analysis_tools/__pycache__/entropy_analyzer.cpython-314.pyc +0 -0
  12. package/analysis_tools/__pycache__/error_logger.cpython-313.pyc +0 -0
  13. package/analysis_tools/__pycache__/error_logger.cpython-314.pyc +0 -0
  14. package/analysis_tools/__pycache__/find_encrypted_payload.cpython-314.pyc +0 -0
  15. package/analysis_tools/__pycache__/fix_apk_headers.cpython-313.pyc +0 -0
  16. package/analysis_tools/__pycache__/fix_apk_headers.cpython-314.pyc +0 -0
  17. package/analysis_tools/__pycache__/manifest_analyzer.cpython-313.pyc +0 -0
  18. package/analysis_tools/__pycache__/manifest_analyzer.cpython-314.pyc +0 -0
  19. package/analysis_tools/__pycache__/network_analyzer.cpython-313.pyc +0 -0
  20. package/analysis_tools/__pycache__/network_analyzer.cpython-314.pyc +0 -0
  21. package/analysis_tools/__pycache__/report_generator.cpython-313.pyc +0 -0
  22. package/analysis_tools/__pycache__/report_generator.cpython-314.pyc +0 -0
  23. package/analysis_tools/__pycache__/report_generator_modular.cpython-314.pyc +0 -0
  24. package/analysis_tools/__pycache__/sast_scanner.cpython-313.pyc +0 -0
  25. package/analysis_tools/__pycache__/sast_scanner.cpython-314.pyc +0 -0
  26. package/analysis_tools/__pycache__/so_string_analyzer.cpython-314.pyc +0 -0
  27. package/analysis_tools/__pycache__/yara_enhanced_analyzer.cpython-314.pyc +0 -0
  28. package/analysis_tools/__pycache__/yara_results_processor.cpython-314.pyc +0 -0
  29. package/analysis_tools/apk_basic_info.py +85 -0
  30. package/analysis_tools/check_zip_encryption.py +142 -0
  31. package/analysis_tools/detect_obfuscation.py +650 -0
  32. package/analysis_tools/dex_payload_hunter.py +734 -0
  33. package/analysis_tools/entropy_analyzer.py +335 -0
  34. package/analysis_tools/error_logger.py +75 -0
  35. package/analysis_tools/find_encrypted_payload.py +485 -0
  36. package/analysis_tools/fix_apk_headers.py +154 -0
  37. package/analysis_tools/manifest_analyzer.py +214 -0
  38. package/analysis_tools/network_analyzer.py +287 -0
  39. package/analysis_tools/report_generator.py +506 -0
  40. package/analysis_tools/report_generator_modular.py +885 -0
  41. package/analysis_tools/sast_scanner.py +412 -0
  42. package/analysis_tools/so_string_analyzer.py +406 -0
  43. package/analysis_tools/yara_enhanced_analyzer.py +330 -0
  44. package/analysis_tools/yara_results_processor.py +368 -0
  45. package/analyzer_config.json +113 -0
  46. package/apkid/__init__.py +32 -0
  47. package/apkid/__pycache__/__init__.cpython-313.pyc +0 -0
  48. package/apkid/__pycache__/__init__.cpython-314.pyc +0 -0
  49. package/apkid/__pycache__/apkid.cpython-313.pyc +0 -0
  50. package/apkid/__pycache__/apkid.cpython-314.pyc +0 -0
  51. package/apkid/__pycache__/main.cpython-313.pyc +0 -0
  52. package/apkid/__pycache__/main.cpython-314.pyc +0 -0
  53. package/apkid/__pycache__/output.cpython-313.pyc +0 -0
  54. package/apkid/__pycache__/rules.cpython-313.pyc +0 -0
  55. package/apkid/apkid.py +266 -0
  56. package/apkid/main.py +98 -0
  57. package/apkid/output.py +177 -0
  58. package/apkid/rules/apk/common.yara +68 -0
  59. package/apkid/rules/apk/obfuscators.yara +118 -0
  60. package/apkid/rules/apk/packers.yara +1197 -0
  61. package/apkid/rules/apk/protectors.yara +301 -0
  62. package/apkid/rules/dex/abnormal.yara +104 -0
  63. package/apkid/rules/dex/anti-vm.yara +568 -0
  64. package/apkid/rules/dex/common.yara +60 -0
  65. package/apkid/rules/dex/compilers.yara +434 -0
  66. package/apkid/rules/dex/obfuscators.yara +602 -0
  67. package/apkid/rules/dex/packers.yara +761 -0
  68. package/apkid/rules/dex/protectors.yara +520 -0
  69. package/apkid/rules/dll/common.yara +38 -0
  70. package/apkid/rules/dll/obfuscators.yara +43 -0
  71. package/apkid/rules/elf/anti-vm.yara +43 -0
  72. package/apkid/rules/elf/common.yara +54 -0
  73. package/apkid/rules/elf/obfuscators.yara +991 -0
  74. package/apkid/rules/elf/packers.yara +1128 -0
  75. package/apkid/rules/elf/protectors.yara +794 -0
  76. package/apkid/rules/res/common.yara +43 -0
  77. package/apkid/rules/res/obfuscators.yara +46 -0
  78. package/apkid/rules/res/protectors.yara +46 -0
  79. package/apkid/rules.py +77 -0
  80. package/bin/anais +3 -0
  81. package/dist/cli.js +82 -0
  82. package/dist/index.js +123 -0
  83. package/dist/types/index.js +2 -0
  84. package/dist/utils/index.js +21 -0
  85. package/dist/utils/output.js +44 -0
  86. package/dist/utils/paths.js +107 -0
  87. package/docs/ARCHITECTURE.txt +353 -0
  88. package/docs/Workflow and Reference.md +445 -0
  89. package/package.json +70 -0
  90. package/rules/yara_general_rules.yar +323 -0
  91. package/scripts/dynamic_analysis_helper.sh +334 -0
  92. package/scripts/frida/dpt_dex_dumper.js +145 -0
  93. package/scripts/frida/frida_dex_dump.js +145 -0
  94. package/scripts/frida/frida_hooks.js +437 -0
  95. package/scripts/frida/frida_websocket_extractor.js +154 -0
  96. package/scripts/setup.sh +206 -0
  97. package/scripts/validate_framework.sh +224 -0
  98. package/src/cli.ts +91 -0
  99. package/src/index.ts +123 -0
  100. package/src/types/index.ts +44 -0
  101. package/src/utils/index.ts +6 -0
  102. package/src/utils/output.ts +50 -0
  103. package/src/utils/paths.ts +72 -0
  104. package/tsconfig.json +14 -0
@@ -0,0 +1,118 @@
1
+ /*
2
+ * Copyright (C) 2023 RedNaga. https://rednaga.io
3
+ * All rights reserved. Contact: rednaga@protonmail.com
4
+ *
5
+ *
6
+ * This file is part of APKiD
7
+ *
8
+ *
9
+ * Commercial License Usage
10
+ * ------------------------
11
+ * Licensees holding valid commercial APKiD licenses may use this file
12
+ * in accordance with the commercial license agreement provided with the
13
+ * Software or, alternatively, in accordance with the terms contained in
14
+ * a written agreement between you and RedNaga.
15
+ *
16
+ *
17
+ * GNU General Public License Usage
18
+ * --------------------------------
19
+ * Alternatively, this file may be used under the terms of the GNU General
20
+ * Public License version 3.0 as published by the Free Software Foundation
21
+ * and appearing in the file LICENSE.GPL included in the packaging of this
22
+ * file. Please visit http://www.gnu.org/copyleft/gpl.html and review the
23
+ * information to ensure the GNU General Public License version 3.0
24
+ * requirements will be met.
25
+ *
26
+ **/
27
+
28
+ include "common.yara"
29
+
30
+ rule arxan_guardit : obfuscator
31
+ {
32
+ meta:
33
+ description = "Arxan GuardIT"
34
+ url = "https://www.arxan.com"
35
+ sample = "0da79f5202b4c29c4ef43f769d5703a3d4ebfa65e49ea967abb49965d4ac3ba4"
36
+ author = "Eduardo Novella"
37
+
38
+ strings:
39
+ // guardit4j.fin -- in root of apk; contains GuardIT version
40
+ $cfg = { 00 67 75 61 72 64 69 74 34 6A 2E 66 69 6E }
41
+
42
+ condition:
43
+ is_apk and #cfg > 1
44
+ }
45
+
46
+ rule gemalto_protector : obfuscator
47
+ {
48
+ meta:
49
+ description = "Gemalto"
50
+ url = "https://www.gemalto.com"
51
+ author = "Eduardo Novella"
52
+ sample = "294f95298189080a25b20ef28295d60ecde27ee12361f93ad2f024fdcb5bdb0b"
53
+
54
+ strings:
55
+ $l1 = "lib/arm64-v8a/libmedl.so"
56
+ $l2 = "lib/armeabi-v7a/libmedl.so"
57
+ $l3 = "lib/armeabi/libmedl.so"
58
+ $l4 = "lib/mips/libmedl.so"
59
+ $l5 = "lib/mips64/libmedl.so"
60
+ $l6 = "lib/x86/libmedl.so"
61
+ $l7 = "lib/x86_64/libmedl.so"
62
+
63
+ condition:
64
+ any of them and is_apk
65
+ }
66
+
67
+ rule androidrepublic : obfuscator
68
+ {
69
+ meta:
70
+ description = "AndroidRepublic"
71
+ url = "https://androidrepublic.org/"
72
+ sample = "b893b45852ccfe4e037a356348042e613c47ae56e554943d8b3998c0cbb3ffb9"
73
+ author = "Eduardo Novella"
74
+
75
+ strings:
76
+ $asset1 = "assets/emt.androidrepublic/config.png"
77
+ $asset2 = "assets/emt.androidrepublic/monkey.png"
78
+ $asset3 = "assets/emt.androidrepublic/system.png"
79
+ $asset4 = "assets/emt.androidrepublic/system_000.png"
80
+ $asset5 = "assets/emt.androidrepublic/system_001.png"
81
+ $asset6 = "assets/emt.androidrepublic/system_002.png"
82
+ $asset7 = "assets/emt.androidrepublic/system_003.png"
83
+ $asset8 = "assets/emt.androidrepublic/system_004.png"
84
+ $asset9 = "assets/emt.androidrepublic/system_005.png"
85
+
86
+ condition:
87
+ is_apk and any of them
88
+ }
89
+
90
+ rule androidrepublic_vip : obfuscator
91
+ {
92
+ meta:
93
+ description = "AndroidRepublic VIP"
94
+ url = "https://androidrepublic.org/"
95
+ sample = "ea1c69b7ba4f43ddcfb615e3fc5ff87d599232e6df089845a0e663d4bea761e0"
96
+ author = "Eduardo Novella"
97
+
98
+ strings:
99
+ $asset1 = /assets\/androidrepublic\.org\/(.*)\.png/
100
+
101
+ condition:
102
+ is_apk and all of them
103
+ }
104
+
105
+ rule obfuscapk_libencryption : obfuscator
106
+ {
107
+ meta:
108
+ description = "Obfuscapk - LibEncryption plugin"
109
+ url = "https://github.com/ClaudiuGeorgiu/Obfuscapk"
110
+ author = "Simone Aonzo - https://twitter.com/packm4d"
111
+ sample = "4957d9c1b423ae045f27d97b1d0b1f32ba6a2ce56525a2e93bda7172ec18ad0c"
112
+
113
+ strings:
114
+ $lib_arm = /assets\/lib\.arm(eabi|64)-v[0-9a-zA-Z]{2}\.[!-~]+\.so/
115
+ $lib_x86 = /assets\/lib\.x86(_64)?\.[!-~]+\.so/
116
+ condition:
117
+ any of them and is_apk
118
+ }