Connect to Tor network with ruby

前端 未结 4 1305
故里飘歌
故里飘歌 2021-02-05 12:03

how can I configure Ruby web client to request web pages using Tor ?

相关标签:
4条回答
  • 2021-02-05 12:23

    Created a Gem, maybe can help others: https://github.com/brunogh/tor_requests

    0 讨论(0)
  • 2021-02-05 12:25

    I think it's like specifying proxy server for your HTTP connection. I don't know how it works in Ruby. But it will not be different from configuring browsers. Just set proxy server setting to 127.0.0.1:8118.

    0 讨论(0)
  • 2021-02-05 12:30

    You just need to work with the Proxy class. As Ivan says above, get Tor running then point Net::HTTP.Proxy at the correct localhost address and you're golden.

    0 讨论(0)
  • 2021-02-05 12:31

    I had to use this Gem http://socksify.rubyforge.org/ then I was able to do something like this

    TCPSocket::socks_server = "127.0.0.1"
    TCPSocket::socks_port = 9050
    reply = Net::HTTP.get URI.parse("www.google.com")
    

    Obviously with the Tor proxy running.

    0 讨论(0)
提交回复
热议问题