mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 17:59:46 +02:00
Python3 support
This commit is contained in:
parent
d7c1f65f43
commit
92d0f1dacf
101 changed files with 11413 additions and 13 deletions
|
@ -65,6 +65,7 @@ public class VSCodeProjectScript extends GhidraScript {
|
|||
writeSettings(installDir, projectDir, classpathSourceMap);
|
||||
writeLaunch(installDir, projectDir, classpathSourceMap);
|
||||
writeSampleScriptJava(projectDir);
|
||||
writeSampleScriptPyhidra(projectDir);
|
||||
writeSampleModule(installDir, projectDir);
|
||||
|
||||
println("Successfully created VSCode project directory at: " + projectDir);
|
||||
|
@ -226,6 +227,25 @@ public class VSCodeProjectScript extends GhidraScript {
|
|||
}
|
||||
FileUtils.writeStringToFile(scriptFile, sampleScript, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
private void writeSampleScriptPyhidra(File projectDir) throws IOException {
|
||||
File scriptsDir = new File(projectDir, "ghidra_scripts");
|
||||
File scriptFile = new File(scriptsDir, "sample_script.py");
|
||||
String sampleScript = """
|
||||
# Sample Pyhidra GhidraScript
|
||||
# @category Examples
|
||||
# @runtime Pyhidra
|
||||
|
||||
from java.util import LinkedList
|
||||
java_list = LinkedList([1,2,3])
|
||||
|
||||
block = currentProgram.memory.getBlock('.text')
|
||||
""";
|
||||
if (!FileUtilities.mkdirs(scriptFile.getParentFile())) {
|
||||
throw new IOException("Failed to create: " + scriptFile.getParentFile());
|
||||
}
|
||||
FileUtils.writeStringToFile(scriptFile, sampleScript, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a sample Java-based Ghidra module into the VSCode project directory
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue