mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-20 19:01:35 +08:00
GP-5700: Expose module directories to scripts on request
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
::@menu-group dbgeng
|
||||
::@icon icon.debugger
|
||||
::@help dbgeng#win_kernel
|
||||
::@depends Debugger-rmi-trace
|
||||
::@enum Connection:str Remote Local EXDI
|
||||
::@env OPT_PYTHON_EXE:file!="python" "Python command" "The path to the Python 3 interpreter. Omit the full path to resolve using the system PATH."
|
||||
:: Use env instead of args, because "all args except first" is terrible to implement in batch
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
::@menu-group dbgeng
|
||||
::@icon icon.debugger
|
||||
::@help dbgeng#attach
|
||||
::@depends Debugger-rmi-trace
|
||||
::@env OPT_PYTHON_EXE:file!="python" "Python command" "The path to the Python 3 interpreter. Omit the full path to resolve using the system PATH."
|
||||
::@env OPT_TARGET_PID:int=0 "Process id" "The target process id"
|
||||
::@env OPT_ATTACH_FLAGS:int=0 "Attach flags" "Attach flags"
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
::@menu-group dbgeng
|
||||
::@icon icon.debugger
|
||||
::@help dbgeng#ext
|
||||
::@depends Debugger-rmi-trace
|
||||
::@env OPT_PYTHON_EXE:file!="python" "Python command" "The path to the Python 3 interpreter. Omit the full path to resolve using the system PATH."
|
||||
:: Use env instead of args, because "all args except first" is terrible to implement in batch
|
||||
::@env OPT_TARGET_IMG:file="" "Image" "The target binary executable image"
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
::@menu-group dbgeng
|
||||
::@icon icon.debugger
|
||||
::@help dbgeng#ttd
|
||||
::@depends Debugger-rmi-trace
|
||||
::@env OPT_PYTHON_EXE:file!="python" "Python command" "The path to the Python 3 interpreter. Omit the full path to resolve using the system PATH."
|
||||
:: Use env instead of args, because "all args except first" is terrible to implement in batch
|
||||
::@env OPT_TARGET_TRACE:file="" "Trace (.run)" "The target trace image"
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
::@menu-group dbgeng
|
||||
::@icon icon.debugger
|
||||
::@help dbgeng#local
|
||||
::@depends Debugger-rmi-trace
|
||||
::@env OPT_PYTHON_EXE:file!="python" "Python command" "The path to the Python 3 interpreter. Omit the full path to resolve using the system PATH."
|
||||
:: Use env instead of args, because "all args except first" is terrible to implement in batch
|
||||
::@env OPT_TARGET_IMG:file="" "Image" "The target binary executable image"
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
::@menu-group dbgeng
|
||||
::@icon icon.debugger
|
||||
::@help dbgeng#remote
|
||||
::@depends Debugger-rmi-trace
|
||||
::@env OPT_PYTHON_EXE:file!="python" "Python command" "The path to the Python 3 interpreter. Omit the full path to resolve using the system PATH."
|
||||
::@env OPT_CONNECT_STRING:str="" "Connection" "Connection-string arguments (a la .server)"
|
||||
::@env WINDBG_DIR:dir="" "Path to dbgeng.dll directory" "Path containing dbgeng and associated DLLS (if not Windows Kits)."
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
::@menu-group dbgeng
|
||||
::@icon icon.debugger
|
||||
::@help dbgeng#svrcx
|
||||
::@depends Debugger-rmi-trace
|
||||
::@env OPT_PYTHON_EXE:file!="python" "Python command" "The path to the Python 3 interpreter. Omit the full path to resolve using the system PATH."
|
||||
:: Use env instead of args, because "all args except first" is terrible to implement in batch
|
||||
::@env OPT_TARGET_IMG:str="" "Image" "The target binary executable image"
|
||||
|
||||
@@ -19,10 +19,11 @@ import sys
|
||||
|
||||
|
||||
def append_paths():
|
||||
sys.path.append("../../../Debugger-rmi-trace/data/support")
|
||||
sys.path.append(
|
||||
f"{os.getenv('MODULE_Debugger_rmi_trace_HOME')}/data/support")
|
||||
from gmodutils import ghidra_module_pypath
|
||||
sys.path.append(ghidra_module_pypath("Debug/Debugger-rmi-trace"))
|
||||
sys.path.append(ghidra_module_pypath("Debug/Debugger-agent-dbgeng"))
|
||||
sys.path.append(ghidra_module_pypath("Debugger-rmi-trace"))
|
||||
sys.path.append(ghidra_module_pypath())
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -19,10 +19,11 @@ import sys
|
||||
|
||||
|
||||
def append_paths():
|
||||
sys.path.append("../../../Debugger-rmi-trace/data/support")
|
||||
sys.path.append(
|
||||
f"{os.getenv('MODULE_Debugger_rmi_trace_HOME')}/data/support")
|
||||
from gmodutils import ghidra_module_pypath
|
||||
sys.path.append(ghidra_module_pypath("Debug/Debugger-rmi-trace"))
|
||||
sys.path.append(ghidra_module_pypath("Debug/Debugger-agent-dbgeng"))
|
||||
sys.path.append(ghidra_module_pypath("Debugger-rmi-trace"))
|
||||
sys.path.append(ghidra_module_pypath())
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -19,10 +19,11 @@ import sys
|
||||
|
||||
|
||||
def append_paths():
|
||||
sys.path.append("../../../Debugger-rmi-trace/data/support")
|
||||
sys.path.append(
|
||||
f"{os.getenv('MODULE_Debugger_rmi_trace_HOME')}/data/support")
|
||||
from gmodutils import ghidra_module_pypath
|
||||
sys.path.append(ghidra_module_pypath("Debug/Debugger-rmi-trace"))
|
||||
sys.path.append(ghidra_module_pypath("Debug/Debugger-agent-dbgeng"))
|
||||
sys.path.append(ghidra_module_pypath("Debugger-rmi-trace"))
|
||||
sys.path.append(ghidra_module_pypath())
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -19,10 +19,11 @@ import sys
|
||||
|
||||
|
||||
def append_paths():
|
||||
sys.path.append("../../../Debugger-rmi-trace/data/support")
|
||||
sys.path.append(
|
||||
f"{os.getenv('MODULE_Debugger_rmi_trace_HOME')}/data/support")
|
||||
from gmodutils import ghidra_module_pypath
|
||||
sys.path.append(ghidra_module_pypath("Debug/Debugger-rmi-trace"))
|
||||
sys.path.append(ghidra_module_pypath("Debug/Debugger-agent-dbgeng"))
|
||||
sys.path.append(ghidra_module_pypath("Debugger-rmi-trace"))
|
||||
sys.path.append(ghidra_module_pypath())
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -19,10 +19,11 @@ import sys
|
||||
|
||||
|
||||
def append_paths():
|
||||
sys.path.append("../../../Debugger-rmi-trace/data/support")
|
||||
sys.path.append(
|
||||
f"{os.getenv('MODULE_Debugger_rmi_trace_HOME')}/data/support")
|
||||
from gmodutils import ghidra_module_pypath
|
||||
sys.path.append(ghidra_module_pypath("Debug/Debugger-rmi-trace"))
|
||||
sys.path.append(ghidra_module_pypath("Debug/Debugger-agent-dbgeng"))
|
||||
sys.path.append(ghidra_module_pypath("Debugger-rmi-trace"))
|
||||
sys.path.append(ghidra_module_pypath())
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -19,10 +19,11 @@ import sys
|
||||
|
||||
|
||||
def append_paths():
|
||||
sys.path.append("../../../Debugger-rmi-trace/data/support")
|
||||
sys.path.append(
|
||||
f"{os.getenv('MODULE_Debugger_rmi_trace_HOME')}/data/support")
|
||||
from gmodutils import ghidra_module_pypath
|
||||
sys.path.append(ghidra_module_pypath("Debug/Debugger-rmi-trace"))
|
||||
sys.path.append(ghidra_module_pypath("Debug/Debugger-agent-dbgeng"))
|
||||
sys.path.append(ghidra_module_pypath("Debugger-rmi-trace"))
|
||||
sys.path.append(ghidra_module_pypath())
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -21,10 +21,11 @@ import sys
|
||||
|
||||
|
||||
def append_paths():
|
||||
sys.path.append("../../../Debugger-rmi-trace/data/support")
|
||||
sys.path.append(
|
||||
f"{os.getenv('MODULE_Debugger_rmi_trace_HOME')}/data/support")
|
||||
from gmodutils import ghidra_module_pypath
|
||||
sys.path.append(ghidra_module_pypath("Debug/Debugger-rmi-trace"))
|
||||
sys.path.append(ghidra_module_pypath("Debug/Debugger-agent-dbgeng"))
|
||||
sys.path.append(ghidra_module_pypath("Debugger-rmi-trace"))
|
||||
sys.path.append(ghidra_module_pypath())
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -19,10 +19,11 @@ import sys
|
||||
|
||||
|
||||
def append_paths():
|
||||
sys.path.append("../../../Debugger-rmi-trace/data/support")
|
||||
sys.path.append(
|
||||
f"{os.getenv('MODULE_Debugger_rmi_trace_HOME')}/data/support")
|
||||
from gmodutils import ghidra_module_pypath
|
||||
sys.path.append(ghidra_module_pypath("Debug/Debugger-rmi-trace"))
|
||||
sys.path.append(ghidra_module_pypath("Debug/Debugger-agent-dbgeng"))
|
||||
sys.path.append(ghidra_module_pypath("Debugger-rmi-trace"))
|
||||
sys.path.append(ghidra_module_pypath())
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -18,7 +18,7 @@ try:
|
||||
import pybag
|
||||
except Exception as e:
|
||||
from ghidratrace.setuputils import prompt_and_mitigate_dependencies
|
||||
prompt_and_mitigate_dependencies("Debug/Debugger-agent-dbgeng")
|
||||
prompt_and_mitigate_dependencies("<SELF>")
|
||||
|
||||
# NOTE: libraries must precede EVERYTHING, esp pybag and DbgMod
|
||||
from . import libraries, util, commands, methods, hooks
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#@menu-group drgn
|
||||
#@icon icon.debugger
|
||||
#@help drgn#core
|
||||
#@depends Debugger-rmi-trace
|
||||
#@env OPT_TARGET_IMG:file!="" "Core dump" "The target core dump"
|
||||
|
||||
export OPT_TARGET_KIND="coredump"
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#@menu-group drgn
|
||||
#@icon icon.debugger
|
||||
#@help drgn#linux_kernel
|
||||
#@depends Debugger-rmi-trace
|
||||
|
||||
export OPT_TARGET_KIND="kernel"
|
||||
sudo -E drgn ../support/local-drgn.py
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#@menu-group drgn
|
||||
#@icon icon.debugger
|
||||
#@help drgn#attach
|
||||
#@depends Debugger-rmi-trace
|
||||
#@env OPT_TARGET_PID:int=44068 "PID" "The target's process id"
|
||||
|
||||
export OPT_TARGET_KIND="user"
|
||||
|
||||
@@ -22,25 +22,18 @@ import sys
|
||||
|
||||
import drgn.cli
|
||||
|
||||
home = os.getenv('GHIDRA_HOME')
|
||||
|
||||
if os.path.isdir(f'{home}/ghidra/.git'):
|
||||
def append_paths():
|
||||
sys.path.append(
|
||||
f'{home}/ghidra/Ghidra/Debug/Debugger-agent-drgn/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-drgn/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-drgn/pypkg/src')
|
||||
sys.path.append(f'{home}/Ghidra/Debug/Debugger-rmi-trace/pypkg/src')
|
||||
f"{os.getenv('MODULE_Debugger_rmi_trace_HOME')}/data/support")
|
||||
from gmodutils import ghidra_module_pypath
|
||||
sys.path.append(ghidra_module_pypath("Debugger-rmi-trace"))
|
||||
sys.path.append(ghidra_module_pypath())
|
||||
|
||||
|
||||
def main():
|
||||
append_paths()
|
||||
|
||||
from ghidradrgn import commands as cmd
|
||||
cmd.ghidra_trace_connect(address=os.getenv('GHIDRA_TRACE_RMI_ADDR'))
|
||||
cmd.ghidra_trace_create(start_trace=True)
|
||||
@@ -49,9 +42,7 @@ def main():
|
||||
cmd.ghidra_trace_txcommit()
|
||||
cmd.ghidra_trace_activate()
|
||||
drgn.cli.run_interactive(cmd.prog)
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#@menu-group gdb
|
||||
#@icon icon.debugger
|
||||
#@help gdb#local
|
||||
#@depends Debugger-rmi-trace
|
||||
#@enum StartCmd:str run start starti
|
||||
#@enum Endian:str auto big little
|
||||
#@arg :file "Image" "The target binary executable image"
|
||||
@@ -21,8 +22,8 @@
|
||||
|
||||
. ..\support\gdbsetuputils.ps1
|
||||
|
||||
$pypathTrace = Ghidra-Module-PyPath "Debug/Debugger-rmi-trace"
|
||||
$pypathGdb = Ghidra-Module-PyPath "Debug/Debugger-agent-gdb"
|
||||
$pypathTrace = Ghidra-Module-PyPath "Debugger-rmi-trace"
|
||||
$pypathGdb = Ghidra-Module-PyPath
|
||||
$Env:PYTHONPATH = "$pypathGdb;$pypathTrace;$Env:PYTHONPATH"
|
||||
|
||||
$arglist = Compute-Gdb-Usermode-Args `
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#@menu-group gdb
|
||||
#@icon icon.debugger
|
||||
#@help gdb#local
|
||||
#@depends Debugger-rmi-trace
|
||||
#@enum StartCmd:str run start starti
|
||||
#@enum Endian:str auto big little
|
||||
#@arg :file "Image" "The target binary executable image, empty for no target"
|
||||
@@ -39,8 +40,8 @@
|
||||
|
||||
. ../support/gdbsetuputils.sh
|
||||
|
||||
pypathTrace=$(ghidra-module-pypath "Debug/Debugger-rmi-trace")
|
||||
pypathGdb=$(ghidra-module-pypath "Debug/Debugger-agent-gdb")
|
||||
pypathTrace=$(ghidra-module-pypath "Debugger-rmi-trace")
|
||||
pypathGdb=$(ghidra-module-pypath)
|
||||
export PYTHONPATH=$pypathGdb:$pypathTrace:$PYTHONPATH
|
||||
|
||||
target_image="$1"
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#@menu-group gdb
|
||||
#@icon icon.debugger
|
||||
#@help gdb#rr
|
||||
#@depends Debugger-rmi-trace
|
||||
#@enum StartCmd:str run start starti
|
||||
#@enum Endian:str auto big little
|
||||
#@arg :file "Trace Dir" "The target trace directory (e.g. .local/share/rr/trace)"
|
||||
@@ -36,8 +37,8 @@
|
||||
|
||||
. ../support/gdbsetuputils.sh
|
||||
|
||||
pypathTrace=$(ghidra-module-pypath "Debug/Debugger-rmi-trace")
|
||||
pypathGdb=$(ghidra-module-pypath "Debug/Debugger-agent-gdb")
|
||||
pypathTrace=$(ghidra-module-pypath "Debugger-rmi-trace")
|
||||
pypathGdb=$(ghidra-module-pypath)
|
||||
export PYTHONPATH=$pypathGdb:$pypathTrace:$PYTHONPATH
|
||||
|
||||
target_trace="$1"
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#@menu-group gdb
|
||||
#@icon icon.debugger
|
||||
#@help gdb#qemu
|
||||
#@depends Debugger-rmi-trace
|
||||
#@enum Endian:str auto big little
|
||||
#@arg :file! "Image" "The target binary executable image"
|
||||
#@args "Arguments" "Command-line arguments to pass to the target"
|
||||
@@ -42,8 +43,8 @@
|
||||
|
||||
. ../support/gdbsetuputils.sh
|
||||
|
||||
pypathTrace=$(ghidra-module-pypath "Debug/Debugger-rmi-trace")
|
||||
pypathGdb=$(ghidra-module-pypath "Debug/Debugger-agent-gdb")
|
||||
pypathTrace=$(ghidra-module-pypath "Debugger-rmi-trace")
|
||||
pypathGdb=$(ghidra-module-pypath)
|
||||
export PYTHONPATH=$pypathGdb:$pypathTrace:$PYTHONPATH
|
||||
|
||||
target_image="$1"
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#@menu-group gdb
|
||||
#@icon icon.debugger
|
||||
#@help gdb#qemu
|
||||
#@depends Debugger-rmi-trace
|
||||
#@enum Endian:str auto big little
|
||||
#@env OPT_TARGET_IMG:file!="" "Image" "The target binary executable image"
|
||||
#@env GHIDRA_LANG_EXTTOOL_qemu_system:file="" "QEMU command" "The path to qemu-system for the target architecture."
|
||||
@@ -23,8 +24,8 @@
|
||||
|
||||
. ..\support\gdbsetuputils.ps1
|
||||
|
||||
$pypathTrace = Ghidra-Module-PyPath "Debug/Debugger-rmi-trace"
|
||||
$pypathGdb = Ghidra-Module-PyPath "Debug/Debugger-agent-gdb"
|
||||
$pypathTrace = Ghidra-Module-PyPath "Debugger-rmi-trace"
|
||||
$pypathGdb = Ghidra-Module-PyPath
|
||||
$Env:PYTHONPATH = "$pypathGdb;$pypathTrace;$Env:PYTHONPATH"
|
||||
|
||||
$qemuargs = @("`"$Env:GHIDRA_LANG_EXTTOOL_qemu_system`"")
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#@menu-group gdb
|
||||
#@icon icon.debugger
|
||||
#@help gdb#qemu
|
||||
#@depends Debugger-rmi-trace
|
||||
#@enum Endian:str auto big little
|
||||
#@arg :file! "Image" "The target binary executable image"
|
||||
#@env GHIDRA_LANG_EXTTOOL_qemu_system:file="" "QEMU command" "The path to qemu-system for the target architecture."
|
||||
@@ -41,8 +42,8 @@
|
||||
|
||||
. ../support/gdbsetuputils.sh
|
||||
|
||||
pypathTrace=$(ghidra-module-pypath "Debug/Debugger-rmi-trace")
|
||||
pypathGdb=$(ghidra-module-pypath "Debug/Debugger-agent-gdb")
|
||||
pypathTrace=$(ghidra-module-pypath "Debugger-rmi-trace")
|
||||
pypathGdb=$(ghidra-module-pypath)
|
||||
export PYTHONPATH=$pypathGdb:$pypathTrace:$PYTHONPATH
|
||||
|
||||
target_image="$1"
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#@menu-group gdb
|
||||
#@icon icon.debugger
|
||||
#@help gdb#remote
|
||||
#@depends Debugger-rmi-trace
|
||||
#@enum TargetType:str remote extended-remote
|
||||
#@enum Endian:str auto big little
|
||||
#@arg :file "Image" "The target binary executable image (a copy on the local system)"
|
||||
@@ -22,8 +23,8 @@
|
||||
|
||||
. ..\support\gdbsetuputils.ps1
|
||||
|
||||
$pypathTrace = Ghidra-Module-PyPath "Debug/Debugger-rmi-trace"
|
||||
$pypathGdb = Ghidra-Module-PyPath "Debug/Debugger-agent-gdb"
|
||||
$pypathTrace = Ghidra-Module-PyPath "Debugger-rmi-trace"
|
||||
$pypathGdb = Ghidra-Module-PyPath
|
||||
$Env:PYTHONPATH = "$pypathGdb;$pypathTrace;$Env:PYTHONPATH"
|
||||
|
||||
$arglist = Compute-Gdb-Remote-Args `
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#@menu-group gdb
|
||||
#@icon icon.debugger
|
||||
#@help gdb#remote
|
||||
#@depends Debugger-rmi-trace
|
||||
#@enum TargetType:str remote extended-remote
|
||||
#@enum Endian:str auto big little
|
||||
#@arg :file "Image" "The target binary executable image (a copy on the local system)"
|
||||
@@ -38,8 +39,8 @@
|
||||
|
||||
. ../support/gdbsetuputils.sh
|
||||
|
||||
pypathTrace=$(ghidra-module-pypath "Debug/Debugger-rmi-trace")
|
||||
pypathGdb=$(ghidra-module-pypath "Debug/Debugger-agent-gdb")
|
||||
pypathTrace=$(ghidra-module-pypath "Debugger-rmi-trace")
|
||||
pypathGdb=$(ghidra-module-pypath)
|
||||
export PYTHONPATH=$pypathGdb:$pypathTrace:$PYTHONPATH
|
||||
|
||||
target_image="$1"
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#@timeout 60000
|
||||
#@title gdb via ssh
|
||||
#@image-opt arg:1
|
||||
#@desc <html><body width="300px">
|
||||
@@ -11,6 +10,7 @@
|
||||
#@menu-group gdb
|
||||
#@icon icon.debugger
|
||||
#@help gdb#ssh
|
||||
#@depends Debugger-rmi-trace
|
||||
#@enum StartCmd:str run start starti
|
||||
#@enum Endian:str auto big little
|
||||
#@arg :str "Image" "The target binary executable image on the remote system"
|
||||
@@ -61,7 +61,7 @@ finished, try launching again.
|
||||
|
||||
if ($answer) {
|
||||
Write-Host "Copying Wheels to $Env:OPT_HOST"
|
||||
Mitigate-Scp-PyModules "Debug/Debugger-rmi-trace" "Debug/Debugger-agent-gdb"
|
||||
Mitigate-Scp-PyModules "Debugger-rmi-trace" "<SELF>"
|
||||
|
||||
Write-Host "Installing Wheels into GDB's embedded Python"
|
||||
$arglist = Compute-Gdb-PipInstall-Args "'-f'" "os.environ['HOME']" "'ghidragdb>=$version'"
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
##
|
||||
#@timeout 60000
|
||||
#@title gdb via ssh
|
||||
#@image-opt arg:1
|
||||
#@desc <html><body width="300px">
|
||||
@@ -27,6 +26,7 @@
|
||||
#@menu-group gdb
|
||||
#@icon icon.debugger
|
||||
#@help gdb#ssh
|
||||
#@depends Debugger-rmi-trace
|
||||
#@enum StartCmd:str run start starti
|
||||
#@enum Endian:str auto big little
|
||||
#@arg :str "Image" "The target binary executable image on the remote system"
|
||||
@@ -93,7 +93,7 @@ finished, try launching again.
|
||||
" "Would you like to install 'ghidragdb>=$version'?"; then
|
||||
|
||||
echo "Copying Wheels to $OPT_HOST"
|
||||
mitigate-scp-pymodules "Debug/Debugger-rmi-trace" "Debug/Debugger-agent-gdb"
|
||||
mitigate-scp-pymodules "Debugger-rmi-trace" "<SELF>"
|
||||
|
||||
echo "Installing Wheels into GDB's embedded Python"
|
||||
do-installation
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#@timeout 60000
|
||||
#@title gdb + gdbserver via ssh
|
||||
#@image-opt arg:1
|
||||
#@desc <html><body width="300px">
|
||||
@@ -11,6 +10,7 @@
|
||||
#@menu-group gdb
|
||||
#@icon icon.debugger
|
||||
#@help gdb#gdbserver_ssh
|
||||
#@depends Debugger-rmi-trace
|
||||
#@enum Endian:str auto big little
|
||||
#@arg :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"
|
||||
@@ -25,8 +25,8 @@
|
||||
|
||||
. ..\support\gdbsetuputils.ps1
|
||||
|
||||
$pypathTrace = Ghidra-Module-PyPath "Debug/Debugger-rmi-trace"
|
||||
$pypathGdb = Ghidra-Module-PyPath "Debug/Debugger-agent-gdb"
|
||||
$pypathTrace = Ghidra-Module-PyPath "Debugger-rmi-trace"
|
||||
$pypathGdb = Ghidra-Module-PyPath
|
||||
$Env:PYTHONPATH = "$pypathGdb;$pypathTrace;$Env:PYTHONPATH"
|
||||
|
||||
$arglist = Compute-Gdb-Remote-Args `
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
##
|
||||
#@timeout 60000
|
||||
#@title gdb + gdbserver via ssh
|
||||
#@image-opt arg:1
|
||||
#@desc <html><body width="300px">
|
||||
@@ -27,6 +26,7 @@
|
||||
#@menu-group gdb
|
||||
#@icon icon.debugger
|
||||
#@help gdb#gdbserver_ssh
|
||||
#@depends Debugger-rmi-trace
|
||||
#@enum Endian:str auto big little
|
||||
#@arg :str! "Image" "The target binary executable image on the remote system"
|
||||
#@args "Arguments" "Command-line arguments to pass to the target"
|
||||
@@ -41,8 +41,8 @@
|
||||
|
||||
. ../support/gdbsetuputils.sh
|
||||
|
||||
pypathTrace=$(ghidra-module-pypath "Debug/Debugger-rmi-trace")
|
||||
pypathGdb=$(ghidra-module-pypath "Debug/Debugger-agent-gdb")
|
||||
pypathTrace=$(ghidra-module-pypath "Debugger-rmi-trace")
|
||||
pypathGdb=$(ghidra-module-pypath)
|
||||
export PYTHONPATH=$pypathGdb:$pypathTrace:$PYTHONPATH
|
||||
|
||||
target_image="$1"
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#@menu-group gdb
|
||||
#@icon icon.debugger
|
||||
#@help gdb#wine
|
||||
#@depends Debugger-rmi-trace
|
||||
#@enum Endian:str auto big little
|
||||
#@arg :file! "Image" "The target binary executable image"
|
||||
#@args "Arguments" "Command-line arguments to pass to the target"
|
||||
@@ -39,8 +40,8 @@
|
||||
|
||||
. ../support/gdbsetuputils.sh
|
||||
|
||||
pypathTrace=$(ghidra-module-pypath "Debug/Debugger-rmi-trace")
|
||||
pypathGdb=$(ghidra-module-pypath "Debug/Debugger-agent-gdb")
|
||||
pypathTrace=$(ghidra-module-pypath "Debugger-rmi-trace")
|
||||
pypathGdb=$(ghidra-module-pypath)
|
||||
export PYTHONPATH=$pypathGdb:$pypathTrace:$PYTHONPATH
|
||||
|
||||
target_image="$1"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
. ..\..\..\Debugger-rmi-trace\data\support\setuputils.ps1
|
||||
. $Env:MODULE_Debugger_rmi_trace_HOME\data\support\setuputils.ps1
|
||||
|
||||
function Add-Gdb-Init-Args {
|
||||
param([ref]$ArgList)
|
||||
@@ -48,7 +48,7 @@ function Add-Gdb-Tail-Args {
|
||||
param([ref]$ArgList)
|
||||
|
||||
$ArgList.Value+=("-ex", "`"set confirm on`"")
|
||||
$ArgList.Value+=("-ex", "`"set pagination on`"")
|
||||
# $ArgList.Value+=("-ex", "`"set pagination on`"")
|
||||
}
|
||||
|
||||
function Compute-Gdb-Usermode-Args {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
##
|
||||
. ../../../Debugger-rmi-trace/data/support/setuputils.sh
|
||||
. $MODULE_Debugger_rmi_trace_HOME/data/support/setuputils.sh
|
||||
|
||||
add-gdb-init-args() {
|
||||
args+=(-q)
|
||||
@@ -64,7 +64,7 @@ add-gdb-start-if-image() {
|
||||
|
||||
add-gdb-tail-args() {
|
||||
args+=(-ex "set confirm on")
|
||||
args+=(-ex "set pagination on")
|
||||
# args+=(-ex "set pagination on")
|
||||
}
|
||||
|
||||
compute-gdb-usermode-args() {
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#@menu-group lldb
|
||||
#@icon icon.debugger
|
||||
#@help lldb#android
|
||||
#@depends Debugger-rmi-trace
|
||||
#@enum StartCmd:str "process launch" "process launch --stop-at-entry"
|
||||
#@arg :file "Image" "The target binary executable image"
|
||||
#@env OPT_TARGET_ARGS:str="" "Arguments" "Command-line arguments to pass to the target"
|
||||
@@ -21,8 +22,8 @@
|
||||
|
||||
. ..\support\lldbsetuputils.ps1
|
||||
|
||||
$pypathTrace = Ghidra-Module-PyPath "Debug/Debugger-rmi-trace"
|
||||
$pypathLldb = Ghidra-Module-PyPath "Debug/Debugger-agent-lldb"
|
||||
$pypathTrace = Ghidra-Module-PyPath "Debugger-rmi-trace"
|
||||
$pypathLldb = Ghidra-Module-PyPath
|
||||
$Env:PYTHONPATH = "$pypathLldb;$pypathTrace;$Env:PYTHONPATH"
|
||||
|
||||
$arglist = Compute-Lldb-Platform-Args `
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#@menu-group lldb
|
||||
#@icon icon.debugger
|
||||
#@help lldb#android
|
||||
#@depends Debugger-rmi-trace
|
||||
#@enum StartCmd:str "process launch" "process launch --stop-at-entry"
|
||||
#@arg :file "Image" "The target binary executable image"
|
||||
#@args "Arguments" "Command-line arguments to pass to the target"
|
||||
@@ -37,8 +38,8 @@
|
||||
|
||||
. ../support/lldbsetuputils.sh
|
||||
|
||||
pypathTrace=$(ghidra-module-pypath "Debug/Debugger-rmi-trace")
|
||||
pypathLldb=$(ghidra-module-pypath "Debug/Debugger-agent-lldb")
|
||||
pypathTrace=$(ghidra-module-pypath "Debugger-rmi-trace")
|
||||
pypathLldb=$(ghidra-module-pypath)
|
||||
export PYTHONPATH=$pypathLldb:$pypathTrace:$PYTHONPATH
|
||||
|
||||
target_image="$1"
|
||||
|
||||
@@ -9,14 +9,15 @@
|
||||
#@menu-group lldb
|
||||
#@icon icon.debugger
|
||||
#@help lldb#macos_kernel
|
||||
#@depends Debugger-rmi-trace
|
||||
#@env OPT_HOST:str="localhost" "Host" "The hostname of the target"
|
||||
#@env OPT_ARCH:str="" "Architecture" "Target architecture override"
|
||||
#@env OPT_LLDB_PATH:file="lldb" "lldb command" "The path to lldb on the local system. Omit the full path to resolve using the system PATH."
|
||||
|
||||
. ..\support\lldbsetuputils.ps1
|
||||
|
||||
$pypathTrace = Ghidra-Module-PyPath "Debug/Debugger-rmi-trace"
|
||||
$pypathLldb = Ghidra-Module-PyPath "Debug/Debugger-agent-lldb"
|
||||
$pypathTrace = Ghidra-Module-PyPath "Debugger-rmi-trace"
|
||||
$pypathLldb = Ghidra-Module-PyPath
|
||||
$Env:PYTHONPATH = "$pypathLldb;$pypathTrace;$Env:PYTHONPATH"
|
||||
|
||||
$arglist = Compute-Lldb-Remote-Args `
|
||||
|
||||
@@ -25,14 +25,15 @@
|
||||
#@menu-group lldb
|
||||
#@icon icon.debugger
|
||||
#@help lldb#macos_kernel
|
||||
#@depends Debugger-rmi-trace
|
||||
#@env OPT_HOST:str="localhost" "Host" "The hostname of the target"
|
||||
#@env OPT_ARCH:str="" "Architecture" "Target architecture override"
|
||||
#@env OPT_LLDB_PATH:file="lldb" "lldb command" "The path to lldb on the local system. Omit the full path to resolve using the system PATH."
|
||||
|
||||
. ../support/lldbsetuputils.sh
|
||||
|
||||
pypathTrace=$(ghidra-module-pypath "Debug/Debugger-rmi-trace")
|
||||
pypathLldb=$(ghidra-module-pypath "Debug/Debugger-agent-lldb")
|
||||
pypathTrace=$(ghidra-module-pypath "Debugger-rmi-trace")
|
||||
pypathLldb=$(ghidra-module-pypath)
|
||||
export PYTHONPATH=$pypathLldb:$pypathTrace:$PYTHONPATH
|
||||
|
||||
function launch-lldb() {
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#@menu-group lldb
|
||||
#@icon icon.debugger
|
||||
#@help lldb#local
|
||||
#@depends Debugger-rmi-trace
|
||||
#@enum StartCmd:str "process launch" "process launch --stop-at-entry"
|
||||
#@arg :file "Image" "The target binary executable image"
|
||||
#@env OPT_TARGET_ARGS:str="" "Arguments" "Command-line arguments to pass to the target"
|
||||
@@ -18,8 +19,8 @@
|
||||
|
||||
. ..\support\lldbsetuputils.ps1
|
||||
|
||||
$pypathTrace = Ghidra-Module-PyPath "Debug/Debugger-rmi-trace"
|
||||
$pypathLldb = Ghidra-Module-PyPath "Debug/Debugger-agent-lldb"
|
||||
$pypathTrace = Ghidra-Module-PyPath "Debugger-rmi-trace"
|
||||
$pypathLldb = Ghidra-Module-PyPath
|
||||
$Env:PYTHONPATH = "$pypathLldb;$pypathTrace;$Env:PYTHONPATH"
|
||||
|
||||
$arglist = Compute-Lldb-Usermode-Args `
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#@menu-group lldb
|
||||
#@icon icon.debugger
|
||||
#@help lldb#local
|
||||
#@depends Debugger-rmi-trace
|
||||
#@enum StartCmd:str "process launch" "process launch --stop-at-entry"
|
||||
#@arg :file "Image" "The target binary executable image"
|
||||
#@args "Arguments" "Command-line arguments to pass to the target"
|
||||
@@ -36,8 +37,8 @@
|
||||
|
||||
. ../support/lldbsetuputils.sh
|
||||
|
||||
pypathTrace=$(ghidra-module-pypath "Debug/Debugger-rmi-trace")
|
||||
pypathLldb=$(ghidra-module-pypath "Debug/Debugger-agent-lldb")
|
||||
pypathTrace=$(ghidra-module-pypath "Debugger-rmi-trace")
|
||||
pypathLldb=$(ghidra-module-pypath)
|
||||
export PYTHONPATH=$pypathLldb:$pypathTrace:$PYTHONPATH
|
||||
|
||||
target_image="$1"
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#@menu-group lldb
|
||||
#@icon icon.debugger
|
||||
#@help lldb#remote
|
||||
#@depends Debugger-rmi-trace
|
||||
#@arg :file "Image" "The target binary executable image (a copy on the local system)"
|
||||
#@env OPT_HOST:str="localhost" "Host" "The hostname of the target"
|
||||
#@env OPT_PORT:str="9999" "Port" "The host's listening port"
|
||||
@@ -18,8 +19,8 @@
|
||||
|
||||
. ..\support\lldbsetuputils.ps1
|
||||
|
||||
$pypathTrace = Ghidra-Module-PyPath "Debug/Debugger-rmi-trace"
|
||||
$pypathLldb = Ghidra-Module-PyPath "Debug/Debugger-agent-lldb"
|
||||
$pypathTrace = Ghidra-Module-PyPath "Debugger-rmi-trace"
|
||||
$pypathLldb = Ghidra-Module-PyPath
|
||||
$Env:PYTHONPATH = "$pypathLldb;$pypathTrace;$Env:PYTHONPATH"
|
||||
|
||||
$arglist = Compute-Lldb-Remote-Args `
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#@menu-group lldb
|
||||
#@icon icon.debugger
|
||||
#@help lldb#remote
|
||||
#@depends Debugger-rmi-trace
|
||||
#@arg :file "Image" "The target binary executable image (a copy on the local system)"
|
||||
#@env OPT_HOST:str="localhost" "Host" "The hostname of the target"
|
||||
#@env OPT_PORT:str="9999" "Port" "The host's listening port"
|
||||
@@ -34,8 +35,8 @@
|
||||
|
||||
. ../support/lldbsetuputils.sh
|
||||
|
||||
pypathTrace=$(ghidra-module-pypath "Debug/Debugger-rmi-trace")
|
||||
pypathLldb=$(ghidra-module-pypath "Debug/Debugger-agent-lldb")
|
||||
pypathTrace=$(ghidra-module-pypath "Debugger-rmi-trace")
|
||||
pypathLldb=$(ghidra-module-pypath)
|
||||
export PYTHONPATH=$pypathLldb:$pypathTrace:$PYTHONPATH
|
||||
|
||||
target_image="$1"
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#@timeout 60000
|
||||
#@title lldb via ssh
|
||||
#@image-opt arg:1
|
||||
#@desc <html><body width="300px">
|
||||
@@ -11,6 +10,7 @@
|
||||
#@menu-group lldb
|
||||
#@icon icon.debugger
|
||||
#@help lldb#ssh
|
||||
#@depends Debugger-rmi-trace
|
||||
#@enum StartCmd:str "process launch" "process launch --stop-at-entry"
|
||||
#@enum Endian:str auto big little
|
||||
#@arg :str "Image" "The target binary executable image on the remote system"
|
||||
@@ -60,7 +60,7 @@ finished, try launching again.
|
||||
|
||||
if ($answer) {
|
||||
Write-Host "Copying Wheels to $Env:OPT_HOST"
|
||||
Mitigate-Scp-PyModules "Debug/Debugger-rmi-trace" "Debug/Debugger-agent-lldb"
|
||||
Mitigate-Scp-PyModules "Debugger-rmi-trace" "<SELF>"
|
||||
|
||||
Write-Host "Installing Wheels into LLDB's embedded Python"
|
||||
$arglist = Compute-Lldb-PipInstall-Args "'-f'" "os.environ['HOME']" "'ghidralldb>=$version'"
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
##
|
||||
#@timeout 60000
|
||||
#@title lldb via ssh
|
||||
#@image-opt arg:1
|
||||
#@desc <html><body width="300px">
|
||||
@@ -27,6 +26,7 @@
|
||||
#@menu-group lldb
|
||||
#@icon icon.debugger
|
||||
#@help lldb#ssh
|
||||
#@depends Debugger-rmi-trace
|
||||
#@enum StartCmd:str "process launch" "process launch --stop-at-entry"
|
||||
#@enum Endian:str auto big little
|
||||
#@arg :str "Image" "The target binary executable image on the remote system"
|
||||
@@ -92,7 +92,7 @@ finished, try launching again.
|
||||
" "Would you like to install 'ghidralldb>=$version'?"; then
|
||||
|
||||
echo "Copying Wheels to $OPT_HOST"
|
||||
mitigate-scp-pymodules "Debug/Debugger-rmi-trace" "Debug/Debugger-agent-lldb"
|
||||
mitigate-scp-pymodules "Debugger-rmi-trace" "<SELF>"
|
||||
|
||||
echo "Installing Wheels into LLDB's embedded Python"
|
||||
do-installation
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
. ..\..\..\Debugger-rmi-trace\data\support\setuputils.ps1
|
||||
. $Env:MODULE_Debugger_rmi_trace_HOME\data\support\setuputils.ps1
|
||||
|
||||
function Add-Lldb-Init-Args {
|
||||
param([ref]$ArgList)
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
##
|
||||
. ../../../Debugger-rmi-trace/data/support/setuputils.sh
|
||||
. $MODULE_Debugger_rmi_trace_HOME/data/support/setuputils.sh
|
||||
|
||||
add-lldb-init-args() {
|
||||
args+=(-o "version")
|
||||
|
||||
+16
-5
@@ -86,8 +86,9 @@ public class JavaTraceRmiLaunchOffer extends AbstractScriptTraceRmiLaunchOffer {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void launchBackEnd(TaskMonitor monitor, Map<String, TerminalSession> sessions,
|
||||
Map<String, ValStr<?>> args, SocketAddress address) throws Exception {
|
||||
protected TraceRmiBackEnd launchBackEnd(TaskMonitor monitor,
|
||||
Map<String, TerminalSession> sessions, Map<String, ValStr<?>> args,
|
||||
SocketAddress address) throws Exception {
|
||||
List<String> commandLine = new ArrayList<>();
|
||||
Map<String, String> env = new HashMap<>(System.getenv());
|
||||
prepareSubprocess(commandLine, env, args, address);
|
||||
@@ -101,18 +102,28 @@ public class JavaTraceRmiLaunchOffer extends AbstractScriptTraceRmiLaunchOffer {
|
||||
sessions.put(ns.name(), ns);
|
||||
}
|
||||
|
||||
TraceRmiBackEnd result = new TraceRmiBackEnd();
|
||||
if (hasKeyReally(env, "OPT_JSHELL_PATH")) {
|
||||
String classPath = computeClassPath(env);
|
||||
commandLine.add(0, "--startup");
|
||||
commandLine.add(0, "--class-path=" + classPath);
|
||||
commandLine.add(0, env.get("OPT_JSHELL_PATH"));
|
||||
sessions.put("Shell",
|
||||
runInTerminal(commandLine, env, script.getParentFile(), sessions.values()));
|
||||
PtyTerminalSession session =
|
||||
runInTerminal(commandLine, env, script.getParentFile(), sessions.values());
|
||||
sessions.put("Shell", session);
|
||||
session.terminal().addTerminalListener(result);
|
||||
}
|
||||
else {
|
||||
JdiClientThread thread = new JdiClientThread(env);
|
||||
JdiClientThread thread = new JdiClientThread(env) {
|
||||
@Override
|
||||
public void run() {
|
||||
super.run();
|
||||
result.terminated(0);
|
||||
}
|
||||
};
|
||||
thread.start();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private String computeClassPath(Map<String, String> env) {
|
||||
|
||||
@@ -30,14 +30,9 @@
|
||||
#@env OPT_LANG:str="DATA:LE:64:default" "Ghidra Language" "The Ghidra LanguageID for the trace"
|
||||
#@env OPT_COMP:str="pointer64" "Ghidra Compiler" "The Ghidra CompilerSpecID for the trace"
|
||||
|
||||
if [ -d ${GHIDRA_HOME}/ghidra/.git ]
|
||||
then
|
||||
export PYTHONPATH=$GHIDRA_HOME/ghidra/Ghidra/Debug/Debugger-rmi-trace/build/pypkg/src:$PYTHONPATH
|
||||
elif [ -d ${GHIDRA_HOME}/.git ]
|
||||
then
|
||||
export PYTHONPATH=$GHIDRA_HOME/Ghidra/Debug/Debugger-rmi-trace/build/pypkg/src:$PYTHONPATH
|
||||
else
|
||||
export PYTHONPATH=$GHIDRA_HOME/Ghidra/Debug/Debugger-rmi-trace/pypkg/src:$PYTHONPATH
|
||||
fi
|
||||
. ../support/setuputils.sh
|
||||
|
||||
pypathTrace=$(ghidra-module-pypath)
|
||||
export PYTHONPATH=$pypathTrace:$PYTHONPATH
|
||||
|
||||
"$OPT_PYTHON_EXE" -i ../support/raw-python3.py
|
||||
|
||||
@@ -28,19 +28,17 @@ This file CANNOT be assumed to be available on a remote target. For
|
||||
that, consider ghidratrace.setuputils.
|
||||
"""
|
||||
import os
|
||||
|
||||
home = os.getenv('GHIDRA_HOME')
|
||||
from typing import Optional
|
||||
|
||||
|
||||
def ghidra_module_pypath(name: str) -> str:
|
||||
installed = f'{home}/Ghidra/{name}/pypkg/src'
|
||||
def ghidra_module_pypath(name: Optional[str]=None) -> str:
|
||||
mod_home_name = 'MODULE_HOME' if name is None else f'MODULE_{name.replace("-","_")}_HOME'
|
||||
mod_home = os.getenv(mod_home_name)
|
||||
installed = f'{mod_home}/pypkg/src'
|
||||
if os.path.isdir(installed):
|
||||
return installed
|
||||
dev1 = f'{home}/Ghidra/{name}/build/pypkg/src'
|
||||
if os.path.isdir(dev1):
|
||||
return dev1
|
||||
dev2 = f'{home}/ghidra/Ghidra/{name}/build/pypkg/src'
|
||||
if os.path.isdir(dev2):
|
||||
return dev2
|
||||
dev = f'{mod_home}/build/pypkg/src'
|
||||
if os.path.isdir(dev):
|
||||
return dev
|
||||
raise Exception(
|
||||
f"Cannot find Python source for {name}. Try gradle assemblePyPackage?")
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user