TorBot icon indicating copy to clipboard operation
TorBot copied to clipboard

Connection Refused Error

Open Fankaren opened this issue 2 years ago • 2 comments

Environment

Ubuntu20.04.3 LTS Python3.9.0 pre-built package to install tor TORBOT v2.2

Torrc

services && ports OK

## The directory for keeping all the keys/etc. By default, we store
## things in $HOME/.tor on Unix, and in Application Data\tor on Windows.
DataDirectory /var/lib/tor
GeoIPFile /usr/share/tor/geoip
GeoIPv6File /usr/share/tor/geoip6

## The port on which Tor will listen for local connections from Tor
## controller applications, as documented in control-spec.txt.
ControlPort 9051
## If you enable the controlport, be sure to enable one of these
## authentication methods, to prevent attackers from accessing it.
HashedControlPassword 16:4FD84B3FD0725E5C607415xxxxxxxxxxxx54D969B830CF6DE7A59C2C42
CookieAuthentication 1

I can see the ports bind already. Using netstat -ano| grep 9050 9051

TorBot Error

This is the first error I get:

abc@abc:~/Downloads/TorBot-2.0.0/src$ python3 torBot.py 

                                    
                           __  ____  ____  __        ______
                          / /_/ __ \/ __ \/ /_  ____/_  __/
                         / __/ / / / /_/ / __ \/ __ \/ /
                        / /_/ /_/ / _, _/ /_/ / /_/ / /
                        \__/\____/_/ |_/_____/\____/_/  V2.0.0
              
                    #######################################################
                    #  TorBot - An OSINT Tool for Dark Web                #
                    #  GitHub : https://github.com/DedsecInside/TorBot    #
                    #  Help : use -h for help text                        #
                    #######################################################
                                  LICENSE: GNU Public License v3
              
usage: See torBot.py -h for possible arguments.
Attempting to connect to https://check.torproject.org/
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/urllib3/connection.py", line 159, in _new_conn
    conn = connection.create_connection(
  File "/usr/local/lib/python3.8/dist-packages/urllib3/util/connection.py", line 84, in create_connection
    raise err
  File "/usr/local/lib/python3.8/dist-packages/urllib3/util/connection.py", line 74, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/urllib3/connectionpool.py", line 670, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.8/dist-packages/urllib3/connectionpool.py", line 392, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3.8/http/client.py", line 1256, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1302, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1251, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1011, in _send_output
    self.send(msg)
  File "/usr/lib/python3.8/http/client.py", line 951, in send
    self.connect()
  File "/usr/local/lib/python3.8/dist-packages/urllib3/connection.py", line 187, in connect
    conn = self._new_conn()
  File "/usr/local/lib/python3.8/dist-packages/urllib3/connection.py", line 171, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f4d9d86c580>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/usr/local/lib/python3.8/dist-packages/urllib3/connectionpool.py", line 726, in urlopen
    retries = retries.increment(
  File "/usr/local/lib/python3.8/dist-packages/urllib3/util/retry.py", line 446, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8081): Max retries exceeded with url: /ip (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f4d9d86c580>: Failed to establish a new connection: [Errno 111] Connection refused'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "torBot.py", line 234, in <module>
    main()
  File "torBot.py", line 109, in main
    link_io.print_tor_ip_address()
  File "/home/ctfd/Downloads/TorBot-2.0.0/src/modules/link_io.py", line 19, in print_tor_ip_address
    ip_string = color(GoTor.get_ip(), 'yellow')
  File "/home/ctfd/Downloads/TorBot-2.0.0/src/modules/api.py", line 39, in get_ip
    resp = requests.get(url)
  File "/usr/local/lib/python3.8/dist-packages/requests/api.py", line 76, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/requests/sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.8/dist-packages/requests/sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8081): Max retries exceeded with url: /ip (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f4d9d86c580>: Failed to establish a new connection: [Errno 111] Connection refused'))

I try to modify modules/api.py. change all port from 8081 to 9050. It comes up new error:

abc@abc:~/Downloads/TorBot-2.0.0/src$ python3 torBot.py -u https://github.com/ -i -m

                                    
                           __  ____  ____  __        ______
                          / /_/ __ \/ __ \/ /_  ____/_  __/
                         / __/ / / / /_/ / __ \/ __ \/ /
                        / /_/ /_/ / _, _/ /_/ / /_/ / /
                        \__/\____/_/ |_/_____/\____/_/  V2.0.0
              
                    #######################################################
                    #  TorBot - An OSINT Tool for Dark Web                #
                    #  GitHub : https://github.com/DedsecInside/TorBot    #
                    #  Help : use -h for help text                        #
                    #######################################################
                                  LICENSE: GNU Public License v3
              
Attempting to connect to https://check.torproject.org/
Tor IP Address: <html>
<head>
<title>This is a SOCKS Proxy, Not An HTTP Proxy</title>
</head>
<body>
<h1>This is a SOCKs proxy, not an HTTP proxy.</h1>
<p>
It appears you have configured your web browser to use this Tor port as
an HTTP proxy.
</p><p>
This is not correct: This port is configured as a SOCKS proxy, not
an HTTP proxy. If you need an HTTP proxy tunnel, use the HTTPTunnelPort
configuration option in place of, or in addition to, SOCKSPort.
Please configure your client accordingly.
</p>
<p>
See <a href="[https://www.torproject.org/documentation.html">https://www.torproject.org/documentation.html</a>](https://www.torproject.org/documentation.html%22%3Ehttps://www.torproject.org/documentation.html%3C/a%3E) for more information.
</p>
</body>
</html>

Traceback (most recent call last):
  File "torBot.py", line 234, in <module>
    main()
  File "torBot.py", line 113, in main
    handle_json_args(args)
  File "torBot.py", line 130, in handle_json_args
    email_json = link_io.print_emails(args.url)
  File "/home/ctfd/Downloads/TorBot-2.0.0/src/modules/link_io.py", line 90, in print_emails
    email_list = GoTor.get_emails(url)
  File "/home/ctfd/Downloads/TorBot-2.0.0/src/modules/api.py", line 52, in get_emails
    return resp.json()
  File "/usr/local/lib/python3.8/dist-packages/requests/models.py", line 898, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3/dist-packages/simplejson/__init__.py", line 518, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Could anyone help? Please.

Originally posted by @Fankaren in https://github.com/DedSecInside/TorBot/issues/11#issuecomment-1048373348

Fankaren avatar Feb 23 '22 01:02 Fankaren

I am also facing this issue, did you find any way to resolve it?

nikhil0162 avatar Mar 10 '22 03:03 nikhil0162

Are you running this service? https://github.com/DedSecInside/gotor/tree/ddf4a70738800a5c1587e033721fec4dae854c53

KingAkeem avatar Apr 15 '22 21:04 KingAkeem

@Fankaren @nikhil0162 Please make sure you are running the gotor service before running the torBot

PSNAppz avatar Aug 28 '22 11:08 PSNAppz