generated from clearbluejar/ghidra-python-vscode-devcontainer-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 11
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
c6aefbd
commit 539865b
Showing
5 changed files
with
109 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
__version__ = '0.5.4' | ||
__version__ = '0.5.5' | ||
__author__ = 'clearbluejar' | ||
|
||
# Expose API | ||
|
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
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,55 @@ | ||
import pytest | ||
from pathlib import Path | ||
|
||
import pyhidra | ||
from ghidrecomp import decompile, get_parser | ||
from ghidrecomp.decompile import get_bin_output_path, gen_proj_bin_name_from_path | ||
from ghidrecomp.bsim import has_bsim, add_bsim_args_to_parser, add_categories_to_prog | ||
from pyhidra import HeadlessPyhidraLauncher | ||
from pathlib import Path | ||
|
||
|
||
def test_gzf_created(shared_datadir: Path): | ||
|
||
parser = get_parser() | ||
|
||
bin_path = shared_datadir / 'ls_aarch64' | ||
|
||
args = parser.parse_args([f"{bin_path.absolute()}", "--filter", "ctype", "--skip-cache", "--gzf"]) | ||
|
||
bin_proj_name = gen_proj_bin_name_from_path(bin_path) | ||
expected_output_path = get_bin_output_path(args.output_path, bin_proj_name) | ||
|
||
gzf_output_path = Path(args.output_path) / 'gzfs' / f"{bin_proj_name}.gzf" | ||
|
||
all_funcs, decompilations, output_path, compiler, lang_id, callgraphs = decompile(args) | ||
|
||
assert len(all_funcs) == 8 | ||
assert len(decompilations) == 8 | ||
assert len(callgraphs) == 0 | ||
assert expected_output_path == output_path | ||
assert gzf_output_path.exists() | ||
|
||
|
||
def test_gzf_created_with_path(shared_datadir: Path): | ||
|
||
parser = get_parser() | ||
|
||
bin_path = shared_datadir / 'ls_aarch64' | ||
gzf_custom_path = shared_datadir / "custom_gzf" | ||
|
||
args = parser.parse_args([f"{bin_path.absolute()}", "--filter", "ctype", "--skip-cache", | ||
"--gzf", "--gzf-path", str(gzf_custom_path)]) | ||
|
||
bin_proj_name = gen_proj_bin_name_from_path(bin_path) | ||
expected_output_path = get_bin_output_path(args.output_path, bin_proj_name) | ||
|
||
gzf_output_path = gzf_custom_path / f"{bin_proj_name}.gzf" | ||
|
||
all_funcs, decompilations, output_path, compiler, lang_id, callgraphs = decompile(args) | ||
|
||
assert len(all_funcs) == 8 | ||
assert len(decompilations) == 8 | ||
assert len(callgraphs) == 0 | ||
assert expected_output_path == output_path | ||
assert gzf_custom_path.exists() |