Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Precompile both ghidra scripts #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions tool_run_scripts/anvill.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,7 @@ def save(self):
reprofile.write(" ".join(self.cmd))
reprofile.write("\n")

# Run the script with no input to trigger script compilation so it gets saved in the cache
def initialize_ghidra_cache(ghidra_dir):
def initialize_script(ghidra_dir, name):
try:
args = [os.path.join(ghidra_dir, "support", "analyzeHeadless")]
args.extend([
Expand All @@ -230,7 +229,7 @@ def initialize_ghidra_cache(ghidra_dir):
"-readOnly",
"-deleteProject",
"-preScript",
"anvillHeadlessExportScript",
name
])

subprocess.run(args=args)
Expand All @@ -244,6 +243,10 @@ def initialize_ghidra_cache(ghidra_dir):
log.error(f"Could not initialize ghidra: timeout exception")
sys.exit(1)

# Run the script with no input to trigger script compilation so it gets saved in the cache
def initialize_ghidra_cache(ghidra_dir):
initialize_script(ghidra_dir, "anvillHeadlessExportScript")
initialize_script(ghidra_dir, "FixGlobalRegister")

def run_anvill_ghidra(ghidra_dir, output_dir, failonly, source_path, stats, language_id_overrides, input_and_idx):
idx, input_file = input_and_idx
Expand Down