generated from clearbluejar/ghidra-python-vscode-devcontainer-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
90d3f04
commit 8e6672b
Showing
3 changed files
with
40 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import inspect | ||
import argparse | ||
import ghidriff | ||
|
||
|
||
def get_engine_classes() -> dict: | ||
engines = {} | ||
|
||
for name, klass in inspect.getmembers(ghidriff, inspect.isclass): | ||
if name.endswith('Diff'): | ||
engines[name] = klass | ||
|
||
return engines | ||
|
||
def get_parser() -> argparse.ArgumentParser: | ||
""" | ||
Build main ghidriff parser | ||
""" | ||
|
||
parser = argparse.ArgumentParser(description='ghidriff - A Command Line Ghidra Binary Diffing Engine', | ||
formatter_class=argparse.ArgumentDefaultsHelpFormatter) | ||
|
||
parser.add_argument('old', nargs=1, help="Path to old version of binary '/somewhere/bin.old'") | ||
parser.add_argument('new', action='append', nargs='+', | ||
help="Path to new version of binary '/somewhere/bin.new'. (For multiple new binaries add oldest to newest)") | ||
|
||
# setup Engine class options | ||
engines = get_engine_classes() | ||
parser.add_argument('--engine', help='The diff implementation to use.', | ||
default='VersionTrackingDiff', choices=engines.keys()) | ||
|
||
parser.add_argument('-o', '--output-path', help='Output path for resulting diffs', default='ghidriffs') | ||
parser.add_argument('--summary', help='Add a summary diff if more than two bins are provided', default=False) | ||
|
||
return parser |