386
edits
(Created page with "Limited support for importing a ROM map from Ghidra. '''TODO:''' We need the ability to merge the wikitext output into an already existing page. 1. Export your functions from Ghidra using the following script: <syntaxhighlight lang="c" lines> /* ### * 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.apach...") |
No edit summary |
||
Line 1: | Line 1: | ||
Limited support for importing a ROM map from Ghidra. '''TODO:''' We need the ability to merge the wikitext output into an already existing page. | Limited support for importing a ROM map from Ghidra. '''TODO:''' We need the ability to merge the wikitext output into an already existing page. | ||
Running this script will export all named functions in the current program to a wikitext file: | |||
<syntaxhighlight lang="c" lines> | <syntaxhighlight lang="c" lines> | ||
Line 24: | Line 24: | ||
// * Ignores thunks and FUN_ functions | // * Ignores thunks and FUN_ functions | ||
// List function names and entry point addresses to a file in | // List function names and entry point addresses to a file in wikitext format | ||
//@category Functions | //@category Functions | ||
import java.io.File; | import java.io.File; | ||
import java.io.FileWriter; | import java.io.FileWriter; | ||
import ghidra.app.script.GhidraScript; | import ghidra.app.script.GhidraScript; | ||
Line 45: | Line 42: | ||
@Override | @Override | ||
public void run() throws Exception { | public void run() throws Exception { | ||
File outputFile = askFile("Please Select Output File", "Choose"); | File outputFile = askFile("Please Select Output File", "Choose"); | ||
FileWriter fileWriter = new FileWriter(outputFile); | |||
Listing listing = currentProgram.getListing(); | Listing listing = currentProgram.getListing(); | ||
Line 64: | Line 57: | ||
FunctionSignature sig = f.getSignature(); | FunctionSignature sig = f.getSignature(); | ||
fileWriter.write("|-\n"); | |||
fileWriter.write("| 0x"); | |||
fileWriter.write(entry.toString()); | |||
fileWriter.write(" || "); | |||
fileWriter.write(sig.getPrototypeString()); | |||
fileWriter.write("\n"); | |||
} | } | ||
fileWriter.close(); | |||
println("Wrote functions to " + outputFile); | println("Wrote functions to " + outputFile); | ||
} | } | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> |