-
I have unique address space unique:10000024 which copies some constant string. I am trying to get the value of the string using GetDataAt() and it seems to return null. Is there a different way to get value from unique address space? def getUniqueAddress(offset):
return currentProgram.getAddressFactory().getUniqueSpace().getAddress(offset)
def visit_call(func,fm,op):
opinputs = op.getInputs()
call_target_addr = opinputs[0].getAddress()
call_target_func = fm.getFunctionAt(call_target_addr)
if call_target_func.name in sinks:
print("\t\tFound sink: " + call_target_func.name)
offset = opinputs[1].getOffset()
print(getDataContaining(getUniqueAddress(offset)))
exit(0) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
I've been having the same problem and can't seem to find how to get the value of a unique address either. I did try "iterating" the namespace containing the address but it ran for a while and I killed it in the end. I don't think the namespace I'm getting back is correct.
|
Beta Was this translation helpful? Give feedback.
-
Okay I figured it out in the end by reading So when you have a unique you want to 'walk' the varnode def tree to find the actual value it was made from. In my case it's made from a single pointer which ends up up being a ram address I can then read in the listing. So I only need to go up 1 in the tree Some example code of what I'm doing:
|
Beta Was this translation helpful? Give feedback.
Okay I figured it out in the end by reading
followToParam
in https://github.com/NationalSecurityAgency/ghidra/blob/master/Ghidra/Features/Decompiler/ghidra_scripts/ShowConstantUse.javaSo when you have a unique you want to 'walk' the varnode def tree to find the actual value it was made from. In my case it's made from a single pointer which ends up up being a ram address I can then read in the listing. So I only need to go up 1 in the tree
Some example code of what I'm doing: