pymetasploit
pymetasploit copied to clipboard
problem CannotSendRequest
...
client = MsfRpcClient('password')
# cb - callback function, executes when data arrives to console
console = MsfRpcConsole(client, cb=read_console)
...
console.execute('use auxiliary/scanner/smb/smb_ms17_010')
console.execute('set RHOSTS 192.168.0.0/24')
console.execute('set THREADS 20')
console.execute('run')
...
exploit = client.modules.use('exploit', 'windows/smb/ms17_010_psexec')
Exception in thread Thread-101: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner self.run() File "/usr/lib/python2.7/threading.py", line 1082, in run self.function(*self.args, **self.kwargs) File "build/bdist.linux-x86_64/egg/metasploit/msfconsole.py", line 60, in _poller d = self.console.read() File "build/bdist.linux-x86_64/egg/metasploit/msfrpc.py", line 1907, in read return self.rpc.call(MsfRpcMethod.ConsoleRead, self.cid) File "build/bdist.linux-x86_64/egg/metasploit/msfrpc.py", line 237, in call self.client.request('POST', self.uri, packb(l), self._headers) File "/usr/lib/python2.7/httplib.py", line 1039, in request self._send_request(method, url, body, headers) File "/usr/lib/python2.7/httplib.py", line 1067, in _send_request self.putrequest(method, url, **skips) File "/usr/lib/python2.7/httplib.py", line 921, in putrequest raise CannotSendRequest() CannotSendRequest
help me what is the reason?
Is your msfrpc server running locally with the port as 55553 and password as 'password'??
Do you try to run a lot of "client.modules.use" in thread ?