15
15
##
16
16
import sys
17
17
import contextlib
18
- from typing import Union , TYPE_CHECKING , Tuple , Callable , Any
18
+ from typing import Union , TYPE_CHECKING , Tuple , List , Callable , Any
19
19
20
20
from pyghidra .converters import * # pylint: disable=wildcard-import, unused-wildcard-import
21
21
@@ -155,6 +155,7 @@ def ghidra_script(
155
155
path : Union [str , Path ],
156
156
project : "Project" ,
157
157
program : "Program" = None ,
158
+ script_args : List [str ] = [],
158
159
echo_stdout = True ,
159
160
echo_stderr = True
160
161
) -> Tuple [str , str ]:
@@ -164,6 +165,7 @@ def ghidra_script(
164
165
:param path: The GhidraScript's path.
165
166
:param project: The Ghidra project to run the GhidraScript in.
166
167
:param program: An optional Ghidra program that the GhidraScript will see as its "currentProgram".
168
+ :param script_args An optional list of arguments to pass to the GhidraScript.
167
169
:param echo_stdout: Whether or not to echo the GhidraScript's standard output.
168
170
:param echo_stderr: Whether or not to echo the GhidraScript's standard error.
169
171
:return: A 2 element tuple consisting of the GhidraScript's standard output and standard error.
@@ -192,6 +194,7 @@ def ghidra_script(
192
194
PrintWriter (stderr_string_writer , True ),
193
195
dummy_monitor ()
194
196
)
197
+ script .setScriptArgs (script_args )
195
198
script .execute (state , controls )
196
199
stdout_str = str (stdout_string_writer )
197
200
stderr_str = str (stderr_string_writer )
0 commit comments