I want to try and use TOR as HTTP proxy, and not SOCKS proxy.
I have issues, where the destination blocks SOCKS and I want to try to check it with HTTP proxy instead.
I did not find any solution for running tor as HTTP proxy.
Thanks.
I want to try and use TOR as HTTP proxy, and not SOCKS proxy.
I have issues, where the destination blocks SOCKS and I want to try to check it with HTTP proxy instead.
I did not find any solution for running tor as HTTP proxy.
Thanks.
The easiest way is to add HTTPTunnelPort 9080
line in your /etc/tor/torrc
file.
After that you'll have localhost:9080
socket open and you can set http_proxy=http://localhost:9080
environment variable to tell applications to use it.
you could try Polipo.
Install:
apt-get install polipo
Then configure the proxy to chain to Tor’s SOCKS proxy, modify /etc/polipo/config:
allowedClients = 127.0.0.1, 192.168.1.0/24 # Expose your network (modify accordingly)
socksParentProxy = "localhost:9050"
socksProxyType = socks5
proxyAddress = "0.0.0.0" # IPv4 only
Or follow this tutorial https://www.marcus-povey.co.uk/2016/03/24/using-tor-as-a-http-proxy/
Polipo is available at: https://github.com/jech/polipo
I tried and it works. However, the performance is not good as expected, since polipo is single-threaded. ;)
There is a Node package that can do this. https://github.com/oyyd/http-proxy-to-socks
Nodejs version >4 is required.
Install it and run from the command line:
hpts -s 127.0.0.1:9050 -p 8080
I was doing an experiment to fix the problem. This is just an alternative answer. This Python script will act as a proxy that forwards HTTP/HTTPS requests to the Tor-Proxy.
import sys
major_version = sys.version_info.major
if major_version == 2:
import SocketServer
import SimpleHTTPServer
elif major_version == 3:
import http.server as SimpleHTTPServer
import socketserver as SocketServer
import requests
PROX_LPORT = 1232 # the proxy port you need to use
def get_tor_session():
session = requests.session()
# Tor uses the 9050 port as the default socks port
session.proxies = {'http': 'socks5://127.0.0.1:9050', 'https': 'socks5://127.0.0.1:9050'}
return session
class LocalProxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
def do_GET(self):
# Make a request through the Tor connection
session = get_tor_session()
self.wfile.write(session.get(self.path).text.encode())
httpd = SocketServer.ForkingTCPServer(('', PROX_LPORT), LocalProxy)
print("serving at port", PROX_LPORT)
httpd.serve_forever()
It works smoothly on Firefox. It's also compatible in both Python 2 and 3.
127.0.0.1 - - [26/Dec/2021 17:16:52] code 501, message Unsupported method ('CONNECT')
–
Plagio © 2022 - 2024 — McMap. All rights reserved.