mirror of
https://codeberg.org/KeybadeBlox/JSRF-Decompilation.git
synced 2026-02-20 02:07:02 +03:00
Miscellaneous Ghidra script tweaks
No behavioural changes.
This commit is contained in:
parent
c020c2e247
commit
3c4f0e72b8
3 changed files with 15 additions and 13 deletions
|
|
@ -16,7 +16,7 @@ import java.util.Arrays;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
|
||||||
public class EnhancedExport extends GhidraScript{
|
public class EnhancedExport extends GhidraScript {
|
||||||
@Override
|
@Override
|
||||||
public void run() throws Exception {
|
public void run() throws Exception {
|
||||||
final FileWriter out = new FileWriter(askFile("Specify output file", "OK"));
|
final FileWriter out = new FileWriter(askFile("Specify output file", "OK"));
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
import ghidra.app.script.GhidraScript;
|
import ghidra.app.script.GhidraScript;
|
||||||
import ghidra.app.services.DataTypeQueryService;
|
import ghidra.app.services.DataTypeQueryService;
|
||||||
|
import ghidra.app.util.NamespaceUtils;
|
||||||
import ghidra.program.model.address.Address;
|
import ghidra.program.model.address.Address;
|
||||||
import ghidra.program.model.data.ArrayDataType;
|
import ghidra.program.model.data.ArrayDataType;
|
||||||
import ghidra.program.model.data.DataType;
|
import ghidra.program.model.data.DataType;
|
||||||
|
|
@ -27,7 +28,7 @@ import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
|
||||||
public class EnhancedImport extends GhidraScript{
|
public class EnhancedImport extends GhidraScript {
|
||||||
@Override
|
@Override
|
||||||
public void run() throws Exception {
|
public void run() throws Exception {
|
||||||
final FileReader in = new FileReader(askFile("Select input file", "OK"));
|
final FileReader in = new FileReader(askFile("Select input file", "OK"));
|
||||||
|
|
@ -86,16 +87,17 @@ public class EnhancedImport extends GhidraScript{
|
||||||
/* Creates namespaces from the given name, returning the deepest one
|
/* Creates namespaces from the given name, returning the deepest one
|
||||||
Returns null if the qualified name is in the global namespace.
|
Returns null if the qualified name is in the global namespace.
|
||||||
*/
|
*/
|
||||||
final String[] parts = qualifiedName.split("::");
|
return qualifiedName.contains("::") ?
|
||||||
|
NamespaceUtils.createNamespaceHierarchy(
|
||||||
if (parts.length < 2) return null;
|
qualifiedName.substring( // Cut off symbol name
|
||||||
|
0,
|
||||||
final String[] names = Arrays.copyOfRange(parts, 0, parts.length - 1);
|
qualifiedName.length() - "::".length() -
|
||||||
|
unqualified(qualifiedName).length()
|
||||||
Namespace ns = null;
|
),
|
||||||
for (final String name : names) ns = createNamespace(ns, name);
|
null,
|
||||||
|
currentProgram,
|
||||||
return ns;
|
SourceType.USER_DEFINED
|
||||||
|
) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Optional<DataType> makeType(final String type) throws Exception {
|
private Optional<DataType> makeType(final String type) throws Exception {
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ import java.util.stream.IntStream;
|
||||||
import java.util.zip.CRC32;
|
import java.util.zip.CRC32;
|
||||||
|
|
||||||
|
|
||||||
public class MSVC7Mangle extends GhidraScript{
|
public class MSVC7Mangle extends GhidraScript {
|
||||||
@Override
|
@Override
|
||||||
public void run() throws Exception {
|
public void run() throws Exception {
|
||||||
// Get selected ranges from arguments if invoked headless
|
// Get selected ranges from arguments if invoked headless
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue