// Script to sanitize global symbols in Ghidra
// @category _Reman3
// @menupath Reman3.Sanitize Global Symbols

import ghidra.app.script.GhidraScript;
import re3lib.GlobalDumper;
import re3lib.RemanConfig;

public class SanitizeGlobalSymbols extends GhidraScript {
  @Override
  public void run() throws Exception {
    RemanConfig.INSTANCE = new RemanConfig(this);
    RemanConfig.INSTANCE.createDirectories();

    GlobalDumper globalDumper = new GlobalDumper(this);
    globalDumper.loadGlobalManifest();

    globalDumper.sanitizeGlobalSymbols();

    globalDumper.dumpGlobals();
    globalDumper.saveGlobalManifest();
  }
}
