Using CURL with TOR as a Proxy on CentOs

Wilhelm picture Wilhelm · Aug 31, 2016 · Viewed 7.7k times · Source

I want to use Tor as a proxy for HTTP-requests with curl or wget on a CentOS Machine. I used this How-to and I looked for some answers on stackexchange and stackoverflow. https://medium.com/the-sysadmin/using-tor-for-your-shell-script-fee9d8bdef5c#.9ixz30jbn

If I typing into my shell 'tor' I get this:

Aug 31 21:01:29.871 [notice] Tor v0.2.8.6 running on Linux with Libevent 2.0.22-stable, OpenSSL 1.0.2h and Zlib 1.2.8.
Aug 31 21:01:29.871 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning
Aug 31 21:01:29.871 [notice] Read configuration file "/home/wmjio5f6/.linuxbrew/etc/tor/torrc".
Aug 31 21:01:29.909 [warn] ControlPort is open, but no authentication method has been configured.  This means that any program on your computer can reconfigure your Tor.  That's bad!  You should upgrade your Tor controller as soon as possible.
Aug 31 21:01:29.937 [notice] Opening Socks listener on 127.0.0.1:9050
Aug 31 21:01:29.939 [notice] Opening Control listener on 127.0.0.1:9151
Aug 31 21:01:29.000 [notice] Parsing GEOIP IPv4 file /home/wmjio5f6/.linuxbrew/Cellar/tor/0.2.8.6/share/tor/geoip.
Aug 31 21:01:30.000 [notice] Parsing GEOIP IPv6 file /home/wmjio5f6/.linuxbrew/Cellar/tor/0.2.8.6/share/tor/geoip6.
Aug 31 21:01:30.000 [notice] Bootstrapped 0%: Starting
Aug 31 21:01:31.000 [notice] Bootstrapped 80%: Connecting to the Tor network
Aug 31 21:01:32.000 [notice] Bootstrapped 85%: Finishing handshake with first hop
Aug 31 21:01:32.000 [notice] Bootstrapped 90%: Establishing a Tor circuit
Aug 31 21:01:32.000 [notice] Tor has successfully opened a circuit. Looks like client functionality is working.
Aug 31 21:01:32.000 [notice] Bootstrapped 100%: Done

Where is my error, or wich command is the right?

Answer

drew010 picture drew010 · Sep 1, 2016

You've made no mistake. That output indicates that Tor launched, connected to the network and is running. You'll probably want to figure out how to daemonize it, or run it in the background (nohup tor &).

The line Opening Socks listener on 127.0.0.1:9050 tells you that it's SOCKS (proxy) port is listening on port 9050. This is the port you want applications like curl or wget to proxy through.

As shown in the article you linked, you just need to run curl using Tor's SOCKS port.

curl -s --socks5-hostname 127.0.0.1:9050 http://www.showmyip.gr