Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

socket.error is not solving #6

Closed
lokesh1095 opened this issue May 11, 2016 · 5 comments
Closed

socket.error is not solving #6

lokesh1095 opened this issue May 11, 2016 · 5 comments

Comments

@lokesh1095
Copy link

lokesh1095 commented May 11, 2016

when i try to run command client = MsfRpcClient('lokesh1095')
i get following error. i tried many things but error is persistent. cant solve it. any help??

Traceback (most recent call last):
  File "/root/Documents/attckByMSF.py", line 6, in <module>
    client = MsfRpcClient('mypassword')
  File "/root/Documents/pymetasploit-master/src/metasploit/msfrpc.py", line 213, in **init**
    self.login(kwargs.get('username', 'msf'), password)
  File "/root/Documents/pymetasploit-master/src/metasploit/msfrpc.py", line 315, in login
    r = self.call(MsfRpcMethod.AuthLogin, username, password)
  File "/root/Documents/pymetasploit-master/src/metasploit/msfrpc.py", line 230, in call
    self.client.request('POST', self.uri, packb(l), self._headers)
  File "/usr/lib/python2.7/httplib.py", line 1057, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python2.7/httplib.py", line 1097, in _send_request
    self.endheaders(body)
  File "/usr/lib/python2.7/httplib.py", line 1053, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 897, in _send_output
    self.send(msg)
  File "/usr/lib/python2.7/httplib.py", line 859, in send
    self.connect()
  File "/usr/lib/python2.7/httplib.py", line 1270, in connect
    HTTPConnection.connect(self)
  File "/usr/lib/python2.7/httplib.py", line 836, in connect
    self.timeout, self.source_address)
  File "/usr/lib/python2.7/socket.py", line 575, in create_connection
    raise err
socket.error: [Errno 111] Connection refused
@JohnTroony
Copy link

Do you have Metasploit service running? service metasploit start

@devcoinfet
Copy link

yes I do have metasploit service running I have updated to the suggested version and I see nothing but this Error above as well

@DanMcInerney
Copy link

DanMcInerney commented Mar 3, 2018

This library was just working for me after adding the try/excepts for the ssl library from another issue. Now 100% of the time I'm getting connection refused as well. Restart metasploit, tried running metasploit as a daemon, and it's just constantly saying connection refused.

I can confirm metasploit is running and msfrpcd is running as well.

COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
ruby    17384 root    9u  IPv4 243289      0t0  TCP *:55553 (LISTEN)

@DanMcInerney
Copy link

DanMcInerney commented Mar 3, 2018

OK well, apparently adding the port option to MsfRpcClient will fix this.

client = MsfRpcClient(password, port=55553) # works.
client = MsfRpcClient(password) # does not

What's weird is that in the code it says port will default to 55553 so I have no idea why adding that parameter with the value it already has by default makes it work.

@devcoinfet
Copy link

devcoinfet commented Mar 4, 2018 via email

@allfro allfro closed this as completed Apr 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants