mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 19:42:36 +02:00
GP-1057: Preventing Ghidra from launching when path contains !. Also
updating Installation Guide's "Known Issues" section.
This commit is contained in:
parent
11149b9ef2
commit
38edc05f81
10 changed files with 73 additions and 39 deletions
|
@ -1,8 +1,7 @@
|
|||
:: Ghidra Headless Analyzer launch (see analyzeHeadlessREADME.html)
|
||||
|
||||
@echo off
|
||||
|
||||
setlocal EnableDelayedExpansion
|
||||
setlocal
|
||||
|
||||
:: Maximum heap memory size. For headless, it is recommended to not use the default value
|
||||
:: because garbage collection could take too long on systems with a large amount of physical
|
||||
|
@ -23,9 +22,6 @@ set DEBUG_ADDRESS=127.0.0.1:13002
|
|||
set VMARG_LIST=-XX:ParallelGCThreads=2
|
||||
set VMARG_LIST=%VMARG_LIST% -XX:CICompilerCount=2
|
||||
|
||||
:: store current path
|
||||
set "filepath=%~dp0"
|
||||
|
||||
:: Loop through parameters (if there aren't any, just continue) and store
|
||||
:: in params variable.
|
||||
|
||||
|
@ -36,6 +32,7 @@ if "%~1" == "" goto cont
|
|||
|
||||
:: If -import is found and Windows has not done proper wildcard expansion, force
|
||||
:: this to happen and save expansion to params variable.
|
||||
setlocal EnableDelayedExpansion
|
||||
if "%~1" == "-import" (
|
||||
set params=!params! -import
|
||||
for %%f in ("%~2") DO (
|
||||
|
@ -45,10 +42,11 @@ if "%~1" == "-import" (
|
|||
) else (
|
||||
set params=!params! "%~1"
|
||||
)
|
||||
setlocal DisableDelayedExpansion
|
||||
|
||||
shift
|
||||
goto Loop
|
||||
|
||||
:cont
|
||||
|
||||
call "%filepath%launch.bat" %LAUNCH_MODE% Ghidra-Headless "%MAXMEM%" "%VMARG_LIST%" ghidra.app.util.headless.AnalyzeHeadless %params%
|
||||
call "%~dp0launch.bat" %LAUNCH_MODE% Ghidra-Headless "%MAXMEM%" "%VMARG_LIST%" ghidra.app.util.headless.AnalyzeHeadless %params%
|
||||
|
|
|
@ -7,10 +7,17 @@ setlocal
|
|||
:: fg, debug, debug-suspend
|
||||
set LAUNCH_MODE=fg
|
||||
|
||||
:: Sets SCRIPT_DIR to the directory that contains this file (ends with '\')
|
||||
set "SCRIPT_DIR=%~dp0"
|
||||
:: Sets SUPPORT_DIR to the directory that contains this file (buildGhidraJar.bat).
|
||||
:: SUPPORT_DIR will not contain a trailing slash.
|
||||
::
|
||||
:: '% ~' dereferences the value in param 0
|
||||
:: 'd' - drive
|
||||
:: 'p' - path (without filename)
|
||||
:: '~0,-1' - removes trailing \
|
||||
set "SUPPORT_DIR=%~dp0"
|
||||
set "SUPPORT_DIR=%SUPPORT_DIR:~0,-1%"
|
||||
|
||||
set "GHIDRA_ROOT_DIR=%SCRIPT_DIR%..\Ghidra"
|
||||
set "GHIDRA_ROOT_DIR=%SUPPORT_DIR%\..\Ghidra"
|
||||
if exist "%GHIDRA_ROOT_DIR%" goto continue
|
||||
|
||||
echo This script does not support development mode use
|
||||
|
@ -20,4 +27,4 @@ exit /B 1
|
|||
|
||||
set APP_VMARGS=-DGhidraJarBuilder.Name=%~n0
|
||||
|
||||
call "%~dp0launch.bat" %LAUNCH_MODE% Ghidra "" "%APP_VMARGS%" ghidra.util.GhidraJarBuilder -main ghidra.JarRun %*
|
||||
call "%SUPPORT_DIR%\launch.bat" %LAUNCH_MODE% Ghidra "" "%APP_VMARGS%" ghidra.util.GhidraJarBuilder -main ghidra.JarRun %*
|
||||
|
|
|
@ -24,9 +24,6 @@ exit /B 1
|
|||
|
||||
:continue
|
||||
|
||||
:: Delay the expansion of our loop items below since the value is being updated as the loop works
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
:: See if we were doubled clicked or run from a command prompt
|
||||
set DOUBLE_CLICKED=n
|
||||
for /f "tokens=2" %%# in ("%cmdcmdline%") do if /i "%%#" equ "/c" set DOUBLE_CLICKED=y
|
||||
|
@ -40,6 +37,17 @@ for /f "tokens=2" %%# in ("%cmdcmdline%") do if /i "%%#" equ "/c" set DOUBLE_CLI
|
|||
:: '~0,-1' - removes trailing \
|
||||
set "SUPPORT_DIR=%~dp0"
|
||||
set "SUPPORT_DIR=%SUPPORT_DIR:~0,-1%"
|
||||
|
||||
:: Ensure Ghidra path doesn't contain illegal characters
|
||||
if not %SUPPORT_DIR:!=%==%SUPPORT_DIR% (
|
||||
echo Ghidra path cannot contain a "!" character.
|
||||
set ERRORLEVEL=1
|
||||
goto exit1
|
||||
)
|
||||
|
||||
:: Delay the expansion of our loop items below since the value is being updated as the loop works
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
::
|
||||
:: Parse arguments
|
||||
::
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
:: Ghidra python launch
|
||||
|
||||
@echo off
|
||||
|
||||
setlocal EnableDelayedExpansion
|
||||
setlocal
|
||||
|
||||
:: Maximum heap memory size
|
||||
:: Default for Windows 32-bit is 768M and 64-bit is 1024M
|
||||
|
@ -25,7 +24,4 @@ set DEBUG_ADDRESS=127.0.0.1:13002
|
|||
set VMARG_LIST=-XX:ParallelGCThreads=2
|
||||
set VMARG_LIST=%VMARG_LIST% -XX:CICompilerCount=2
|
||||
|
||||
:: store current path
|
||||
set "filepath=%~dp0"
|
||||
|
||||
call "%filepath%launch.bat" %LAUNCH_MODE% Ghidra-Python "%MAXMEM%" "%VMARG_LIST%" ghidra.python.PythonRun %params%
|
||||
call "%~dp0launch.bat" %LAUNCH_MODE% Ghidra-Python "%MAXMEM%" "%VMARG_LIST%" ghidra.python.PythonRun %params%
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue