mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 09:49:23 +02:00
GP-4308: Move PYTHONPATH stuff into Python.
This commit is contained in:
parent
bc24351495
commit
521fbb79ce
2 changed files with 41 additions and 23 deletions
|
@ -17,15 +17,4 @@
|
||||||
|
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
if exist "%GHIDRA_HOME%\ghidra\.git\" (
|
|
||||||
set PYTHONPATH=%GHIDRA_HOME%\ghidra\Ghidra\Debug\Debugger-agent-dbgeng\build\pypkg\src;%PYTHONPATH%
|
|
||||||
set PYTHONPATH=%GHIDRA_HOME%\ghidra\Ghidra\Debug\Debugger-rmi-trace\build\pypkg\src;%PYTHONPATH%
|
|
||||||
) else if exist "%GHIDRA_HOME%\.git\" (
|
|
||||||
set PYTHONPATH=%GHIDRA_HOME%\Ghidra\Debug\Debugger-agent-dbgeng\build\pypkg\src;%PYTHONPATH%
|
|
||||||
set PYTHONPATH=%GHIDRA_HOME%\Ghidra\Debug\Debugger-rmi-trace\build\pypkg\src;%PYTHONPATH%
|
|
||||||
) else (
|
|
||||||
set PYTHONPATH=%GHIDRA_HOME%\Ghidra\Debug\Debugger-agent-dbgeng\pypkg\src;%PYTHONPATH%
|
|
||||||
set PYTHONPATH=%GHIDRA_HOME%\Ghidra\Debug\Debugger-rmi-trace\pypkg\src;%PYTHONPATH%
|
|
||||||
)
|
|
||||||
|
|
||||||
"%OPT_PYTHON_EXE%" -i ..\support\local-dbgeng.py
|
"%OPT_PYTHON_EXE%" -i ..\support\local-dbgeng.py
|
||||||
|
|
|
@ -13,19 +13,48 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
##
|
##
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from ghidradbg.util import *
|
import sys
|
||||||
from ghidradbg.commands import *
|
|
||||||
|
|
||||||
ghidra_trace_connect(os.getenv('GHIDRA_TRACE_RMI_ADDR'))
|
|
||||||
args = os.getenv('OPT_TARGET_ARGS')
|
|
||||||
if args:
|
|
||||||
args = ' ' + args
|
|
||||||
ghidra_trace_create(os.getenv('OPT_TARGET_IMG') + args, start_trace=False)
|
|
||||||
ghidra_trace_start(os.getenv('OPT_TARGET_IMG'))
|
|
||||||
ghidra_trace_sync_enable()
|
|
||||||
|
|
||||||
# TODO: HACK
|
home = os.getenv('GHIDRA_HOME')
|
||||||
dbg.wait()
|
|
||||||
|
|
||||||
repl()
|
if os.path.isdir(f'{home}\\ghidra\\.git'):
|
||||||
|
sys.path.append(
|
||||||
|
f'{home}\\ghidra\\Ghidra\\Debug\\Debugger-agent-dbgeng\\build\\pypkg\\src')
|
||||||
|
sys.path.append(
|
||||||
|
f'{home}\\ghidra\\Ghidra\\Debug\\Debugger-rmi-trace\\build\\pypkg\\src')
|
||||||
|
elif os.path.isdir(f'{home}\\.git'):
|
||||||
|
sys.path.append(
|
||||||
|
f'{home}\\Ghidra\\Debug\\Debugger-agent-dbgeng\\build\\pypkg\\src')
|
||||||
|
sys.path.append(
|
||||||
|
f'{home}\\Ghidra\\Debug\\Debugger-rmi-trace\\build\\pypkg\\src')
|
||||||
|
else:
|
||||||
|
sys.path.append(
|
||||||
|
f'{home}\\Ghidra\\Debug\\Debugger-agent-dbgeng\\pypkg\\src')
|
||||||
|
sys.path.append(f'{home}\\Ghidra\\Debug\\Debugger-rmi-trace\\pypkg\\src')
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
# Delay these imports until sys.path is patched
|
||||||
|
from ghidradbg import commands as cmd
|
||||||
|
from ghidradbg.util import dbg
|
||||||
|
|
||||||
|
cmd.ghidra_trace_connect(os.getenv('GHIDRA_TRACE_RMI_ADDR'))
|
||||||
|
args = os.getenv('OPT_TARGET_ARGS')
|
||||||
|
if args:
|
||||||
|
args = ' ' + args
|
||||||
|
cmd.ghidra_trace_create(
|
||||||
|
os.getenv('OPT_TARGET_IMG') + args, start_trace=False)
|
||||||
|
cmd.ghidra_trace_start(os.getenv('OPT_TARGET_IMG'))
|
||||||
|
cmd.ghidra_trace_sync_enable()
|
||||||
|
|
||||||
|
# TODO: HACK
|
||||||
|
dbg.wait()
|
||||||
|
|
||||||
|
cmd.repl()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue