tor 0.1.5 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7be2c2b80fea90e1b3e9567624a442d4b3d1a92946f72d6b465280ad4b5d0ec8
4
- data.tar.gz: 96358536b8479ea4fba83fb236dabb6b743074c058a48a6fbfe435bf00ab5bbc
3
+ metadata.gz: a9f4d7cdee4cdba315a7851d2cad22501ee89d35fc9e16a8fbc8e817948a13e9
4
+ data.tar.gz: 1e45634091d9c257e26cf5e60eeb71f1c38fadb4da9ebfbf1879427d2d4e7622
5
5
  SHA512:
6
- metadata.gz: b961dc19ac6f692cbade5226a895782c311cf6463fd228595ee4044085de9340f6948e852c981649c63abfd0abd01665d3fd7cabf2970815be6f87541b8158ee
7
- data.tar.gz: cbecd4beddfd8d543d79233ea2f116609204550f0366a091aacac9573eae593e08c2d5c663020b56713ea6fc46b6dbb2ca39aa6b4e0e1686bb30d6ae7c7b2a7c
6
+ metadata.gz: 402c526509d4e023171f22ad0b5078d834d06f45eb2e4ad500b5693d9af41300ddba663418e41f30db7bcc8ca2632800d1f4b11e78608358c1e96635b50d8ef4
7
+ data.tar.gz: d9c06427dd10c3e50c4c30486e2a0814bd0732e7be9b3e94d07d27dc4d467be5aff96652766e03270d5535103e6557b98318de0497fa612a10c4ee917668cf2b
data/AUTHORS CHANGED
@@ -1,2 +1 @@
1
1
  * Arto Bendiken <arto.bendiken@gmail.com>
2
- * Łukasz Wieczorek <wieczorek1990@gmail.com>
data/CREDITS CHANGED
@@ -0,0 +1 @@
1
+ * Łukasz Wieczorek <wieczorek1990@gmail.com>
data/README.md ADDED
@@ -0,0 +1,101 @@
1
+ Tor.rb: Onion Routing for Ruby
2
+ ==============================
3
+
4
+ This is a Ruby library for interacting with the [Tor][] anonymity network.
5
+
6
+ * <http://github.com/bendiken/tor-ruby>
7
+
8
+ Features
9
+ --------
10
+
11
+ * Supports checking whether Tor is installed in the user's current `PATH`,
12
+ and if it is, returning the version number.
13
+ * Supports parsing Tor configuration files and looking up the values of
14
+ particular options.
15
+ * Supports querying and controlling a locally-running Tor process using the
16
+ [Tor Control Protocol (TC)][TC] over a socket connection.
17
+ * Supports querying the [Tor DNS Exit List (DNSEL)][TorDNSEL] to determine
18
+ whether a particular host is a Tor exit node or not.
19
+ * Compatible with Ruby 1.8.7+, Ruby 1.9.x, and JRuby 1.4/1.5.
20
+
21
+ Examples
22
+ --------
23
+
24
+ require 'rubygems'
25
+ require 'tor'
26
+
27
+ ### Checking whether Tor is installed and which version it is
28
+
29
+ Tor.available? #=> true
30
+ Tor.version #=> "0.2.1.25"
31
+
32
+ ### Parsing the Tor configuration file (1)
33
+
34
+ torrc = Tor::Config.load("/etc/tor/torrc")
35
+
36
+ ### Parsing the Tor configuration file (2)
37
+
38
+ Tor::Config.open("/etc/tor/torrc") do |torrc|
39
+ puts "Tor SOCKS port: #{torrc['SOCKSPort']}"
40
+ puts "Tor control port: #{torrc['ControlPort']}"
41
+ puts "Tor exit policy:"
42
+ torrc.each('ExitPolicy') do |key, value|
43
+ puts " #{value}"
44
+ end
45
+ end
46
+
47
+ ### Communicating with a running Tor process
48
+
49
+ Tor::Controller.connect(:port => 9051) do |tor|
50
+ puts "Tor version: #{tor.version}"
51
+ puts "Tor config file: #{tor.config_file}"
52
+ end
53
+
54
+ ### Checking whether a particular host is a Tor exit node
55
+
56
+ Tor::DNSEL.include?("185.220.101.21") #=> true
57
+ Tor::DNSEL.include?("1.2.3.4") #=> false
58
+
59
+ Dependencies
60
+ ------------
61
+
62
+ * [Ruby](http://ruby-lang.org/) (>= 1.8.7) or (>= 1.8.1 with [Backports][])
63
+ * [Tor](https://www.torproject.org/download.html.en) (>= 0.2.1)
64
+
65
+ Installation
66
+ ------------
67
+
68
+ The recommended installation method is via [RubyGems](http://rubygems.org/).
69
+ To install the latest official release of Tor.rb, do:
70
+
71
+ % [sudo] gem install tor # Ruby 1.8.7+ or 1.9.x
72
+ % [sudo] gem install backports tor # Ruby 1.8.1+
73
+
74
+ Download
75
+ --------
76
+
77
+ To get a local working copy of the development repository, do:
78
+
79
+ % git clone git://github.com/bendiken/tor-ruby.git
80
+
81
+ Alternatively, you can download the latest development version as a tarball
82
+ as follows:
83
+
84
+ % wget http://github.com/bendiken/tor-ruby/tarball/master
85
+
86
+ Author
87
+ ------
88
+
89
+ * [Arto Bendiken](mailto:arto.bendiken@gmail.com) - <http://ar.to/>
90
+
91
+ License
92
+ -------
93
+
94
+ Tor.rb is free and unencumbered public domain software. For more
95
+ information, see <http://unlicense.org/> or the accompanying UNLICENSE file.
96
+
97
+ [Tor]: https://www.torproject.org/
98
+ [TorDNSEL]: https://www.torproject.org/tordnsel/
99
+ [TC]: http://gitweb.torproject.org/tor.git?a=blob_plain;hb=HEAD;f=doc/spec/control-spec.txt
100
+ [OR]: http://en.wikipedia.org/wiki/Onion_routing
101
+ [Backports]: http://rubygems.org/gems/backports
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.5
1
+ 0.1.7
data/lib/tor/config.rb CHANGED
@@ -47,9 +47,9 @@ module Tor
47
47
  File.open(filename.to_s, 'rb') do |file|
48
48
  file.each_line do |line|
49
49
  case line = line.strip.chomp.strip
50
- when '' then next # skip empty lines
51
- when /^#/ then next # skip comments
52
- else line = line.split('#').first.strip
50
+ when '' then next # skip empty lines
51
+ when /^#/ then next # skip comments
52
+ else line = line.split('#').first.strip
53
53
  end
54
54
  # TODO: support for unquoting and unescaping values
55
55
  config << line.split(/\s+/, 2)
@@ -97,6 +97,7 @@ module Tor
97
97
  # @return [Enumerator]
98
98
  def each(key = nil, &block)
99
99
  return enum_for(:each, key) unless block_given?
100
+
100
101
  key ? @lines.find_all { |k, v| key === k }.each(&block) : @lines.each(&block)
101
102
  end
102
103
  end
data/lib/tor/control.rb CHANGED
@@ -152,11 +152,11 @@ module Tor
152
152
  loop do
153
153
  # TODO: support for reading multiple authentication methods
154
154
  case reply = read_reply
155
- when /^250-AUTH METHODS=(\w*)/
156
- method = $1.strip.downcase.to_sym
157
- method = method.eql?(:null) ? nil : method
158
- when /^250-/ then next
159
- when '250 OK' then break
155
+ when /^250-AUTH METHODS=(\w*)/
156
+ method = $1.strip.downcase.to_sym
157
+ method = method.eql?(:null) ? nil : method
158
+ when /^250-/ then next
159
+ when '250 OK' then break
160
160
  end
161
161
  end
162
162
  method
@@ -192,8 +192,8 @@ module Tor
192
192
  cookie ||= @options[:cookie]
193
193
  send(:send_line, cookie ? "AUTHENTICATE #{cookie}" : "AUTHENTICATE")
194
194
  case reply = read_reply
195
- when '250 OK' then @authenticated = true
196
- else raise AuthenticationError.new(reply)
195
+ when '250 OK' then @authenticated = true
196
+ else raise AuthenticationError.new(reply)
197
197
  end
198
198
  self
199
199
  end
@@ -252,6 +252,7 @@ module Tor
252
252
  read_reply # skip "250+config-text="
253
253
  while line = read_reply
254
254
  break unless line != "."
255
+
255
256
  reply.concat(line + "\n")
256
257
  end
257
258
  read_reply # skip "250 OK"
@@ -270,7 +271,7 @@ module Tor
270
271
  read_reply
271
272
  end
272
273
 
273
- protected
274
+ protected
274
275
 
275
276
  ##
276
277
  # Sends a command line over the socket.
data/lib/tor/dnsel.rb CHANGED
@@ -21,7 +21,7 @@ module Tor
21
21
  def self.include?(host)
22
22
  begin
23
23
  query(host) == '127.0.0.2'
24
- rescue Resolv::ResolvError # NXDOMAIN
24
+ rescue Resolv::ResolvError # NXDOMAIN
25
25
  false
26
26
  rescue Resolv::ResolvTimeout
27
27
  nil
@@ -61,7 +61,7 @@ module Tor
61
61
  end
62
62
  class << self; alias_method :hostname, :dnsname; end
63
63
 
64
- protected
64
+ protected
65
65
 
66
66
  ##
67
67
  # Resolves `host` into an IPv4 address using Ruby's default resolver.
@@ -78,22 +78,22 @@ module Tor
78
78
  # @return [String]
79
79
  def self.getaddress(host, reversed = false)
80
80
  host = case host.to_s
81
- when Resolv::IPv6::Regex
82
- raise ArgumentError.new("not an IPv4 address: #{host}")
83
- when Resolv::IPv4::Regex
84
- host.to_s
85
- else
86
- begin
87
- RESOLVER.each_address(host.to_s) do |addr|
88
- return addr.to_s if addr.to_s =~ Resolv::IPv4::Regex
89
- end
90
- raise Resolv::ResolvError.new("no address for #{host}")
91
- rescue NoMethodError
92
- # This is a workaround for Ruby bug #2614:
93
- # @see http://redmine.ruby-lang.org/issues/show/2614
94
- raise Resolv::ResolvError.new("no address for #{host}")
95
- end
96
- end
81
+ when Resolv::IPv6::Regex
82
+ raise ArgumentError.new("not an IPv4 address: #{host}")
83
+ when Resolv::IPv4::Regex
84
+ host.to_s
85
+ else
86
+ begin
87
+ RESOLVER.each_address(host.to_s) do |addr|
88
+ return addr.to_s if addr.to_s =~ Resolv::IPv4::Regex
89
+ end
90
+ raise Resolv::ResolvError.new("no address for #{host}")
91
+ rescue NoMethodError
92
+ # This is a workaround for Ruby bug #2614:
93
+ # @see http://redmine.ruby-lang.org/issues/show/2614
94
+ raise Resolv::ResolvError.new("no address for #{host}")
95
+ end
96
+ end
97
97
  reversed ? host.split('.').reverse.join('.') : host
98
98
  end
99
99
  end
data/lib/tor/version.rb CHANGED
@@ -2,7 +2,7 @@ module Tor
2
2
  module VERSION
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- TINY = 4
5
+ TINY = 7
6
6
  EXTRA = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, EXTRA].compact.join('.')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arto Bendiken
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-22 00:00:00.000000000 Z
11
+ date: 2024-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yard
@@ -52,7 +52,7 @@ extra_rdoc_files: []
52
52
  files:
53
53
  - AUTHORS
54
54
  - CREDITS
55
- - README
55
+ - README.md
56
56
  - UNLICENSE
57
57
  - VERSION
58
58
  - lib/tor.rb
@@ -60,7 +60,7 @@ files:
60
60
  - lib/tor/control.rb
61
61
  - lib/tor/dnsel.rb
62
62
  - lib/tor/version.rb
63
- homepage: http://cypherpunk.rubyforge.org/tor/
63
+ homepage: https://rubygems.org/gems/tor/
64
64
  licenses:
65
65
  - Unlicense
66
66
  metadata: {}
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  version: '0'
81
81
  requirements:
82
82
  - Tor (>= 0.2.1.25)
83
- rubygems_version: 3.0.3
83
+ rubygems_version: 3.0.3.1
84
84
  signing_key:
85
85
  specification_version: 4
86
86
  summary: Onion routing for Ruby.
data/README DELETED
@@ -1 +0,0 @@
1
- ./README.md