27 lines
1.1 KiB
Python
27 lines
1.1 KiB
Python
|
|
from ghidra.program.model.symbol import SourceType, SymbolType
|
||
|
|
|
||
|
|
|
||
|
|
function = helpers["get_function"](program, "1420:1499")
|
||
|
|
if function is None:
|
||
|
|
raise RuntimeError("Function 1420:1499 not found")
|
||
|
|
|
||
|
|
symbol_table = program.getSymbolTable()
|
||
|
|
global_namespace = program.getGlobalNamespace()
|
||
|
|
remorse_namespace = symbol_table.getNamespace("Remorse", global_namespace)
|
||
|
|
if remorse_namespace is None:
|
||
|
|
raise RuntimeError("Namespace Remorse not found")
|
||
|
|
|
||
|
|
runtime_namespace = symbol_table.getNamespace("EntityVmRuntime", remorse_namespace)
|
||
|
|
if runtime_namespace is None:
|
||
|
|
raise RuntimeError("Namespace Remorse::EntityVmRuntime not found")
|
||
|
|
|
||
|
|
for symbol in list(symbol_table.getSymbols(function.getEntryPoint())):
|
||
|
|
if symbol.getSymbolType() == SymbolType.LABEL and symbol.getName() == "Create" and symbol.getParentNamespace() == runtime_namespace:
|
||
|
|
symbol.delete()
|
||
|
|
|
||
|
|
function.setParentNamespace(runtime_namespace)
|
||
|
|
function.setName("Create", SourceType.USER_DEFINED)
|
||
|
|
|
||
|
|
print("PARENT", function.getParentNamespace())
|
||
|
|
for symbol in symbol_table.getSymbols(function.getEntryPoint()):
|
||
|
|
print("SYMBOL", symbol.getName(True), symbol.getSymbolType(), symbol.getSource())
|