kgregor98 / grass

A Docker Image for getgrass.io
GNU General Public License v3.0
77 stars 58 forks source link

Proxy support [DEV] #13

Closed Naster17 closed 6 months ago

Naster17 commented 8 months ago

Im trying use proxychains4 with socks4 and socks5 proxy.

┌──(kali㉿kali-raspberry-pi)-[~/grass/src]
└─$ proxychains4 python main.py
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/aarch64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.16
Debugging is enabled! This will generate a screenshot and console logs on error!
Downloading extension...
[proxychains] Strict chain  ...  184.181.217.206:4145  ...  clients2.google.com:443  ...  OK
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 715, in urlopen
    httplib_response = self._make_request(
                       ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 404, in _make_request
    self._validate_conn(conn)
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 1056, in _validate_conn
    conn.connect()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 419, in connect
    self.sock = ssl_wrap_socket(
                ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/urllib3/util/ssl_.py", line 449, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/urllib3/util/ssl_.py", line 493, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/ssl.py", line 517, in wrap_socket
    return self.sslsocket_class._create(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/ssl.py", line 1075, in _create
    self.do_handshake()
  File "/usr/lib/python3.11/ssl.py", line 1346, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1002)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 486, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 799, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='clients2.google.com', port=443): Max retries exceeded with url: /service/update2/crx?response=redirect&prodversion=98.0.4758.102&acceptformat=crx2,crx3&x=id%3Dilehaonighjijnmpnagapkhpcdbhclfg%26uc&nacl_arch=x86-64 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1002)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/kali/grass/src/main.py", line 81, in <module>
    download_extension(extensionId)
  File "/home/kali/grass/src/main.py", line 51, in download_extension
    r = requests.get(url, stream=True, headers=headers)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/requests/api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 517, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='clients2.google.com', port=443): Max retries exceeded with url: /service/update2/crx?response=redirect&prodversion=98.0.4758.102&acceptformat=crx2,crx3&x=id%3Dilehaonighjijnmpnagapkhpcdbhclfg%26uc&nacl_arch=x86-64 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1002)')))
Naster17 commented 8 months ago

Script normaly work with out proxy. But i wont to add proxy support to it

Naster17 commented 8 months ago

Some updates if download extention later and disable part where you trying download extention.

 proxychains4 python main.py
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/aarch64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.16
Debugging is enabled! This will generate a screenshot and console logs on error!
Downloading extension...
Downloaded! Installing extension and driver manager...
Installed! Starting...
Could not start with Manager! Trying to default to manual path...
[proxychains] Strict chain  ...  162.55.87.48:5566  ...  127.0.0.1:49037 <--denied
[proxychains] Strict chain  ...  162.55.87.48:5566  ...  127.0.0.1:49037 <--denied
[proxychains] Strict chain  ...  162.55.87.48:5566  ...  127.0.0.1:49037 <--denied
[proxychains] Strict chain  ...  162.55.87.48:5566  ...  127.0.0.1:49037 <--denied
[proxychains] Strict chain  ...  162.55.87.48:5566  ...  127.0.0.1:49037 <--denied
[proxychains] Strict chain  ...  162.55.87.48:5566  ...  127.0.0.1:49037 <--denied
[proxychains] Strict chain  ...  162.55.87.48:5566  ...  127.0.0.1:49037 <--denied
[proxychains] Strict chain  ...  162.55.87.48:5566  ...  127.0.0.1:49037
Woshishee commented 8 months ago

It might be better to use software's like Tun2Socks or Redsocks instead of Proxychains for this use case.

engageub commented 6 months ago

It might be better to use software's like Tun2Socks or Redsocks instead of Proxychains for this use case.

Yes, for proxy support you may use the following which uses this image.

https://github.com/engageub/InternetIncome

Thank you