2014-02-25 31 views
2

我花了幾天的時間尋找這個問題的解決方案,雖然有很多半相關的問題,但沒有一個答案顯示了一個成功的用例,用於通過Tor將成功的HTTP請求發送到使用Ruby的隱藏服務。如何使用Ruby構建併發送HTTP請求到Tor隱藏服務

在所有答案中似乎不清楚的一件事是,Tor瀏覽器包如何充當請求的代理。

我嘗試了多種攻擊途徑,最近的嘗試是嘗試使用Ruby CURL庫將隱藏服務的curl請求發送到curl請求the PHP code here

這是使用路邊的寶石我的代碼,它實現了一些libcurl中綁定的Ruby:

require 'curb' 

url = 'http://am4wuhz3zifexz5u.onion' #a known, functioning hidden service 

c = Curl::Easy.new(url) do |curl| 
    curl.headers["User-Agent"] = "Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Firefox/24.0" #the user agent string from the most recent version of the tor browser 
    curl.verbose = true 
end 

c.perform 
c.inspect 

然後我試圖通過socksify運行此,使用Tor瀏覽器中指定的IP地址和端口束的代理設置:

$ socksify_ruby 127.0.0.1 9150 tor-test/tor-test.rb 

這產生以下輸出:

* Adding handle: conn: 0x7fb1fe195e00 
* Adding handle: send: 0 
* Adding handle: recv: 0 
* Curl_addHandleToPipeline: length: 1 
* - Conn 0 (0x7fb1fe195e00) send_pipe: 1, recv_pipe: 0 
* Could not resolve host: jhiwjjlqpyawmpjx.onion 
* Closing connection 0 

每一個方法我試過都產生了相似的結果:的URI隱藏服務無法解析

誰能幫助我在這裏或點我在正確的方向?我覺得由於Tor瀏覽器可以通過編程方式連接到隱藏服務,因此我們都應該能夠:)

回答

相關問題