DanMcInerney / pymetasploit3

Automation library for Metasploit
MIT License
374 stars 92 forks source link

KeyError: 'type' #85

Closed conradekisa closed 2 years ago

conradekisa commented 2 years ago

Hi,

There seems to be an issue with specifically the auxiliary/scanner/scada/modbusclient module. When I try to use pymetasploit3 to set the ACTION, below is the error I get:

Traceback (most recent call last):
  File "automate_msfconsole.py", line 142, in read_input_registers
    auxiliary["ACTION"] = "READ_HOLDING_REGISTERS"
  File "/root/.local/lib/python3.8/site-packages/pymetasploit3/msfrpc.py", line 1364, in __setitem__
    elif self._moptions[key]['type'] == 'bool' and not isinstance(value, bool):
KeyError: 'type'

There seems to be a data type mismatch most likely somewhere in the msfrpc.py assertions that are causing that error.

conradekisa commented 2 years ago

Afew abit of troubleshooting, I noticed that if the default set ACTION seems to work, but modifying the ACTION returns the above error.

As a workaround, I change the default ACTION in the console with pymetasploit using the msfconsole command setg ACTION READ_INPUT_REGISTERS.

This seems to get the module to work. It also means that you need to run that command for every ACTION change you require. Best to write a simple function for that. Take note to use the correct console ID when doing this.