praetorian-inc/gato

Connection refused via proxy

Closed this issue · 3 comments

Hi all, when running the search via the local Burp proxy on 8080 I am getting [Errno 111] 'Connection refused' - has anybody managed to run gato via proxy successfully?

$ gato -p localhost:8080 search --target sshayb
...
Traceback (most recent call last):
  File "/home/shay/git/gato/venv/lib/python3.10/site-packages/urllib3/connection.py", line 203, in _new_conn
    sock = connection.create_connection(
  File "/home/shay/git/gato/venv/lib/python3.10/site-packages/urllib3/util/connection.py", line 85, in create_connection
    raise err
  File "/home/shay/git/gato/venv/lib/python3.10/site-packages/urllib3/util/connection.py", line 73, 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 "/home/shay/git/gato/venv/bin/gato", line 8, in <module>
    sys.exit(entry())
  File "/home/shay/git/gato/venv/lib/python3.10/site-packages/gato/main.py", line 6, in entry
    sys.exit(cli.cli(sys.argv[1:]))
  File "/home/shay/git/gato/venv/lib/python3.10/site-packages/gato/cli/cli.py", line 83, in cli
    arguments.func(arguments, subparsers)
  File "/home/shay/git/gato/venv/lib/python3.10/site-packages/gato/cli/cli.py", line 242, in enumerate
    orgs = [gh_enumeration_runner.enumerate_organization(
  File "/home/shay/git/gato/venv/lib/python3.10/site-packages/gato/enumerate/enumerate.py", line 146, in enumerate_organization
    if not self.__setup_user_info():
  File "/home/shay/git/gato/venv/lib/python3.10/site-packages/gato/enumerate/enumerate.py", line 64, in __setup_user_info
    self.user_perms = self.api.check_user()
  File "/home/shay/git/gato/venv/lib/python3.10/site-packages/gato/github/api.py", line 620, in check_user
    result = self.call_get('/user')
  File "/home/shay/git/gato/venv/lib/python3.10/site-packages/gato/github/api.py", line 248, in call_get
    api_response = requests.get(request_url, headers=get_header,
  File "/home/shay/git/gato/venv/lib/python3.10/site-packages/requests/api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
  File "/home/shay/git/gato/venv/lib/python3.10/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/shay/git/gato/venv/lib/python3.10/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/shay/git/gato/venv/lib/python3.10/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
  File "/home/shay/git/gato/venv/lib/python3.10/site-packages/requests/adapters.py", line 513, in send
    raise ProxyError(e, request=request)
requests.exceptions.ProxyError: HTTPSConnectionPool(host='api.github.com', port=443): Max retries exceeded with url: /user (Caused by ProxyError('Unable to connect to proxy', NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f23cd2e6170>: Failed to establish a new connection: [Errno 111] Connection refused')))```

Hey! Taking a look at this now.

It's been a little while since we've looked at proxying, but should be easy to replicate.

@sshayb Proxying seems to be working for me on the current main branch. Can you confirm that your proxy is behaving as expected?

Something like: curl -x 'http://localhost:8080' 'https://api.github.com/repos/praetorian-inc/gato' should be a quick test.

You are correct, its the connection from my docker that's failing 🤦