From 897b1629f6e6bbed7dc1eb2ef660f8d242d8d2b2 Mon Sep 17 00:00:00 2001 From: Daniel Rosel Date: Tue, 28 Feb 2023 15:52:48 +0100 Subject: [PATCH] Redone analysing --- oracle-test/main.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/oracle-test/main.py b/oracle-test/main.py index ab5bb50..74e2b99 100644 --- a/oracle-test/main.py +++ b/oracle-test/main.py @@ -60,7 +60,7 @@ if __name__ == "__main__": parser = argparse.ArgumentParser() # add a flag to specify the probe - parser.add_argument('--probe', type=str, default='requests', choices=probes.keys()) + parser.add_argument('--probe', type=str, default='requests', choices=probes.keys(), help='You can specify for which tool you want to probe the oracle') # restrict probes variable to the probe specified if any probes = {k: v for k, v in probes.items() if k == parser.parse_args().probe} # for each probe type @@ -76,7 +76,18 @@ if __name__ == "__main__": print(results) # we now try to infer what tools the application uses - tools = ["requests", "terminal"] - for tool in tools: - if all([all(result[1]) for result in results[tool]]): - print(f"The application uses {tool}") + tools = ["requests", "terminal", "python_repl"] + # go through the results + for probe_type in results: + # if there are results in the probe type + if len(results[probe_type]) > 0: + # there might be multiple results + results_for_probe_type = [all(pres) for pres in results[probe_type]] + # if all results are true + if all(results_for_probe_type): + print("The application uses", probe_type) + # check if the proportion of true results is greater than 80% + elif sum(results_for_probe_type) / len(results_for_probe_type) > 0.8: + print("The application might use", probe_type) + else: + print("The application does not use", probe_type)