allfro / pymetasploit

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

Fixed MSF console interactions and AttributeError when using modules #18

Open DanMcInerney opened 6 years ago

DanMcInerney commented 6 years ago

The console interactions were messed up.

client.consoles.list used to return: {u'consoles': [{u'busy': False, u'id': u'2', u'prompt': u'msf > '}]}

This is wrong because when you call client.consoles.console('2') you get an error saying that console doesn't exist. This is because:

s = self.list
if cid is None:
    return MsfConsole(self.rpc)
if cid not in s:
    raise KeyError('Console ID (%s) does not exist' % cid)
else:
    return MsfConsole(self.rpc, cid=cid)

You can see that s will just equal 'console' and not the id. I fixed this.

allfro commented 2 years ago

Please check the latest merge to see if this is still an issue.