In a Python Metasploit module that I'm developing, I am trying to use CMD
as one of the options:
'options': { 'RHOST': {'type': 'address', 'description': 'Target address', 'required': True, 'default': None}, 'RPORT': {'type': 'port', 'description': 'Target port', 'required': True, 'default': 80}, 'CMD': {'type': 'string', 'description': 'Command to execute', 'required': True, 'default': 'whoami'} }
However, when I print the args, CMD
isn't set to the default value:
Args: {'RPORT': '9999', 'VERBOSE': 'false', 'THREADS': '1', 'ShowProgress': 'true', 'ShowProgressPercent':'10', 'UNPARSED_RHOSTS': '0.0.0.0', 'RHOSTNAME': '', 'RHOSTS': '0.0.0.0', 'WORKSPACE': '', 'RHOST': '0.0.0.0', 'rhost': '0.0.0.0'}
And when I try to use set CMD whoami
, I get the error Unknown datastore option: CMD.
. What am I doing wrong? Am I only allowed to use certain names for my options?
I can see in modules/auxiliary/admin/sap/cve_2020_6207_solman_rce.rb
that COMMAND
is used as a datastore option, so I tried that as well and ran into the same issue as with CMD
.
RPORT
isn't the default. And you have 3rhost
fields. I think there is more wrong here than just the one field.RPORT
to that value, and forRHOST
there are two set, one all caps and one lowercase, with a third beingRHOSTS
. Not sure why, but AFAICT those shouldn't affect functionality if I don't reference them. @schroeder any ideas what might be going wrong or how to fix it?args