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,434 @@
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
+ import "dex"
29
+ include "common.yara"
30
+
31
+ private rule unsorted_string_pool : internal
32
+ {
33
+ meta:
34
+ description = "String pool in non-standard order"
35
+
36
+ condition:
37
+ /*
38
+ * DEX format requires string IDs to be sorted according to the data at their offsets but the actual
39
+ * ordering of the string pool is undefined. Dexlib (smali/apktool) 1.x sorts strings by class and
40
+ * proximity. DX sorts the string pool in the same order as the string table.
41
+ *
42
+ * Note: It's probably only necessary to check the first several strings.
43
+ */
44
+ for any i in (0..dex.header.string_ids_size - 1) : (dex.string_ids[i + 1].offset < dex.string_ids[i].offset)
45
+ }
46
+
47
+ private rule dexlib2_map_type_order : internal
48
+ {
49
+ meta:
50
+ description = "dexlib2 map_list type order"
51
+
52
+ condition:
53
+ (dex.map_list.map_item[7].type == 0x2002 and dex.map_list.map_item[8].type == 0x1001)
54
+ or (dex.map_list.map_item[6].type == 0x2002 and dex.map_list.map_item[7].type == 0x1001)
55
+ }
56
+
57
+ private rule null_interfaces : internal
58
+ {
59
+ meta:
60
+ description = "null interfaces offset"
61
+
62
+ condition:
63
+ /*
64
+ * Dexlib2 adds a non-zero interfaces_offset to every class_def_item, even if the class doesn't implement an
65
+ * interface. It points to 4 null bytes right after string pool. DEX documentation says the value for
66
+ * interfaces_offset should be 0 if there is no interface, which is what DX does. It's enough to check
67
+ * if a single class has an interface which points to null bytes since no one else does this.
68
+ */
69
+ for any i in (0..dex.header.class_defs_size) : (dex.class_defs[i].interfaces_offset > 0 and uint32(dex.class_defs[i].interfaces_offset) == 0)
70
+ }
71
+
72
+ private rule dx_map_type_order : internal
73
+ {
74
+ meta:
75
+ description = "dx map_list type order"
76
+
77
+ condition:
78
+ /*
79
+ * Different compiler families tend to order the map_list types differently.
80
+ * DX order derrived from: https://github.com/aosp-mirror/platform_dalvik/blob/2e9d6011fe4f4d2e8c065210d0118e7b9d9f305c/dx/src/com/android/dx/dex/file/DexFile.java#L144
81
+ * The order starting at offset 7 is:
82
+ * 0x1002 = TYPE_ANNOTATION_SET_REF_LIST (optional)
83
+ * 0x1003 = TYPE_ANNOTATION_SET_ITEM (optional)
84
+ * 0x2001 = TYPE_CODE_ITEM (optional, but very common)
85
+ * 0x2006 = TYPE_ANNOTATIONS_DIRECTORY_ITEM (optional)
86
+ * 0x1001 = TYPE_TYPE_LIST (optional, but common)
87
+ * 0x2002 = TYPE_STRING_DATA_ITEM
88
+ * Also, for reference:
89
+ * 0x0000 = TYPE_HEADER_ITEM
90
+ * 0x0001 = TYPE_STRING_ID_ITEM
91
+ * 0x0002 = TYPE_TYPE_ID_ITEM
92
+ * 0x0006 = TYPE_CLASS_DEF_ITEM
93
+ * 0x1000 = TYPE_MAP_LIST
94
+ */
95
+ // missing all TYPE_ANNOTATION*, common case
96
+ (dex.map_list.map_item[7].type == 0x2001 and dex.map_list.map_item[8].type == 0x1001)
97
+
98
+ // missing all TYPE_ANNOTATION*, and TYPE_TYPE_LIST so probably very small DEX
99
+ or (dex.map_list.map_item[7].type == 0x2001 and dex.map_list.map_item[8].type == 0x2002)
100
+
101
+ // has all TYPE_ANNOTATION*
102
+ or (dex.map_list.map_item[7].type == 0x1002 and dex.map_list.map_item[8].type == 0x1003 and dex.map_list.map_item[9].type == 0x2001 and dex.map_list.map_item[10].type == 0x2006 and dex.map_list.map_item[11].type == 0x1001)
103
+
104
+ // missing TYPE_ANNOTATION_SET_REF_LIST
105
+ or (dex.map_list.map_item[7].type == 0x1003 and dex.map_list.map_item[8].type == 0x2001 and dex.map_list.map_item[9].type == 0x2006 and dex.map_list.map_item[10].type == 0x1001)
106
+
107
+ // missing TYPE_ANNOTATION_SET_REF_LIST and TYPE_ANNOTATION_SET_ITEM
108
+ or (dex.map_list.map_item[7].type == 0x2001 and dex.map_list.map_item[8].type == 0x2006 and dex.map_list.map_item[9].type == 0x1001)
109
+
110
+ // missing TYPE_ANNOTATION_SET_REF_LIST and TYPE_ANNOTATIONS_DIRECTORY_ITEM
111
+ or (dex.map_list.map_item[7].type == 0x1003 and dex.map_list.map_item[8].type == 0x2001 and dex.map_list.map_item[9].type == 0x1001)
112
+
113
+ // missing TYPE_ANNOTATION_SET_ITEM
114
+ or (dex.map_list.map_item[7].type == 0x1002 and dex.map_list.map_item[8].type == 0x2001 and dex.map_list.map_item[9].type == 0x2006 and dex.map_list.map_item[10].type == 0x1001)
115
+
116
+ // missing TYPE_ANNOTATION_SET_ITEM and TYPE_ANNOTATIONS_DIRECTORY_ITEM
117
+ or (dex.map_list.map_item[7].type == 0x1002 and dex.map_list.map_item[8].type == 0x2001 and dex.map_list.map_item[9].type == 0x1001)
118
+
119
+ // missing TYPE_ANNOTATIONS_DIRECTORY_ITEM
120
+ or (dex.map_list.map_item[7].type == 0x1002 and dex.map_list.map_item[8].type == 0x1003 and dex.map_list.map_item[9].type == 0x2001 and dex.map_list.map_item[10].type == 0x1001)
121
+
122
+ // missing almost everything, VERY tiny dex
123
+ or (dex.map_list.map_item[1].type == 0x0001 and dex.map_list.map_item[2].type == 0x0002 and dex.map_list.map_item[3].type == 0x0006 and dex.map_list.map_item[4].type == 0x2002 and dex.map_list.map_item[5].type == 0x1000)
124
+
125
+ // missing code and (fields | something else), likely small dex
126
+ or (dex.map_list.map_item[6].type == 0x1003 and dex.map_list.map_item[7].type == 0x2006 and dex.map_list.map_item[8].type == 0x1001 and dex.map_list.map_item[9].type == 0x2002)
127
+ }
128
+
129
+ private rule ambiguous_tiny_dex_map_type_order : internal
130
+ {
131
+ meta:
132
+ description = "ambiguous tiny dex map type order"
133
+
134
+ condition:
135
+ // missing almost everything, dexlib2 and r8 are identical here, impossible to type alone
136
+ (dex.map_list.map_item[1].type == 0x0001 and dex.map_list.map_item[2].type == 0x0002 and dex.map_list.map_item[3].type == 0x0006 and dex.map_list.map_item[4].type == 0x2002 and dex.map_list.map_item[5].type == 0x1003 and dex.map_list.map_item[6].type == 0x1000)
137
+ }
138
+
139
+ private rule r8_map_type_order : internal
140
+ {
141
+ meta:
142
+ description = "r8 map_list type order"
143
+
144
+ condition:
145
+ /*
146
+ * R8 order derrived from: https://r8.googlesource.com/r8/+/refs/heads/master/src/main/java/com/android/tools/r8/dex/FileWriter.java#1215
147
+ * The order starting at offset 7 is:
148
+ * 0x0007 = TYPE_CALL_SITE_ID_ITEM (optional)
149
+ * 0x0008 = TYPE_METHOD_HANDLE_ITEM (optional)
150
+ * 0x2001 = TYPE_CODE_ITEM
151
+ * 0x2003 = TYPE_DEBUG_INFO_ITEM (optional)
152
+ * 0x1001 = TYPE_TYPE_LIST
153
+ * 0x2002 = TYPE_STRING_DATA_ITEM
154
+ */
155
+ // missing TYPE_CALL_SITE_ID_ITEM and TYPE_METHOD_HANDLE_ITEM, common case
156
+ (dex.map_list.map_item[7].type == 0x2001 and dex.map_list.map_item[8].type == 0x2003 and dex.map_list.map_item[9].type == 0x1001)
157
+
158
+ // missing TYPE_DEBUG_INFO_ITEM
159
+ or (dex.map_list.map_item[7].type == 0x2001 and dex.map_list.map_item[8].type == 0x1001 and dex.map_list.map_item[9].type == 0x2002)
160
+
161
+ // has everything
162
+ or (dex.map_list.map_item[7].type == 0x0007 and dex.map_list.map_item[8].type == 0x0008 and dex.map_list.map_item[9].type == 0x2001 and dex.map_list.map_item[10].type == 0x2003 and dex.map_list.map_item[11].type == 0x1001)
163
+
164
+ // missing TYPE_CALL_SITE_ID_ITEM
165
+ or (dex.map_list.map_item[7].type == 0x0008 and dex.map_list.map_item[8].type == 0x2001 and dex.map_list.map_item[9].type == 0x2003 and dex.map_list.map_item[10].type == 0x1001)
166
+
167
+ // missing TYPE_METHOD_HANDLE_ITEM
168
+ or (dex.map_list.map_item[7].type == 0x0007 and dex.map_list.map_item[8].type == 0x2001 and dex.map_list.map_item[9].type == 0x2003 and dex.map_list.map_item[10].type == 0x1001)
169
+
170
+ // ignore missing TYPE_CALL_SITE_ID_ITEM, TYPE_METHOD_HANDLE_ITEM, and TYPE_DEBUG_INFO_ITEM is possibly identical to dx map type order
171
+
172
+ // missing code and (fields | something else), likely small dex
173
+ or (dex.map_list.map_item[6].type == 0x1001 and dex.map_list.map_item[7].type == 0x2002 and dex.map_list.map_item[8].type == 0x2004 and dex.map_list.map_item[9].type == 0x2000 and dex.map_list.map_item[10].type == 0x1003)
174
+ }
175
+
176
+ private rule r8_marker : internal
177
+ {
178
+ meta:
179
+ description = "r8 hidden marker"
180
+
181
+ strings:
182
+ // Example: ~~D8{"compilation-mode":"
183
+ // OR: ~~D8{"backend":"dex","compilation-mode":"
184
+ $marker = { 00 [1-2] 7E 7E ( 44 | 52 | 4C ) 38 7B 22 [0-16] 63 6F 6D 70 69 6C 61 74 69 6F 6E 2D 6D 6F 64 65 22 3A 22 }
185
+
186
+ condition:
187
+ /*
188
+ * Marker logic from: https://r8.googlesource.com/r8/+/refs/heads/master/src/main/java/com/android/tools/r8/dex/Marker.java#18
189
+ */
190
+ $marker
191
+ }
192
+
193
+ private rule dexmerge_map_type_order : internal
194
+ {
195
+ meta:
196
+ description = "dexmerge map_list type order"
197
+
198
+ condition:
199
+ /*
200
+ * DexMerge order derrived from: https://github.com/aosp-mirror/platform_dalvik/blob/2e9d6011fe4f4d2e8c065210d0118e7b9d9f305c/dx/src/com/android/dx/merge/DexMerger.java#L110
201
+ */
202
+ dex.map_list.map_item[7].type == 0x1000 // TYPE_MAP_LIST
203
+ }
204
+
205
+ rule jack_4_12 : compiler
206
+ {
207
+ meta:
208
+ description = "Jack 4.12"
209
+ sample = "b6a92aec55ab93f2254f12a2ab42f6c53a1b4ba1fbae62623193262e7dc31f26"
210
+
211
+ strings:
212
+ $jack_emitter = {00 12 65 6D 69 74 74 65 72 3A 20 6A 61 63 6B 2D 34 2E 31 32 00}
213
+
214
+ condition:
215
+ is_dex and $jack_emitter
216
+ }
217
+
218
+ rule jack_3x : compiler
219
+ {
220
+ meta:
221
+ description = "Jack 3.x"
222
+
223
+ strings:
224
+ //\0<len>emitter: jack-3.??\0
225
+ $jack_emitter = {00 1? 65 6D 69 74 74 65 72 3A 20 6A 61 63 6B 2D 33 2E [1-3] 00}
226
+
227
+ condition:
228
+ is_dex and $jack_emitter
229
+ }
230
+
231
+ rule jack_4x : compiler
232
+ {
233
+ meta:
234
+ description = "Jack 4.x"
235
+
236
+ strings:
237
+ //\0<len>emitter: jack-4.??\0
238
+ $jack_emitter = {00 1? 65 6D 69 74 74 65 72 3A 20 6A 61 63 6B 2D 34 2E [1-3] 00}
239
+
240
+ condition:
241
+ is_dex and not jack_4_12 and $jack_emitter
242
+ }
243
+
244
+ rule jack_5x : compiler
245
+ {
246
+ meta:
247
+ description = "Jack 5.x"
248
+
249
+ strings:
250
+ //\0<len>emitter: jack-5.??\0
251
+ $jack_emitter = {00 1? 65 6D 69 74 74 65 72 3A 20 6A 61 63 6B 2D 35 2E [1-3] 00}
252
+
253
+ condition:
254
+ is_dex and $jack_emitter
255
+ }
256
+
257
+ private rule has_jack_anon_methods : internal
258
+ {
259
+ meta:
260
+ description = "has Jack compiler anonymous methods"
261
+ url = "https://calebfenton.github.io/2016/12/01/building-with-and-detecting-jack/"
262
+
263
+ strings:
264
+ $anon_set = {00 05 2D 73 65 74 30 00} // -set0
265
+ $anon_get = {00 05 2D 67 65 74 30 00} // -get0
266
+ $anon_wrap = {00 06 2D 77 72 61 70 30 00} // -wrap0
267
+
268
+ condition:
269
+ 2 of ($anon_*)
270
+ }
271
+
272
+ private rule jack_emitter : internal
273
+ {
274
+ meta:
275
+ description = "has Jack compiler emitter string"
276
+
277
+ strings:
278
+ // "\0<len>emitter: jack-?.?\0"
279
+ $jack_emitter = {00 1? 65 6D 69 74 74 65 72 3A 20 6A 61 63 6B 2D ?? 2E [1-3] 00}
280
+
281
+ condition:
282
+ $jack_emitter or has_jack_anon_methods
283
+ }
284
+
285
+ private rule has_javac_anon_methods : internal
286
+ {
287
+ meta:
288
+ description = "has Javac compiler anonymous methods"
289
+ url = "https://calebfenton.github.io/2016/12/01/building-with-and-detecting-jack/"
290
+
291
+ strings:
292
+ $anon_set = {00 0A 61 63 63 65 73 73 24 30 30 32 00} // access$002
293
+ $anon_get = {00 0A 61 63 63 65 73 73 24 30 30 30 00} // access$000
294
+ $anon_wrap = {00 0A 61 63 63 65 73 73 24 31 30 30 00} // access$100
295
+
296
+ condition:
297
+ 2 of ($anon_*)
298
+ }
299
+
300
+ rule jack_generic : compiler
301
+ {
302
+ // New Android compiler: http://tools.android.com/tech-docs/jackandjill
303
+ meta:
304
+ description = "Jack (unknown version)"
305
+ sample = "aaa4aed09a3a014c6e045566b86708f964088a0f9c712f02191cdcf61ff06fe8"
306
+
307
+ condition:
308
+ is_dex
309
+ and not jack_3x and not jack_4x and not jack_5x
310
+ and not jack_4_12
311
+ and (jack_emitter or has_jack_anon_methods)
312
+ }
313
+
314
+ rule dexlib1 : compiler
315
+ {
316
+ meta:
317
+ description = "dexlib 1.x"
318
+ sample = "cf7b06bd339ee68224420dfcaba84a88e51ae6cd07d504fc8b4f2db6c6889971"
319
+
320
+ condition:
321
+ unsorted_string_pool
322
+ }
323
+
324
+ rule dexlib2beta : compiler
325
+ {
326
+ meta:
327
+ description = "dexlib 2.x beta"
328
+ sample = "8fd8c1e2337a4d2ac8f8f64c13a4fb304589ecf165e41de27ebc656a7475a008"
329
+
330
+ condition:
331
+ not dexlib1
332
+ and null_interfaces
333
+ }
334
+
335
+ rule dexlib2 : compiler
336
+ {
337
+ meta:
338
+ description = "dexlib 2.x"
339
+ sample = "c7c566b1b185c99e338a77865eaf2eed6dc9b2b97793e262208c0b7f38bbf947"
340
+
341
+ condition:
342
+ not dexlib1
343
+ and dexlib2_map_type_order
344
+ and not dexlib2beta
345
+ }
346
+
347
+ rule dx : compiler
348
+ {
349
+ meta:
350
+ description = "dx"
351
+ sample = "6ef06bcc9712ec2ef3b71c5c8454af3abdafa628406b4f5629815995470da878"
352
+
353
+ condition:
354
+ dx_map_type_order
355
+ and not dexlib1
356
+ and not dexlib2
357
+ and not dexlib2beta
358
+ and not r8_marker
359
+ }
360
+
361
+ rule dx_merged : compiler
362
+ {
363
+ meta:
364
+ description = "dx (possible dexmerge)"
365
+ sample = "6c31ccd3b10ff2b0fa428e6efa954c37c0d2e641814f63c524c4f8fec9d11e22"
366
+
367
+ condition:
368
+ dexmerge_map_type_order
369
+ and not dexlib1
370
+ and not dexlib2
371
+ and not dexlib2beta
372
+ and not r8_marker
373
+ }
374
+
375
+ rule r8 : compiler
376
+ {
377
+ meta:
378
+ description = "r8"
379
+ sample = "e45ea01eedfc7bede77669412cce07b7d41b284bc6ffc9dfa27a519270bbe99a"
380
+ sample2 = "bae4c7c1974fa317ecc8fbbcf7bafa3b1a0d5903fdd3040412c628277cf45258"
381
+
382
+ condition:
383
+ r8_marker
384
+ and (r8_map_type_order or ambiguous_tiny_dex_map_type_order)
385
+ }
386
+
387
+ rule r8_merged : compiler
388
+ {
389
+ meta:
390
+ description = "r8 (possible dexmerge)"
391
+ sample = "ee1e901bb862835b227f7e9cfbaaa357402992ee9760b630a05f9b3423520526"
392
+
393
+ condition:
394
+ r8_marker
395
+ and dexmerge_map_type_order
396
+ }
397
+
398
+ rule r8_no_marker : compiler
399
+ {
400
+ meta:
401
+ // Hiding the marker is easier than hiding the map type order.
402
+ description = "r8 without marker (suspicious)"
403
+ sample = "f399d833ff54a798d609279bb8a51222c75be9b7fb7b3ab9cc8cb628f7d76257"
404
+ sample2 = "d8a5545eb3c76d8078d778eb5962398d9f2fefab34f971b19beda35e0e76f6ef"
405
+
406
+ condition:
407
+ not r8_marker
408
+ and r8_map_type_order
409
+ }
410
+
411
+ rule dexmerge : manipulator
412
+ {
413
+ meta:
414
+ description = "dexmerge"
415
+ sample = "6c31ccd3b10ff2b0fa428e6efa954c37c0d2e641814f63c524c4f8fec9d11e22"
416
+
417
+ condition:
418
+ dexmerge_map_type_order
419
+ }
420
+
421
+ rule unknown_compiler : compiler {
422
+ meta:
423
+ description = "unknown (please file detection issue!)"
424
+
425
+ condition:
426
+ is_dex
427
+ and not (
428
+ (dexlib1 or dexlib2 or dexlib2beta)
429
+ or (dx or dx_merged)
430
+ or (r8 or r8_merged or r8_no_marker)
431
+ or (jack_generic or jack_3x or jack_4x or jack_4_12 or jack_5x)
432
+ or (dexmerge)
433
+ )
434
+ }