Exemple #1
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)
Exemple #2
0
def test_output_parent_function_table_with_data_bundle(capsys, sample_data_bundle):
    output_parent_function_table(sample_data_bundle)

    output = capsys.readouterr().out
    assert output.count("Lcom/google/progress/Locate;getLocation") == 2
    assert output.count("Lcom/google/progress/AndroidClientService;sendMessage") == 1
    assert output.count("Call Lcom/google/progress/Locate;getLocation") == 1
    assert output.count("The Crime") == 1
    assert output.count("Another Crime") == 1
Exemple #3
0
def test_output_parent_function_table(capsys, quark_obj):
    method_obj = quark_obj.apkinfo.find_method(
        "Lcom/google/progress/WifiCheckTask;", "goConnectNetwork", "()V")

    call_graph_analysis_list = (
        {
            "crime": "The Crime",
            "parent": method_obj
        },
        {
            "crime": "The Crime",
            "parent": method_obj
        },
        {
            "crime": "Another Crime",
            "parent": method_obj
        },
    )

    # Test one crime
    output_parent_function_table([call_graph_analysis_list[0]])

    output = capsys.readouterr().out
    assert output.count(
        "Lcom/google/progress/WifiCheckTask;goConnectNetwork") == 1
    assert output.count("The Crime") == 1

    # Test crimes with duplicated description
    output_parent_function_table(call_graph_analysis_list)

    output = capsys.readouterr().out
    print(output)
    assert output.count(
        "Lcom/google/progress/WifiCheckTask;goConnectNetwork") == 1
    assert output.count("The Crime") == 1
    assert output.count("Another Crime") == 1
Exemple #4
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)