DedSecInside/TorBot

Resolution of onion domains?

3ntr0phy opened this issue · 1 comments

I am trying to gather info regarding some random onion domains but I keep encountering the following error

python3 torBot.py -u http://56dlutemceny6ncaxolpn6lety2cqfz5fd64nx4ohevj4a7ricixwzad.onion -i

                                    
                           __  ____  ____  __        ______
                          / /_/ __ \/ __ \/ /_  ____/_  __/
                         / __/ / / / /_/ / __ \/ __ \/ /
                        / /_/ /_/ / _, _/ /_/ / /_/ / /
                        \__/\____/_/ |_/_____/\____/_/  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: 81.17.18.58
Traceback (most recent call last):
  File "/home/ciccio/.cache/pypoetry/virtualenvs/torbot-z3u_-ly5-py3.8/lib/python3.8/site-packages/urllib3/connection.py", line 174, in _new_conn
    conn = connection.create_connection(
  File "/home/ciccio/.cache/pypoetry/virtualenvs/torbot-z3u_-ly5-py3.8/lib/python3.8/site-packages/urllib3/util/connection.py", line 72, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/usr/lib/python3.8/socket.py", line 918, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ciccio/.cache/pypoetry/virtualenvs/torbot-z3u_-ly5-py3.8/lib/python3.8/site-packages/urllib3/connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "/home/ciccio/.cache/pypoetry/virtualenvs/torbot-z3u_-ly5-py3.8/lib/python3.8/site-packages/urllib3/connectionpool.py", line 398, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/home/ciccio/.cache/pypoetry/virtualenvs/torbot-z3u_-ly5-py3.8/lib/python3.8/site-packages/urllib3/connection.py", line 239, in request
    super(HTTPConnection, self).request(method, url, body=body, headers=headers)
  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 "/home/ciccio/.cache/pypoetry/virtualenvs/torbot-z3u_-ly5-py3.8/lib/python3.8/site-packages/urllib3/connection.py", line 205, in connect
    conn = self._new_conn()
  File "/home/ciccio/.cache/pypoetry/virtualenvs/torbot-z3u_-ly5-py3.8/lib/python3.8/site-packages/urllib3/connection.py", line 186, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f50b4ac7580>: Failed to establish a new connection: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ciccio/.cache/pypoetry/virtualenvs/torbot-z3u_-ly5-py3.8/lib/python3.8/site-packages/requests/adapters.py", line 440, in send
    resp = conn.urlopen(
  File "/home/ciccio/.cache/pypoetry/virtualenvs/torbot-z3u_-ly5-py3.8/lib/python3.8/site-packages/urllib3/connectionpool.py", line 785, in urlopen
    retries = retries.increment(
  File "/home/ciccio/.cache/pypoetry/virtualenvs/torbot-z3u_-ly5-py3.8/lib/python3.8/site-packages/urllib3/util/retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='56dlutemceny6ncaxolpn6lety2cqfz5fd64nx4ohevj4a7ricixwzad.onion', port=80): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f50b4ac7580>: Failed to establish a new connection: [Errno -2] Name or service not known'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "torBot.py", line 235, in <module>
    main()
  File "torBot.py", line 117, in main
    execute_all(args.url)
  File "/home/ciccio/Documents/TorBot/src/modules/info.py", line 41, in execute_all
    response = requests.get(link)
  File "/home/ciccio/.cache/pypoetry/virtualenvs/torbot-z3u_-ly5-py3.8/lib/python3.8/site-packages/requests/api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "/home/ciccio/.cache/pypoetry/virtualenvs/torbot-z3u_-ly5-py3.8/lib/python3.8/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/ciccio/.cache/pypoetry/virtualenvs/torbot-z3u_-ly5-py3.8/lib/python3.8/site-packages/requests/sessions.py", line 529, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/ciccio/.cache/pypoetry/virtualenvs/torbot-z3u_-ly5-py3.8/lib/python3.8/site-packages/requests/sessions.py", line 645, in send
    r = adapter.send(request, **kwargs)
  File "/home/ciccio/.cache/pypoetry/virtualenvs/torbot-z3u_-ly5-py3.8/lib/python3.8/site-packages/requests/adapters.py", line 519, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='56dlutemceny6ncaxolpn6lety2cqfz5fd64nx4ohevj4a7ricixwzad.onion', port=80): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f50b4ac7580>: Failed to establish a new connection: [Errno -2] Name or service not known'))

while for any non-onion domain it seems to work correctly.

I have gotor server running and tor with the following config:

ControlPort 9051
CookieAuthentication 1
HashedControlPassword 16:8615008E42761CB9606E6A744FD323C350C24B4729893992747D8259F7

If I run it without flags it seems to work correctly

python3 torBot.py -u http://56dlutemceny6ncaxolpn6lety2cqfz5fd64nx4ohevj4a7ricixwzad.onion/

                                    
                           __  ____  ____  __        ______
                          / /_/ __ \/ __ \/ /_  ____/_  __/
                         / __/ / / / /_/ / __ \/ __ \/ /
                        / /_/ /_/ / _, _/ /_/ / /_/ / /
                        \__/\____/_/ |_/_____/\____/_/  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: 109.70.100.78
http://56dlutemceny6ncaxolpn6lety2cqfz5fd64nx4ohevj4a7ricixwzad.onion/ 200 OK 
http://zqktlwiuavvvqqt4ybvgvi7tyo4hjl5xgfuvpdf6otjiycgwqbym2qad.onion/wiki/Main_Page 200 OK 

Do I need to make any change to my DNS? It seems such an issue

You basically need to replace requests with

session = requests.session()
session.proxies = {'http':  'socks5h://localhost:9050',
                   'https': 'socks5h://localhost:9050'}

in all the modules.
I will make a pull request