Advertisement
Guest User

Untitled

a guest
Mar 29th, 2020
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.27 KB | None | 0 0
  1. //TODO write a description for this script
  2. //@author
  3. //@category _NEW_
  4. //@keybinding
  5. //@menupath
  6. //@toolbar
  7.  
  8. import ghidra.app.script.GhidraScript;
  9. import ghidra.program.model.util.*;
  10. import ghidra.program.model.reloc.*;
  11. import ghidra.program.model.data.*;
  12. import ghidra.program.model.block.*;
  13. import ghidra.program.model.symbol.*;
  14. import ghidra.program.model.scalar.*;
  15. import ghidra.program.model.mem.*;
  16. import ghidra.program.model.listing.*;
  17. import ghidra.program.model.lang.*;
  18. import ghidra.program.model.pcode.*;
  19. import ghidra.program.model.address.*;
  20.  
  21. public class CleanupAddresses extends GhidraScript {
  22.  
  23.     public void run() throws Exception {
  24.         SymbolTable st = state.getCurrentProgram().getSymbolTable();
  25.         java.util.List<Symbol> sym = st.getGlobalSymbols("start");
  26.         Address start = sym.get(0).getAddress();
  27.         println(String.format("Starting at %s", start.toString()));
  28.  
  29.         ReferenceManager refMgr = currentProgram.getReferenceManager();
  30.         ReferenceIterator iter = refMgr.getReferenceIterator(start);
  31.         while (iter.hasNext()) {
  32.             Reference ref = iter.next();
  33.             println(String.format("Ref from %s to %s", ref.getFromAddress().toString(), ref.getToAddress().toString()));
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement