rack-detect-tor 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rack-detect-tor.rb +15 -22
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f10504d82ce574db5da49e72d82144b117fb1e3
|
4
|
+
data.tar.gz: 30321c1ddd369a663f97c292c708278b416ff9a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c8d9d5d3184ee346310385849557fb793dc844bf63c81c98d95e8c0d7b27b2531279118b04fafabb76a7167bb8782671c3d59b4984b65a284d9df82f05c69fd
|
7
|
+
data.tar.gz: 4708156c70c9c1dd287c6b2b05e209a0fbf9dcb6478be1b4b45b63b0e8e2548bd6a00304067500e275350bc893230e4c8a1f289b5c78620517b3a392aeead19a
|
data/lib/rack-detect-tor.rb
CHANGED
@@ -33,29 +33,22 @@ module Rack
|
|
33
33
|
private
|
34
34
|
|
35
35
|
def fetch_tor_exits
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
check_url = "https://check.torproject.org/cgi-bin/TorBulkExitList.py?" +
|
49
|
-
"ip=#{@options['external_ip']}" +
|
50
|
-
(@options['external_port'].nil? ? '' : "&port=#{@options['external_port']}")
|
51
|
-
|
52
|
-
begin
|
53
|
-
tor_exit_list = open(check_url).read
|
54
|
-
rescue OpenURI::HTTPError => e
|
55
|
-
log_error "Error fetching list of tor exits: #{e}"
|
36
|
+
begin
|
37
|
+
if @options.select{|k,v| k =~ /^external_/}.values.map{|v| v.to_s}.include? ''
|
38
|
+
log_message "WARNING: external_ip/external_port not specified. " +
|
39
|
+
"Using list of ALL exits. Results will NOT be accurate"
|
40
|
+
|
41
|
+
tor_exits = open('https://check.torproject.org/exit-addresses').read.
|
42
|
+
split("\n").select{|i| i =~ /^ExitAddress/}.map{|j| j.split(' ')[1]}
|
43
|
+
else
|
44
|
+
check_url = "https://check.torproject.org/cgi-bin/TorBulkExitList.py?" +
|
45
|
+
"ip=#{@options['external_ip']}&port=#{@options['external_port']}"
|
46
|
+
|
47
|
+
tor_exits = open(check_url).read.split("\n").select{|i| !(i =~ /^\#/)}
|
56
48
|
end
|
57
|
-
|
58
|
-
|
49
|
+
rescue OpenURI::HTTPError => e
|
50
|
+
log_error "Error fetching list of tor exits (#{e})."
|
51
|
+
return nil
|
59
52
|
end
|
60
53
|
|
61
54
|
log_message "Found #{tor_exits.count} exits."
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-detect-tor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Warren Guy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|