Skip to content

Commit 1aca885

Browse files
authored
Add method reference for show_detail_report in the document (#549)
1 parent 93d0147 commit 1aca885

File tree

1 file changed

+85
-1
lines changed

1 file changed

+85
-1
lines changed

docs/source/quark_method_reference.rst

Lines changed: 85 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,7 @@ Here is the flowchart of ``show_summary_report``.
11881188
self.quark_analysis.score_sum += score
11891189
11901190
show_label_report
1191-
===============
1191+
==================
11921192

11931193
**The algorithm of show_label_report**
11941194

@@ -1281,3 +1281,87 @@ Here is the flowchart of ``show_label_report``.
12811281
)
12821282
12831283
1284+
show_detail_report
1285+
==================
1286+
1287+
**The algorithm of show_detail_report**
1288+
1289+
The function ``show_detail_report`` prints a report summarizing the result of the five-level check and the confidence of the APK.
1290+
1291+
Here is the process of ``show_detail_report``.
1292+
1293+
.. code-block:: TEXT
1294+
1295+
1. Calculate the confidence of the APK by multiplying the number of passed levels by 20.
1296+
1297+
2. Check if the APK passed level 1.
1298+
- If passed, show the match permissions.
1299+
1300+
3. Check if the APK passed level 2.
1301+
- If passed, show the matched APIs.
1302+
1303+
4. Check if the APK passed level 3.
1304+
- If passed, show the matched API combinations.
1305+
1306+
5. Check if the APK passed level 4.
1307+
- If passed, show the matched API sequences.
1308+
1309+
6. Check if the APK passed level 5.
1310+
- If passed, show the matched API sequences that use the same register.
1311+
1312+
Here is the flowchart of ``show_detail_report``.
1313+
1314+
.. image:: https://i.imgur.com/s1DZVHs.png
1315+
1316+
1317+
**The code of show_detail_report**
1318+
1319+
1320+
.. code:: python
1321+
1322+
def show_detail_report(self, rule_obj):
1323+
"""
1324+
Show the detail report.
1325+
1326+
:param rule_obj: the instance of the RuleObject.
1327+
:return: None
1328+
"""
1329+
1330+
# Count the confidence
1331+
print("")
1332+
print(f"Confidence: {rule_obj.check_item.count(True) * 20}%")
1333+
print("")
1334+
1335+
if rule_obj.check_item[0]:
1336+
1337+
colorful_report("1.Permission Request")
1338+
for permission in rule_obj.permission:
1339+
print(f"\t\t {permission}")
1340+
if rule_obj.check_item[1]:
1341+
colorful_report("2.Native API Usage")
1342+
for api in self.quark_analysis.level_2_result:
1343+
print(f"\t\t {api.full_name}")
1344+
if rule_obj.check_item[2]:
1345+
colorful_report("3.Native API Combination")
1346+
for numbered_api, method_list in zip(
1347+
("First API", "Second API"), self.quark_analysis.level_3_result
1348+
):
1349+
print(f"\t\t {numbered_api} show up in:")
1350+
if method_list:
1351+
for comb_method in method_list:
1352+
print(f"\t\t {comb_method.full_name}")
1353+
else:
1354+
print("\t\t None")
1355+
1356+
if rule_obj.check_item[3]:
1357+
1358+
colorful_report("4.Native API Sequence")
1359+
print("\t\t Sequence show up in:")
1360+
for seq_method in self.quark_analysis.level_4_result:
1361+
print(f"\t\t {seq_method.full_name}")
1362+
if rule_obj.check_item[4]:
1363+
1364+
colorful_report("5.Native API Use Same Parameter")
1365+
for seq_operation in self.quark_analysis.level_5_result:
1366+
print(f"\t\t {seq_operation.full_name}")
1367+

0 commit comments

Comments
 (0)