Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

tc_socksify: only use check.torproject.org, not www.whatismyip.org

  • Loading branch information...
commit bbbfe5434db21fd5d59164fad7aa62583a0026a2 1 parent 740430d
Astro authored

Showing 1 changed file with 4 additions and 12 deletions. Show diff stats Hide diff stats

  1. 16  test/tc_socksify.rb
16  test/tc_socksify.rb
@@ -82,30 +82,22 @@ def check_tor(http_klass = Net::HTTP)
82 82
   end
83 83
 
84 84
   def check_tor_ip(http_klass = Net::HTTP)
85  
-    url = URI::parse('http://209.237.247.84/')
  85
+    url = URI::parse('http://38.229.70.31/')  # "check.torproject.org"
86 86
     parse_check_response(http_klass.start(url.host, url.port) do |http|
87 87
                            http.get('/',
88  
-                                    "Host"=>"www.whatismyip.org",
  88
+                                    "Host"=>"check.torproject.org",
89 89
                                     "User-Agent"=>"ruby-socksify test").body
90 90
                          end)
91 91
   end
92 92
 
93 93
   def parse_check_response(body)
94 94
     if body.include? 'Your browser is configured to use Tor.'
95  
-      is_tor = true
  95
+      true
96 96
     elsif body.include? 'You are not using Tor.'
97  
-      is_tor = false
  97
+      false
98 98
     else
99 99
       raise 'Bogus response'
100 100
     end
101  
-
102  
-    if body =~ /Your IP address appears to be: <b>(\d+\.\d+\.\d+\.\d+)<\/b>/
103  
-      ip = $1
104  
-    else
105  
-      raise 'Bogus response, no IP'
106  
-    end
107  
-
108  
-    [is_tor, ip]
109 101
   end
110 102
 
111 103
   def test_resolve

0 notes on commit bbbfe54

Please sign in to comment.
Something went wrong with that request. Please try again.