mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-31 08:36:23 +08:00
GP-4876: JShell launcher for Ghidra
This commit is contained in:
@@ -0,0 +1,34 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
|
||||||
|
<stringAttribute key="bad_container_name" value="/_Ghidra Support/eclipse"/>
|
||||||
|
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||||
|
<listEntry value="/Framework Utility/src/main/java/ghidra/Ghidra.java"/>
|
||||||
|
</listAttribute>
|
||||||
|
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||||
|
<listEntry value="1"/>
|
||||||
|
</listAttribute>
|
||||||
|
<mapAttribute key="org.eclipse.debug.core.preferred_launchers">
|
||||||
|
<mapEntry key="[debug]" value="org.eclipse.jdt.launching.localJavaApplication"/>
|
||||||
|
<mapEntry key="[run]" value="org.eclipse.jdt.launching.localJavaApplication"/>
|
||||||
|
</mapAttribute>
|
||||||
|
<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"/>
|
||||||
|
<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <sourceLookupDirector> <sourceContainers duplicates="false"> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;classpathContainer path=&quot;org.eclipse.jdt.launching.JRE_CONTAINER&quot;/&gt;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathContainer"/> </sourceContainers> </sourceLookupDirector> "/>
|
||||||
|
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
|
||||||
|
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
|
||||||
|
<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
|
||||||
|
</listAttribute>
|
||||||
|
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_ATTR_USE_ARGFILE" value="false"/>
|
||||||
|
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_SHOW_CODEDETAILS_IN_EXCEPTION_MESSAGES" value="true"/>
|
||||||
|
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
|
||||||
|
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
|
||||||
|
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
|
||||||
|
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry path="5" projectName="Framework Utility" type="1"/> "/>
|
||||||
|
</listAttribute>
|
||||||
|
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
|
||||||
|
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="ghidra.Ghidra"/>
|
||||||
|
<listAttribute key="org.eclipse.jdt.launching.MODULEPATH"/>
|
||||||
|
<stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="Framework Utility"/>
|
||||||
|
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="ghidra.JShellRun"/>
|
||||||
|
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Framework Utility"/>
|
||||||
|
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XX:+IgnoreUnrecognizedVMOptions -Djava.system.class.loader=ghidra.GhidraClassLoader -Xshare:off -Dfile.encoding=UTF8 -Duser.country=US -Duser.language=en -Dsun.java2d.pmoffscreen=false -Dsun.java2d.xrender=true -Dsun.java2d.d3d=false -Xdock:name="Ghidra" -Dvisualvm.display.name=Ghidra -Dpython.console.encoding=UTF-8"/>
|
||||||
|
</launchConfiguration>
|
||||||
@@ -12,6 +12,7 @@
|
|||||||
.launch/Ghidra Code Coverage.launch||GHIDRA||||END|
|
.launch/Ghidra Code Coverage.launch||GHIDRA||||END|
|
||||||
.launch/Ghidra.launch||GHIDRA||||END|
|
.launch/Ghidra.launch||GHIDRA||||END|
|
||||||
.launch/Headless.launch||GHIDRA||||END|
|
.launch/Headless.launch||GHIDRA||||END|
|
||||||
|
.launch/JShell.launch||GHIDRA||||END|
|
||||||
Module.manifest||GHIDRA||||END|
|
Module.manifest||GHIDRA||||END|
|
||||||
data/ElfFunctionsThatDoNotReturn||GHIDRA||||END|
|
data/ElfFunctionsThatDoNotReturn||GHIDRA||||END|
|
||||||
data/ExtensionPoint.manifest||GHIDRA||||END|
|
data/ExtensionPoint.manifest||GHIDRA||||END|
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
/* ###
|
||||||
|
* IP: GHIDRA
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package ghidra;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
import ghidra.framework.*;
|
||||||
|
import jdk.jshell.tool.JavaShellToolBuilder;
|
||||||
|
|
||||||
|
public class JShellRun implements GhidraLaunchable {
|
||||||
|
@Override
|
||||||
|
public void launch(GhidraApplicationLayout layout, String[] args) throws Exception {
|
||||||
|
if (Stream.of(args).anyMatch(a -> a.startsWith("--execution"))) {
|
||||||
|
System.err.println("Ignoring --execution option. Overridden to local");
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList<String> fullArgs = new ArrayList<>();
|
||||||
|
fullArgs.addAll(Arrays.asList(args));
|
||||||
|
|
||||||
|
ApplicationConfiguration configuration;
|
||||||
|
if (fullArgs.remove("--headless")) {
|
||||||
|
configuration = new HeadlessGhidraApplicationConfiguration();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
GhidraApplicationConfiguration gac = new GhidraApplicationConfiguration();
|
||||||
|
gac.setShowSplashScreen(false);
|
||||||
|
configuration = gac;
|
||||||
|
}
|
||||||
|
Application.initializeApplication(layout, configuration);
|
||||||
|
|
||||||
|
fullArgs.add("--execution=local");
|
||||||
|
JavaShellToolBuilder.builder().start(fullArgs.toArray(String[]::new));
|
||||||
|
}
|
||||||
|
}
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
#----------------------------------------
|
||||||
|
# Ghidra JShell launch
|
||||||
|
#----------------------------------------
|
||||||
|
|
||||||
|
# Maximum heap memory may be changed if default is inadequate. This will generally be up to 1/4 of
|
||||||
|
# the physical memory available to the OS. Uncomment MAXMEM setting if non-default value is needed.
|
||||||
|
#MAXMEM=2G
|
||||||
|
|
||||||
|
# Resolve symbolic link if present and get the directory this script lives in.
|
||||||
|
# NOTE: "readlink -f" is best but works on Linux only, "readlink" will only work if your PWD
|
||||||
|
# contains the link you are calling (which is the best we can do on macOS), and the "echo" is the
|
||||||
|
# fallback, which doesn't attempt to do anything with links.
|
||||||
|
SCRIPT_FILE="$(readlink -f "$0" 2>/dev/null || readlink "$0" 2>/dev/null || echo "$0")"
|
||||||
|
SCRIPT_DIR="${SCRIPT_FILE%/*}"
|
||||||
|
|
||||||
|
# Launch Ghidra
|
||||||
|
"${SCRIPT_DIR}"/launch.sh fg jdk Ghidra-JShell "${MAXMEM}" "" ghidra.JShellRun "$@"
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
:: Ghidra JShell launch
|
||||||
|
|
||||||
|
@echo off
|
||||||
|
setlocal
|
||||||
|
|
||||||
|
:: Maximum heap memory may be changed if default is inadequate. This will generally be up to 1/4 of
|
||||||
|
:: the physical memory available to the OS. Uncomment MAXMEM setting if non-default value is needed.
|
||||||
|
::set MAXMEM=2G
|
||||||
|
|
||||||
|
call "%~dp0launch.bat" fg jdk Ghidra-JShell "%MAXMEM%" "" ghidra.JShellRun %*
|
||||||
|
|
||||||
@@ -26,6 +26,7 @@ Linux/support/convertStorage||GHIDRA||||END|
|
|||||||
Linux/support/gdbGADPServerRun||GHIDRA||||END|
|
Linux/support/gdbGADPServerRun||GHIDRA||||END|
|
||||||
Linux/support/ghidraClean||GHIDRA||||END|
|
Linux/support/ghidraClean||GHIDRA||||END|
|
||||||
Linux/support/ghidraDebug||GHIDRA||||END|
|
Linux/support/ghidraDebug||GHIDRA||||END|
|
||||||
|
Linux/support/jshellRun||GHIDRA||||END|
|
||||||
Linux/support/pythonRun||GHIDRA||||END|
|
Linux/support/pythonRun||GHIDRA||||END|
|
||||||
Linux/support/sleigh||GHIDRA||||END|
|
Linux/support/sleigh||GHIDRA||||END|
|
||||||
Windows/ghidraRun.bat||GHIDRA||||END|
|
Windows/ghidraRun.bat||GHIDRA||||END|
|
||||||
@@ -45,6 +46,7 @@ Windows/support/dbgmodelGADPServerRun.bat||GHIDRA||||END|
|
|||||||
Windows/support/ghidra.ico||GHIDRA||||END|
|
Windows/support/ghidra.ico||GHIDRA||||END|
|
||||||
Windows/support/ghidraClean.bat||GHIDRA||||END|
|
Windows/support/ghidraClean.bat||GHIDRA||||END|
|
||||||
Windows/support/ghidraDebug.bat||GHIDRA||||END|
|
Windows/support/ghidraDebug.bat||GHIDRA||||END|
|
||||||
|
Windows/support/jshellRun.bat||GHIDRA||||END|
|
||||||
Windows/support/launch.bat||GHIDRA||||END|
|
Windows/support/launch.bat||GHIDRA||||END|
|
||||||
Windows/support/pythonRun.bat||GHIDRA||||END|
|
Windows/support/pythonRun.bat||GHIDRA||||END|
|
||||||
Windows/support/sleigh.bat||GHIDRA||||END|
|
Windows/support/sleigh.bat||GHIDRA||||END|
|
||||||
|
|||||||
Reference in New Issue
Block a user