allfro / pymetasploit

A full-fledged msfrpc library for Metasploit framework.
297 stars 141 forks source link

AttributeError: can't set attribute (on option attribute) #11

Open Mikaayenson opened 7 years ago

Mikaayenson commented 7 years ago
>>> from metasploit.msfrpc import MsfRpcClient
>>> client = MsfRpcClient('1oP619Xd', server='10.0.0.42', port=55553, ssl=False)
>>> client.modules.use('exploit', 'exploit/windows/smb/ms08_067_netapi')
Traceback (most recent call last):
  File "<input>", line 1, in <module>
    client.modules.use('exploit', 'osx/browser/software_update')
  File "/Library/Python/2.7/site-packages/metasploit/msfrpc.py", line 1661, in use
    return ExploitModule(self.rpc, mname)
  File "/Library/Python/2.7/site-packages/metasploit/msfrpc.py", line 1486, in __init__
    super(ExploitModule, self).__init__(rpc, 'exploit', exploit)
  File "/Library/Python/2.7/site-packages/metasploit/msfrpc.py", line 1327, in __init__
    setattr(self, k, self._info.get(k))
AttributeError: can't set attribute
Mikaayenson commented 7 years ago

I believe this is because ModuleInfo now includes an attribute called options and we have a property options. https://github.com/allfro/pymetasploit/blob/master/src/metasploit/msfrpc.py#L1330

utkusen commented 6 years ago

Your commit fixes the "AttributeError: can't set attribute" problem. Thank you so much. However I got another error with your fork. I always get "Connection refused" error when it tries to connect msfrpc. That's why I merged only commit e493c36 for myself and it works now.

Mikaayenson commented 6 years ago

How are you loading msfrpc?

utkusen commented 6 years ago

from metasploit.msfrpc import MsfRpcClient client = MsfRpcClient('passss')