tor 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: aaef75e8798a08e6b53ba48cf9017d823a5149b345b7570a7a47d579c75a3056
4
+ data.tar.gz: bdb1f3103eaa2ba1529c6b427681779a7725bf56280f1a5d021a5b96d94997fb
5
+ SHA512:
6
+ metadata.gz: d7a90398037ee2bb8fbe8842bece7a8500100f09d850e1c52f73ef8b605f6de2bdebfa9764cba06b34b7ed7216d4db20bab1e9d3d49721dfb5aa2e65ad9733a8
7
+ data.tar.gz: d4716f3d5c6eed3d319d3077dbefaeddae7e0e46c1a62ca43d76d72b11691d85cf38b3702ac38531f610373b992243e41720037e28857a169e4fe314b67ef6bb
File without changes
data/README ADDED
@@ -0,0 +1 @@
1
+ ./README.md
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
data/lib/tor.rb CHANGED
@@ -17,10 +17,10 @@ end
17
17
  ##
18
18
  # @see https://www.torproject.org/
19
19
  module Tor
20
- autoload :Config, 'tor/config'
21
- autoload :Controller, 'tor/control'
22
- autoload :DNSEL, 'tor/dnsel'
23
- autoload :VERSION, 'tor/version'
20
+ require_relative 'tor/config'
21
+ require_relative 'tor/control'
22
+ require_relative 'tor/dnsel'
23
+ require_relative 'tor/version'
24
24
 
25
25
  ##
26
26
  # Returns `true` if the Tor process is running locally, `false` otherwise.
@@ -65,6 +65,8 @@ module Tor
65
65
  def self.version
66
66
  if available? && `#{program_path} --version` =~ /Tor v(\d+)\.(\d+)\.(\d+)\.(\d+)/
67
67
  [$1, $2, $3, $4].join('.')
68
+ elsif available? && `#{program_path} --version` =~ /Tor version (\d+)\.(\d+)\.(\d+)\.(\d+)/
69
+ [$1, $2, $3, $4].join('.')
68
70
  end
69
71
  end
70
72
 
@@ -190,7 +190,7 @@ module Tor
190
190
  # @raise [AuthenticationError] if authentication failed
191
191
  def authenticate(cookie = nil)
192
192
  cookie ||= @options[:cookie]
193
- send(:send_line, cookie ? "AUTHENTICATE #{cookie}" : "AUTHENTICATE")
193
+ send(:send_line, cookie ? "AUTHENTICATE \"#{cookie}\"" : "AUTHENTICATE")
194
194
  case reply = read_reply
195
195
  when '250 OK' then @authenticated = true
196
196
  else raise AuthenticationError.new(reply)
@@ -236,6 +236,40 @@ module Tor
236
236
  Pathname(reply)
237
237
  end
238
238
 
239
+ ##
240
+ # Returns the current (in-memory) Tor configuration.
241
+ # Response is terminated with a "."
242
+ #
243
+ # @example
244
+ # C: GETINFO config-text
245
+ # S: 250+config-text=
246
+ # S: ControlPort 9051
247
+ # S: RunAsDaemon 1
248
+ # S: .
249
+ def config_text
250
+ send_command(:getinfo, 'config-text')
251
+ reply = ""
252
+ read_reply # skip "250+config-text="
253
+ while line = read_reply
254
+ break unless line != "."
255
+ reply.concat(line + "\n")
256
+ end
257
+ read_reply # skip "250 OK"
258
+ return reply
259
+ end
260
+
261
+ ##
262
+ # Send a signal to the server
263
+ #
264
+ # @example
265
+ # tor.signal("newnym")
266
+ #
267
+ # @return [String]
268
+ def signal(name)
269
+ send_command(:signal, name)
270
+ read_reply
271
+ end
272
+
239
273
  protected
240
274
 
241
275
  ##
@@ -12,7 +12,7 @@ module Tor
12
12
  # policy.
13
13
  #
14
14
  # @example Checking source IP addresses
15
- # Tor::DNSEL.include?("208.75.57.100") #=> true
15
+ # Tor::DNSEL.include?("185.220.101.21") #=> true
16
16
  # Tor::DNSEL.include?("1.2.3.4") #=> false
17
17
  #
18
18
  # @example Checking source hostnames
@@ -20,12 +20,12 @@ module Tor
20
20
  # Tor::DNSEL.include?("myhost.example.org") #=> false
21
21
  #
22
22
  # @example Specifying an explicit target port
23
- # Tor::DNSEL.include?("208.75.57.100", :port => 80) #=> true
24
- # Tor::DNSEL.include?("208.75.57.100", :port => 25) #=> false
23
+ # Tor::DNSEL.include?("185.220.101.21", :port => 80) #=> true
24
+ # Tor::DNSEL.include?("185.220.101.21", :port => 25) #=> false
25
25
  #
26
26
  # @example Specifying an explicit target IP address and port
27
27
  # Tor::DNSEL.include?(source_addr, :addr => target_addr, :port => target_port)
28
- # Tor::DNSEL.include?("208.75.57.100", :addr => myip, :port => myport)
28
+ # Tor::DNSEL.include?("185.220.101.21", :addr => myip, :port => myport)
29
29
  #
30
30
  # @example Using from a Rack application
31
31
  # Tor::DNSEL.include?(env['REMOTE_ADDR'] || env['REMOTE_HOST'], {
@@ -50,7 +50,7 @@ module Tor
50
50
  # another.
51
51
  #
52
52
  # @example
53
- # Tor::DNSEL.include?("208.75.57.100") #=> true
53
+ # Tor::DNSEL.include?("185.220.101.21") #=> true
54
54
  # Tor::DNSEL.include?("1.2.3.4") #=> false
55
55
  #
56
56
  # @param [String, #to_s] host
@@ -77,7 +77,7 @@ module Tor
77
77
  # exit node and raising a `Resolv::ResolvError` if it isn't.
78
78
  #
79
79
  # @example
80
- # Tor::DNSEL.query("208.75.57.100") #=> "127.0.0.2"
80
+ # Tor::DNSEL.query("185.220.101.21") #=> "127.0.0.2"
81
81
  # Tor::DNSEL.query("1.2.3.4") #=> Resolv::ResolvError
82
82
  #
83
83
  # @param [String, #to_s] host
@@ -2,7 +2,7 @@ module Tor
2
2
  module VERSION
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- TINY = 2
5
+ TINY = 3
6
6
  EXTRA = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, EXTRA].compact.join('.')
metadata CHANGED
@@ -1,100 +1,82 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: tor
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 1
8
- - 2
9
- version: 0.1.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.3
10
5
  platform: ruby
11
- authors:
6
+ authors:
12
7
  - Arto Bendiken
13
8
  autorequire:
14
9
  bindir: bin
15
10
  cert_chain: []
16
-
17
- date: 2010-08-02 00:00:00 +02:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
11
+ date: 2019-04-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
21
14
  name: yard
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- requirements:
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
25
17
  - - ">="
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 0
29
- - 5
30
- - 8
31
- version: 0.5.8
18
+ - !ruby/object:Gem::Version
19
+ version: 0.6.0
32
20
  type: :development
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: rspec
36
21
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
38
- requirements:
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 0.6.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
39
31
  - - ">="
40
- - !ruby/object:Gem::Version
41
- segments:
42
- - 1
43
- - 3
44
- - 0
45
- version: 1.3.0
32
+ - !ruby/object:Gem::Version
33
+ version: '3'
46
34
  type: :development
47
- version_requirements: *id002
48
- description: Tor.rb is a pure-Ruby library for interacting with the Tor anonymity network.
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '3'
41
+ description: Tor.rb is a Ruby library for interacting with the Tor anonymity network.
49
42
  email: or-talk@seul.org
50
43
  executables: []
51
-
52
44
  extensions: []
53
-
54
45
  extra_rdoc_files: []
55
-
56
- files:
46
+ files:
57
47
  - AUTHORS
58
- - CONTRIBUTORS
48
+ - CREDITS
59
49
  - README
60
50
  - UNLICENSE
61
51
  - VERSION
52
+ - lib/tor.rb
62
53
  - lib/tor/config.rb
63
54
  - lib/tor/control.rb
64
55
  - lib/tor/dnsel.rb
65
56
  - lib/tor/version.rb
66
- - lib/tor.rb
67
- has_rdoc: false
68
57
  homepage: http://cypherpunk.rubyforge.org/tor/
69
- licenses:
58
+ licenses:
70
59
  - Public Domain
60
+ metadata: {}
71
61
  post_install_message:
72
62
  rdoc_options: []
73
-
74
- require_paths:
63
+ require_paths:
75
64
  - lib
76
- required_ruby_version: !ruby/object:Gem::Requirement
77
- requirements:
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
78
67
  - - ">="
79
- - !ruby/object:Gem::Version
80
- segments:
81
- - 1
82
- - 8
83
- - 1
68
+ - !ruby/object:Gem::Version
84
69
  version: 1.8.1
85
- required_rubygems_version: !ruby/object:Gem::Requirement
86
- requirements:
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ requirements:
87
72
  - - ">="
88
- - !ruby/object:Gem::Version
89
- segments:
90
- - 0
91
- version: "0"
92
- requirements:
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ requirements:
93
76
  - Tor (>= 0.2.1.25)
94
77
  rubyforge_project: cypherpunk
95
- rubygems_version: 1.3.6
78
+ rubygems_version: 2.7.6.2
96
79
  signing_key:
97
- specification_version: 3
80
+ specification_version: 4
98
81
  summary: Onion routing for Ruby.
99
82
  test_files: []
100
-
data/README DELETED
@@ -1,106 +0,0 @@
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?("208.75.57.100") #=> true
57
- Tor::DNSEL.include?("1.2.3.4") #=> false
58
-
59
- Documentation
60
- -------------
61
-
62
- * <http://cypherpunk.rubyforge.org/tor/>
63
-
64
- Dependencies
65
- ------------
66
-
67
- * [Ruby](http://ruby-lang.org/) (>= 1.8.7) or (>= 1.8.1 with [Backports][])
68
- * [Tor](https://www.torproject.org/download.html.en) (>= 0.2.1)
69
-
70
- Installation
71
- ------------
72
-
73
- The recommended installation method is via [RubyGems](http://rubygems.org/).
74
- To install the latest official release of Tor.rb, do:
75
-
76
- % [sudo] gem install tor # Ruby 1.8.7+ or 1.9.x
77
- % [sudo] gem install backports tor # Ruby 1.8.1+
78
-
79
- Download
80
- --------
81
-
82
- To get a local working copy of the development repository, do:
83
-
84
- % git clone git://github.com/bendiken/tor-ruby.git
85
-
86
- Alternatively, you can download the latest development version as a tarball
87
- as follows:
88
-
89
- % wget http://github.com/bendiken/tor-ruby/tarball/master
90
-
91
- Author
92
- ------
93
-
94
- * [Arto Bendiken](mailto:arto.bendiken@gmail.com) - <http://ar.to/>
95
-
96
- License
97
- -------
98
-
99
- Tor.rb is free and unencumbered public domain software. For more
100
- information, see <http://unlicense.org/> or the accompanying UNLICENSE file.
101
-
102
- [Tor]: https://www.torproject.org/
103
- [TorDNSEL]: https://www.torproject.org/tordnsel/
104
- [TC]: http://gitweb.torproject.org/tor.git?a=blob_plain;hb=HEAD;f=doc/spec/control-spec.txt
105
- [OR]: http://en.wikipedia.org/wiki/Onion_routing
106
- [Backports]: http://rubygems.org/gems/backports