pwndra icon indicating copy to clipboard operation
pwndra copied to clipboard

AutoConstants and AutoSyscalls broken on latest Ghidra

Open Legoclones opened this issue 2 years ago • 3 comments

I'm seeing Auto Constants and Auto Syscalls is broken on latest Ghidra (10.3) with Java 17.0.7. Looks to be the same underlying issue.

AutoSyscalls.py:

Traceback (most recent call last):
  File "...\pwndra\AutoSyscalls.py", line 34, in <module>
    run()
  File "...\pwndra\AutoSyscalls.py", line 31, in run
    obj = Syscalls(currentProgram, currentSelection, monitor, arch, abi)
  File "...\pwndra\lib\Syscalls.py", line 735, in __init__
    res = self.getRegisterValue(call, reg)
  File "...\pwndra\lib\Syscalls.py", line 583, in getRegisterValue
    evaluate = ConstantPropagationContextEvaluator(True)
TypeError: ghidra.app.plugin.core.analysis.ConstantPropagationContextEvaluator(): 1st arg can't be coerced to ghidra.util.task.TaskMonitor

AutoConstants.py:

Traceback (most recent call last):
  File "...\pwndra\AutoConstants.py", line 33, in <module>
    run()
  File "...\pwndra\AutoConstants.py", line 30, in run
    obj = Constants(currentProgram, currentSelection, monitor, state, arch, abi)
  File "...\pwndra\lib\Constants.py", line 321, in __init__
    value = self.getParameterValue(func, call, arg[0])
  File "...\pwndra\lib\Constants.py", line 143, in getParameterValue
    return self.getRegisterValue(func, call, param.getRegister())
  File "...\pwndra\lib\Constants.py", line 63, in getRegisterValue
    evaluate = ConstantPropagationContextEvaluator(True)
TypeError: ghidra.app.plugin.core.analysis.ConstantPropagationContextEvaluator(): 1st arg can't be coerced to ghidra.util.task.TaskMonitor

Legoclones avatar Jun 23 '23 00:06 Legoclones

fix scripts/lib/Constants.py like following line1: from ghidra.util.task import TaskMonitor

line63 : function = self.currentProgram.getListing().getFunctionContaining(call)

msh1307 avatar Sep 08 '23 12:09 msh1307

I added from ghidra.util.task import TaskMonitor to the first line, line 63 is already set to the value you specified. This didn't change the error message.

Legoclones avatar Sep 08 '23 16:09 Legoclones

only change needed at line 63:

- evaluate = ConstantPropagationContextEvaluator(True)
+ evaluate = ConstantPropagationContextEvaluator(self.monitor)

this works with ghidra 10.4

j4k0xb avatar Oct 17 '23 15:10 j4k0xb