forked from NationalSecurityAgency/ghidra
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'NationalSecurityAgency:master' into master
- Loading branch information
Showing
165 changed files
with
3,567 additions
and
2,810 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
Ghidra/Configurations/Public_Release/src/global/docs/UserAgreement.html
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,7 @@ | ||
<HTML> | ||
<HEAD> | ||
<TITLE>Ghidra User Agreement</TITLE> | ||
</HEAD> | ||
|
||
<FONT SIZE="5"> | ||
|
||
|
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
56 changes: 56 additions & 0 deletions
56
Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/qemu-gdb.bat
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,56 @@ | ||
::@title qemu + gdb | ||
::@desc <html><body width="300px"> | ||
::@desc <h3>Launch with <tt>qemu</tt> and connect with <tt>gdb</tt></h3> | ||
::@desc <p> | ||
::@desc This will launch the target on the local machine using <tt>qemu</tt>. | ||
::@desc Then in a second terminal, it will connect <tt>gdb</tt> to QEMU's GDBstub. | ||
::@desc For setup instructions, press <b>F1</b>. | ||
::@desc </p> | ||
::@desc </body></html> | ||
::@menu-group cross | ||
::@icon icon.debugger | ||
::@help TraceRmiLauncherServicePlugin#gdb_qemu | ||
::@env OPT_TARGET_IMG:file="" "Image" "The target binary executable image" | ||
::@env OPT_TARGET_ARGS:str="" "Arguments" "Command-line arguments to pass to the target" | ||
::@env GHIDRA_LANG_EXTTOOL_qemu:file="" "QEMU command" "The path to qemu for the target architecture." | ||
::@env QEMU_GDB:int=1234 "QEMU Port" "Port for gdb connection to qemu" | ||
::@env OPT_EXTRA_QEMU_ARGS:str="" "Extra qemu arguments" "Extra arguments to pass to qemu. Use with care." | ||
::@env OPT_GDB_PATH:file="gdb-multiarch" "gdb command" "The path to gdb. Omit the full path to resolve using the system PATH." | ||
::@env OPT_EXTRA_TTY:bool=false "QEMU TTY" "Provide a separate terminal emulator for the target." | ||
|
||
@echo off | ||
set PYTHONPATH0=%GHIDRA_HOME%\Ghidra\Debug\Debugger-agent-gdb\pypkg\src | ||
set PYTHONPATH1=%GHIDRA_HOME%\Ghidra\Debug\Debugger-rmi-trace\pypkg\src | ||
IF EXIST %GHIDRA_HOME%\.git ( | ||
set PYTHONPATH0=%GHIDRA_HOME%\Ghidra\Debug\Debugger-agent-gdb\build\pypkg\src | ||
set PYTHONPATH1=%GHIDRA_HOME%\Ghidra\Debug\Debugger-rmi-trace\build\pypkg\src | ||
) | ||
IF EXIST %GHIDRA_HOME%\ghidra\.git ( | ||
set PYTHONPATH0=%GHIDRA_HOME%\ghidra\Ghidra\Debug\Debugger-agent-gdb\build\pypkg\src | ||
set PYTHONPATH1=%GHIDRA_HOME%\ghidra\Ghidra\Debug\Debugger-rmi-trace\build\pypkg\src | ||
) | ||
set PYTHONPATH=%PYTHONPATH1%;%PYTHONPATH0%;%PYTHONPATH% | ||
|
||
IF "%OPT_EXTRA_TTY%"=="true" ( | ||
start "qemu" "%GHIDRA_LANG_EXTTOOL_qemu%" %OPT_EXTRA_QEMU_ARGS% -gdb tcp::%QEMU_GDB% -S "%OPT_TARGET_IMG%" %OPT_TARGET_ARGS% | ||
) ELSE ( | ||
start /B "qemu" "%GHIDRA_LANG_EXTTOOL_qemu%" %OPT_EXTRA_QEMU_ARGS% -gdb tcp::%QEMU_GDB% -S "%OPT_TARGET_IMG%" %OPT_TARGET_ARGS% | ||
) | ||
|
||
:: Give QEMU a moment to open the socket | ||
powershell -nop -c "& {sleep -m 100}" | ||
|
||
"%OPT_GDB_PATH%" ^ | ||
-q ^ | ||
-ex "set pagination off" ^ | ||
-ex "set confirm off" ^ | ||
-ex "show version" ^ | ||
-ex "python import ghidragdb" ^ | ||
-ex "target exec '%OPT_TARGET_IMG%'" ^ | ||
-ex "set args %OPT_TARGET_ARGS%" ^ | ||
-ex "ghidra trace connect '%GHIDRA_TRACE_RMI_ADDR%'" ^ | ||
-ex "ghidra trace start" ^ | ||
-ex "ghidra trace sync-enable" ^ | ||
-ex "target remote localhost:%QEMU_GDB%" ^ | ||
-ex "set confirm on" ^ | ||
-ex "set pagination on" |
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
41 changes: 41 additions & 0 deletions
41
Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/raw-gdb.bat
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,41 @@ | ||
::@title raw gdb | ||
::@no-image | ||
::@desc <html><body width="300px"> | ||
::@desc <h3>Start <tt>gdb</tt></h3> | ||
::@desc <p> | ||
::@desc This will start <tt>gdb</tt> and connect to it. | ||
::@desc It will not launch a target, so you can (must) set up your target manually. | ||
::@desc For setup instructions, press <b>F1</b>. | ||
::@desc </p> | ||
::@desc </body></html> | ||
::@menu-group raw | ||
::@icon icon.debugger | ||
::@help TraceRmiLauncherServicePlugin#gdb_raw | ||
::@env OPT_GDB_PATH:file="gdb" "gdb command" "The path to gdb. Omit the full path to resolve using the system PATH." | ||
::@env OPT_ARCH:str="i386:x86-64" "Architecture" "Target architecture" | ||
|
||
@echo off | ||
set PYTHONPATH0=%GHIDRA_HOME%\Ghidra\Debug\Debugger-agent-gdb\pypkg\src | ||
set PYTHONPATH1=%GHIDRA_HOME%\Ghidra\Debug\Debugger-rmi-trace\pypkg\src | ||
IF EXIST %GHIDRA_HOME%\.git ( | ||
set PYTHONPATH0=%GHIDRA_HOME%\Ghidra\Debug\Debugger-agent-gdb\build\pypkg\src | ||
set PYTHONPATH1=%GHIDRA_HOME%\Ghidra\Debug\Debugger-rmi-trace\build\pypkg\src | ||
) | ||
IF EXIST %GHIDRA_HOME%\ghidra\.git ( | ||
set PYTHONPATH0=%GHIDRA_HOME%\ghidra\Ghidra\Debug\Debugger-agent-gdb\build\pypkg\src | ||
set PYTHONPATH1=%GHIDRA_HOME%\ghidra\Ghidra\Debug\Debugger-rmi-trace\build\pypkg\src | ||
) | ||
set PYTHONPATH=%PYTHONPATH1%;%PYTHONPATH0%;%PYTHONPATH% | ||
|
||
"%OPT_GDB_PATH%" ^ | ||
-q ^ | ||
-ex "set pagination off" ^ | ||
-ex "set confirm off" ^ | ||
-ex "show version" ^ | ||
-ex "python import ghidragdb" ^ | ||
-ex "set architecture %OPT_ARCH%" ^ | ||
-ex "ghidra trace connect '%GHIDRA_TRACE_RMI_ADDR%'" ^ | ||
-ex "ghidra trace start" ^ | ||
-ex "ghidra trace sync-enable" ^ | ||
-ex "set confirm on" ^ | ||
-ex "set pagination on" |
53 changes: 53 additions & 0 deletions
53
Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/remote-gdb.bat
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,53 @@ | ||
::@title remote gdb | ||
::@no-image | ||
::@desc <html><body width="300px"> | ||
::@desc <h3>Launch with local <tt>gdb</tt> and connect to a stub (e.g., <tt>gdbserver</tt>)</h3> | ||
::@desc <p> | ||
::@desc This will start <tt>gdb</tt> on the local system and then use it to connect to the remote system. | ||
::@desc For setup instructions, press <b>F1</b>. | ||
::@desc </p> | ||
::@desc </body></html> | ||
::@menu-group remote | ||
::@icon icon.debugger | ||
::@help TraceRmiLauncherServicePlugin#gdb_remote | ||
::@enum TargetType:str remote extended-remote | ||
::@env OPT_TARGET_TYPE:TargetType="remote" "Target" "The type of remote target" | ||
::@env OPT_HOST:str="localhost" "Host" "The hostname of the target" | ||
::@env OPT_PORT:int=9999 "Port" "The host's listening port" | ||
::@env OPT_ARCH:str="" "Architecture (optional)" "Target architecture override" | ||
::@env OPT_GDB_PATH:file="gdb" "gdb command" "The path to gdb on the local system. Omit the full path to resolve using the system PATH." | ||
|
||
@echo off | ||
set PYTHONPATH0=%GHIDRA_HOME%\Ghidra\Debug\Debugger-agent-gdb\pypkg\src | ||
set PYTHONPATH1=%GHIDRA_HOME%\Ghidra\Debug\Debugger-rmi-trace\pypkg\src | ||
IF EXIST %GHIDRA_HOME%\.git ( | ||
set PYTHONPATH0=%GHIDRA_HOME%\Ghidra\Debug\Debugger-agent-gdb\build\pypkg\src | ||
set PYTHONPATH1=%GHIDRA_HOME%\Ghidra\Debug\Debugger-rmi-trace\build\pypkg\src | ||
) | ||
IF EXIST %GHIDRA_HOME%\ghidra\.git ( | ||
set PYTHONPATH0=%GHIDRA_HOME%\ghidra\Ghidra\Debug\Debugger-agent-gdb\build\pypkg\src | ||
set PYTHONPATH1=%GHIDRA_HOME%\ghidra\Ghidra\Debug\Debugger-rmi-trace\build\pypkg\src | ||
) | ||
set PYTHONPATH=%PYTHONPATH1%;%PYTHONPATH0%;%PYTHONPATH% | ||
|
||
IF "%OPT_ARCH%"=="" ( | ||
set archcmd= | ||
) ELSE ( | ||
set archcmd=-ex "set arch %OPT_ARCH%" | ||
) | ||
|
||
"%OPT_GDB_PATH%" ^ | ||
-q ^ | ||
-ex "set pagination off" ^ | ||
-ex "set confirm off" ^ | ||
-ex "show version" ^ | ||
-ex "python import ghidragdb" ^ | ||
%archcmd% ^ | ||
-ex "echo Connecting to %OPT_HOST%:%OPT_PORT%... " ^ | ||
-ex "target %OPT_TARGET_TYPE% %OPT_HOST%:%OPT_PORT%" ^ | ||
-ex "ghidra trace connect '%GHIDRA_TRACE_RMI_ADDR%'" ^ | ||
-ex "ghidra trace start" ^ | ||
-ex "ghidra trace sync-enable" ^ | ||
-ex "ghidra trace sync-synth-stopped" ^ | ||
-ex "set confirm on" ^ | ||
-ex "set pagination on" |
39 changes: 39 additions & 0 deletions
39
Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/ssh-gdb.bat
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,39 @@ | ||
::@timeout 60000 | ||
::@title gdb via ssh | ||
::@desc <html><body width="300px"> | ||
::@desc <h3>Launch with <tt>gdb</tt> via <tt>ssh</tt></h3> | ||
::@desc <p> | ||
::@desc This will launch the target on a remote machine using <tt>gdb</tt> via <tt>ssh</tt>. | ||
::@desc For setup instructions, press <b>F1</b>. | ||
::@desc </p> | ||
::@desc </body></html> | ||
::@menu-group remote | ||
::@icon icon.debugger | ||
::@help TraceRmiLauncherServicePlugin#gdb_ssh | ||
::@enum StartCmd:str run start starti | ||
::@env OPT_TARGET_IMG:str="" "Image" "The target binary executable image on the remote system" | ||
::@env OPT_TARGET_ARGS:str="" "Arguments" "Command-line arguments to pass to the target" | ||
::@env OPT_SSH_PATH:file="ssh" "ssh command" "The path to ssh on the local system. Omit the full path to resolve using the system PATH." | ||
::@env OPT_HOST:str="localhost" "[User@]Host" "The hostname or user@host" | ||
::@env OPT_REMOTE_PORT:int=12345 "Remote Trace RMI Port" "A free port on the remote end to receive and forward the Trace RMI connection." | ||
::@env OPT_EXTRA_SSH_ARGS:str="" "Extra ssh arguments" "Extra arguments to pass to ssh. Use with care." | ||
::@env OPT_GDB_PATH:str="gdb" "gdb command" "The path to gdb on the remote system. Omit the full path to resolve using the system PATH." | ||
::@env OPT_START_CMD:StartCmd="starti" "Run command" "The gdb command to actually run the target." | ||
|
||
@echo off | ||
set cmd=TERM='%TERM%' '%OPT_GDB_PATH%' ^ | ||
-q ^ | ||
-ex 'set pagination off' ^ | ||
-ex 'set confirm off' ^ | ||
-ex 'show version' ^ | ||
-ex 'python import ghidragdb' ^ | ||
-ex 'file \"%OPT_TARGET_IMG%\"' ^ | ||
-ex 'set args %OPT_TARGET_ARGS%' ^ | ||
-ex 'ghidra trace connect \"localhost:%OPT_REMOTE_PORT%\"' ^ | ||
-ex 'ghidra trace start' ^ | ||
-ex 'ghidra trace sync-enable' ^ | ||
-ex '%OPT_START_CMD%' ^ | ||
-ex 'set confirm on' ^ | ||
-ex 'set pagination on' | ||
|
||
"%OPT_SSH_PATH%" "-R%OPT_REMOTE_PORT%:%GHIDRA_TRACE_RMI_ADDR%" -t %OPT_EXTRA_SSH_ARGS% "%OPT_HOST%" "%cmd%" |
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
Oops, something went wrong.