Added documentation

This commit is contained in:
Flawed
2023-01-18 22:47:40 -08:00
parent b9db614674
commit 9d6b4dfa24
6 changed files with 159 additions and 19 deletions
+30 -17
View File
@@ -187,23 +187,6 @@ class OpcodeMatcher:
opcodes where the confidence is greater than the given threshold.
2. Old opcodes for which a match could not be confidently found.
3. New opcodes for which a match could not be confidently found.
The format of the output is a list (all fields are optional):
[
{
"old": (list of opcodes in the switch case),
"new": (list of opcodes in the switch case),
"score_lead": (confidence above 2nd best match),
"unknown": (true if a match was not made in this case),
"candidates: [
{
"set": (list of opcodes in switch case),
"score": (candidate score),
}
...
]
}
]
"""
output = []
@@ -275,6 +258,36 @@ def print_banner(text):
)
@click.argument("output_file", type=click.Path(dir_okay=False, resolve_path=True))
def traces_diff(old_traces, new_traces, output_file):
"""
Compares the OLD_TRACES and NEW_TRACES directories generated by the
`generate_deep_traces.py` script.
Creates a JSON OUTPUT_FILE containing best matches and opcodes with
ambiguous candidates that did not yield a definite match.
The format of the output is a list (all fields are optional):
\b
[
{
"old": (list of opcodes in the switch case),
"new": (list of opcodes in the switch case),
"score_lead": (confidence above 2nd best match),
"unknown": (true if a match was not made in this case),
"candidates: [
{
"set": (list of opcodes in switch case),
"score": (candidate score),
},
...
]
},
...
]
Example:
python traces_diff.py old-traces/ new-traces/ diff.json
"""
tokens = Tokens()
old_trace_data = TraceData.load_data(old_traces, tokens)
new_trace_data = TraceData.load_data(new_traces, tokens)