0

I’m using Rails 4.2.7. I have the following code that uses Net::HTTP to get a web page

http = Net::HTTP.new(host, 443)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
path = '/'
resp, data = http.get(path, nil)

What I want to do is programmatically anonymize my IP address when I make the above request, similar to what is done in those TOR browsers. Is there some way to route this through a TOR browser and get the response programmatically? That sounds really complicated and I’m thinking there is a simpler solution but I float this out there to the group.

  • Why don't you use a different server then what `Rails Server` spin it up and point it to the build folder of where your solution is. Example, in C# when developing code -> you point your build folder to IIS. Since Ruby is built on C I am sure it works the same way with of course some modifications. – jdave Aug 26 '16 at 20:41
  • Yeah but requests taht originate from your Rails server always have the same IP address, right? I want to make it such taht the site from which I'm requesting data does not know my IP address. –  Aug 28 '16 at 16:57

1 Answers1

0

You can't do it without a network of various IPs to proxy your requests (that's why TOR has nodes all over the world)

If you spoof the originating ip in the http request the TCP handshake will fail and your request won't reach the server.

Connecting to TOR node is your best bet, and it isn't too complicated. See How to Build and Send an HTTP Request to a Tor Hidden Service with Ruby

Community
  • 1
  • 1
Marko Kacanski
  • 423
  • 9
  • 17