Esempio n. 1
0
def test_output_parent_function_json_with_sample_data_bundle(
    sample_data_bundle,
):
    output_parent_function_json(sample_data_bundle)

    with open("rules_classification.json", "r") as classification_report:
        report = json.load(classification_report)

        assert len(report["rules_classification"]) == 2

        first_item = report["rules_classification"][0]
        second_item = report["rules_classification"][1]
        if first_item["parent"] != "Lcom/google/progress/Locate;getLocation":
            first_item, second_item = second_item, first_item

        assert set(first_item["crime"]) == {"The Crime"}
        assert set(second_item["crime"]) == {
            "Call Lcom/google/progress/Locate;getLocation",
            "Another Crime",
        }

        assert (
            second_item["parent"]
            == "Lcom/google/progress/AndroidClientService;sendMessage"
        )
Esempio n. 2
0
    def show_rule_classification(self):
        print_info("Rules Classification")

        data_bundle = get_rule_classification_data(
            self.quark_analysis.call_graph_analysis_list, MAX_SEARCH_LAYER)

        output_parent_function_table(data_bundle)
        output_parent_function_json(data_bundle)
        output_parent_function_graph(data_bundle)
Esempio n. 3
0
 def show_rule_classification(self):
     print_info("Rules Classification")
     output_parent_function_table(
         self.quark_analysis.call_graph_analysis_list)
     output_parent_function_json(
         self.quark_analysis.call_graph_analysis_list)