// Args: address count outfile. Prints instructions starting at address. import ghidra.app.script.GhidraScript; import ghidra.program.model.listing.*; import java.io.*; public class Disasm extends GhidraScript { public void run() throws Exception { String[] a = getScriptArgs(); try (PrintWriter o = new PrintWriter(a[2])) { Instruction in = getInstructionAt(toAddr(a[0])); if (in == null) in = getInstructionAfter(toAddr(a[0])); for (int i = 0; in != null && i < Integer.parseInt(a[1]); i++, in = in.getNext()) o.println(in.getAddress() + " " + in); } } }