tor_extend 1.0.2 → 2.0.0
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.
- data/Change.log +8 -6
- data/ReadME.txt +68 -9
- data/doc/ReadME_txt.html +100 -12
- data/doc/Tor.html +5 -0
- data/doc/Tor/Bridge.html +4 -0
- data/doc/Tor/CachedDesc.html +10 -6
- data/doc/Tor/Circuit.html +791 -0
- data/doc/Tor/Constants.html +10 -0
- data/doc/Tor/LongCircuit.html +474 -0
- data/doc/Tor/Router.html +4 -0
- data/doc/Tor/StatsObj.html +4 -0
- data/doc/Tor/TController.html +85 -33
- data/doc/created.rid +7 -6
- data/doc/index.html +4 -0
- data/doc/js/search_index.js +1 -1
- data/doc/lib/circuits_rb.html +97 -0
- data/doc/lib/constants_rb.html +4 -0
- data/doc/lib/httpmod_rb.html +4 -0
- data/doc/lib/tcontroller_rb.html +4 -0
- data/doc/lib/tor_extend_rb.html +4 -0
- data/doc/lib/tstats_rb.html +4 -0
- data/doc/table_of_contents.html +50 -0
- data/lib/circuits.rb +370 -0
- data/lib/constants.rb +4 -0
- data/lib/tcontroller.rb +30 -10
- data/lib/tor_extend.rb +4 -0
- data/tor_extend.gemspec +17 -4
- metadata +42 -14
data/lib/constants.rb
CHANGED
@@ -103,4 +103,8 @@ ATTACK_TOUR = {:lat => 46.0,
|
|
103
103
|
|
104
104
|
# This determines how long the program Tor::TController.extendcir_slowly() waits between each extension.
|
105
105
|
EXTEND_DELAY = 2.0
|
106
|
+
|
107
|
+
# This determines how frequent the circuits that make up long circuits will be checked and reattached.
|
108
|
+
PERIODIC_TIMER = 7
|
109
|
+
|
106
110
|
end
|
data/lib/tcontroller.rb
CHANGED
@@ -33,6 +33,27 @@ require 'socksify/http'
|
|
33
33
|
#
|
34
34
|
class TController < Tor::Controller
|
35
35
|
|
36
|
+
##
|
37
|
+
# @param [Hash{Symbol => Object}] options
|
38
|
+
# @option options [String, #to_s] :host ("127.0.0.1")
|
39
|
+
# @option options [Integer, #to_i] :port (9051)
|
40
|
+
# @option options [String, #to_s] :cookie (nil)
|
41
|
+
# @option options [Integer, #to_i] :version (PROTOCOL_VERSION)
|
42
|
+
def initialize(options = {}, &block)
|
43
|
+
@options = options.dup
|
44
|
+
@host = (@options.delete(:host) || '127.0.0.1').to_s
|
45
|
+
@port = (@options.delete(:port) || 9051).to_i
|
46
|
+
@version = (@options.delete(:version) || PROTOCOL_VERSION).to_i
|
47
|
+
@passwd = (@options.delete(:password) || '').to_s
|
48
|
+
connect
|
49
|
+
authenticate "\"#{@passwd}\"" if ! @passwd != ""
|
50
|
+
if block_given?
|
51
|
+
block.call(self)
|
52
|
+
quit
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
|
36
57
|
# This returns the circuit-status in an array, or an empty array on failure
|
37
58
|
#
|
38
59
|
# <b>Get the circuit-status from Tor</b>.
|
@@ -159,13 +180,12 @@ require 'socksify/http'
|
|
159
180
|
# The return format is fo the form:
|
160
181
|
# [HTTPcode, [{:bridgeip, :bridgeport},{:bridgeip, :bridgeport},{:bridgeip, :bridgeport}].
|
161
182
|
# The types can be one of 'tor', 'polipo', 'socks', 'http', 'https',nil, 'none'.
|
162
|
-
# torctrl_cirnum must have the form:
|
163
|
-
# torctrl_cirnum ={:torctrl=>Tor::TController, :cirnum=>cirnum,:hop=>hopcount}
|
164
183
|
#
|
165
184
|
# <b>Get 3 bridges</b>
|
166
185
|
#
|
167
186
|
# Tor::TController.get_bridges( {:proxytype=>'tor',:proxyport=>9050,:proxyaddr=>'127.0.0.1'} )
|
168
|
-
def get_bridges(
|
187
|
+
def get_bridges(cacheddesc, *config)
|
188
|
+
url = URI.parse "https://bridges.torproject.org/"
|
169
189
|
if config.empty?
|
170
190
|
proxyconfig={:type=>'tor' ,:port=>9050,:addr=>'127.0.0.1'}
|
171
191
|
else
|
@@ -202,7 +222,7 @@ require 'socksify/http'
|
|
202
222
|
bridgeip,bridgeport= eachbridge.split(':')
|
203
223
|
x=Bridge.where(:ipaddr=>bridgeip, :port =>bridgeport)
|
204
224
|
if x.empty?
|
205
|
-
if (bridge_geoip=cacheddesc.get_geoiprecord(bridgeip)).nil?
|
225
|
+
if cacheddesc.nil? or (bridge_geoip=cacheddesc.get_geoiprecord(bridgeip)).nil?
|
206
226
|
Bridge.create(:ipaddr=>bridgeip, :port =>bridgeport,
|
207
227
|
:lat=>0, :lng=>0)
|
208
228
|
else
|
@@ -219,7 +239,7 @@ require 'socksify/http'
|
|
219
239
|
respcode=nil
|
220
240
|
bridges=[]
|
221
241
|
end
|
222
|
-
bridges #Return array of all bridges
|
242
|
+
bridges.nil? ? [] : bridges #Return array of all bridges
|
223
243
|
end
|
224
244
|
|
225
245
|
# Returns all the brdiges in the database as an array.
|
@@ -236,19 +256,19 @@ require 'socksify/http'
|
|
236
256
|
case eachstream
|
237
257
|
when /\d+ NEW 0/
|
238
258
|
# It might be simpler to use this /\d+ NEW/
|
239
|
-
reply << eachstream.scan(/\d+/)[0]
|
259
|
+
reply << eachstream.scan(/\d+/)[0].to_i
|
240
260
|
end
|
241
261
|
}
|
242
262
|
reply
|
243
263
|
end
|
244
264
|
|
245
265
|
# This attaches streams to circuits. No documentation yet.
|
246
|
-
def attach_stream(stream_no, cir_num
|
247
|
-
puts "attachstream"
|
248
|
-
if hop_count==0
|
266
|
+
def attach_stream(stream_no, cir_num ,*hop_count)
|
267
|
+
# puts "attachstream #{cir_num}\n"
|
268
|
+
if hop_count.empty? or hop_count[0] == 0
|
249
269
|
sr(:attachstream,"#{stream_no} #{cir_num}")
|
250
270
|
else
|
251
|
-
sr(:attachstream,"#{stream_no} #{cir_num} HOP=#{hop_count}")
|
271
|
+
sr(:attachstream,"#{stream_no} #{cir_num} HOP=#{hop_count[0]}")
|
252
272
|
end
|
253
273
|
end
|
254
274
|
|
data/lib/tor_extend.rb
CHANGED
@@ -12,12 +12,16 @@ module Tor
|
|
12
12
|
require 'builder'
|
13
13
|
require 'geoip'
|
14
14
|
require 'net/https'
|
15
|
+
require 'tmpdir' # used to store temporary directories for tor and polipo config
|
16
|
+
# require 'open3' # required for launching multiple occurences of tor and polipo for spinning within the Tor circuit
|
17
|
+
require 'eventmachine'
|
15
18
|
|
16
19
|
# Tor::Constants module is loaded from constants.rb and other classes from seperate files
|
17
20
|
autoload :Constants, 'constants'
|
18
21
|
require 'tcontroller'
|
19
22
|
require 'tstats'
|
20
23
|
require 'httpmod'
|
24
|
+
require 'circuits'
|
21
25
|
|
22
26
|
# Tor::Router is a class for the active record database holding the ip-addresses, platform, fingerprint, country, latitude,longitude.
|
23
27
|
#
|
data/tor_extend.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
require 'rubygems'
|
3
3
|
spec = Gem::Specification.new do |s|
|
4
4
|
s.name = "tor_extend"
|
5
|
-
s.version = "
|
5
|
+
s.version = "2.0.0"
|
6
6
|
s.summary = "TController inherits the features from the Controller class in Arto Bendiken\'s tor-ruby [https://github.com/bendiken/tor-ruby] and extends it to do so much more"
|
7
7
|
s.files = Dir.glob("**/**/**")
|
8
8
|
s.test_files = Dir.glob("test/*_test.rb")
|
@@ -16,11 +16,24 @@ spec = Gem::Specification.new do |s|
|
|
16
16
|
s.add_dependency('tor', '>= 0.1.2')
|
17
17
|
s.add_dependency('geoip', '>= 1.1.1')
|
18
18
|
s.add_dependency('socksify', '>= 1.4.1')
|
19
|
+
s.add_dependency('eventmachine', '>= 0.12.10')
|
20
|
+
|
21
|
+
s.requirements << ' ruby'
|
22
|
+
s.requirements << ' socksify'
|
23
|
+
s.requirements << ' tor'
|
24
|
+
s.requirements << ' eventmachine'
|
25
|
+
|
19
26
|
s.description = <<-EOF
|
20
|
-
|
21
|
-
|
27
|
+
This library extends Bendiken's tor-ruby [https://github.com/bendiken/tor-ruby], and provides methods for working with circuits, packet spinning, as well as obtaining Bridges from the Tor anonymous network as described at the following conference:
|
28
|
+
PacSec Applied Security Conference, Tokyo, Japan on, 9-10 Nov. 2011, "Filiol E., Remi-Omosowon O. B., Mutembei L., 2011. Dynamic cryptographic trapdoors to take over the TOR network".
|
29
|
+
H2HC 2011, Sao Paulo, Brazil on, 29-30 Oct. 2011, "Filiol E., Remi-Omosowon O. B., Mutembei L., 2011. How to take over the Tor network operationally "
|
30
|
+
|
31
|
+
It will be updated before and after the talk at:
|
32
|
+
28C3, Chaos Communication Congress Conference, Berlin, Germany on, 27-30 Dec. 2011, "Filiol E., Remi-Omosowon O. B., Mutembei L., 2011. Dynamic cryptographic trapdoors to take over the TOR network.
|
33
|
+
|
34
|
+
It requires the geoip, socksify and tor gems, which I included in the specification file to auto install for clients. So other licences may apply.
|
35
|
+
Also available at http://cvo-lab.blogspot.com/2011/11/tor-attack-technical-details.html
|
22
36
|
EOF
|
23
|
-
s.homepage = ("http://cvo-lab.blogspot.com")
|
24
37
|
s.homepage = ("http://tor-extend.rubyforge.org")
|
25
38
|
s.rubyforge_project = 'tor_extend'
|
26
39
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tor_extend
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-12-22 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: tor
|
16
|
-
requirement: &
|
16
|
+
requirement: &83061440 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.1.2
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *83061440
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: geoip
|
27
|
-
requirement: &
|
27
|
+
requirement: &83061210 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 1.1.1
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *83061210
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: socksify
|
38
|
-
requirement: &
|
38
|
+
requirement: &83060980 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,11 +43,31 @@ dependencies:
|
|
43
43
|
version: 1.4.1
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
46
|
+
version_requirements: *83060980
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: eventmachine
|
49
|
+
requirement: &83060750 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.12.10
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *83060750
|
58
|
+
description: ! " This library extends Bendiken's tor-ruby [https://github.com/bendiken/tor-ruby],
|
59
|
+
and provides methods for working with circuits, packet spinning, as well as obtaining
|
60
|
+
Bridges from the Tor anonymous network as described at the following conference:\n
|
61
|
+
\ PacSec Applied Security Conference, Tokyo, Japan on, 9-10 Nov. 2011, \"Filiol
|
62
|
+
E., Remi-Omosowon O. B., Mutembei L., 2011. Dynamic cryptographic trapdoors to take
|
63
|
+
over the TOR network\".\n H2HC 2011, Sao Paulo, Brazil on, 29-30 Oct. 2011, \"Filiol
|
64
|
+
E., Remi-Omosowon O. B., Mutembei L., 2011. How to take over the Tor network operationally
|
65
|
+
\"\n\n It will be updated before and after the talk at: \n 28C3, Chaos Communication
|
66
|
+
Congress Conference, Berlin, Germany on, 27-30 Dec. 2011, \"Filiol E., Remi-Omosowon
|
67
|
+
O. B., Mutembei L., 2011. Dynamic cryptographic trapdoors to take over the TOR network.\n\n
|
68
|
+
\ It requires the geoip, socksify and tor gems, which I included in the specification
|
69
|
+
file to auto install for clients. So other licences may apply.\n Also available
|
70
|
+
at http://cvo-lab.blogspot.com/2011/11/tor-attack-technical-details.html\n"
|
51
71
|
email: remi-omosowon@et.esiea-ouest.fr
|
52
72
|
executables: []
|
53
73
|
extensions: []
|
@@ -93,12 +113,15 @@ files:
|
|
93
113
|
- doc/js/jquery.js
|
94
114
|
- doc/js/search.js
|
95
115
|
- doc/Tor/Constants.html
|
116
|
+
- doc/Tor/Circuit.html
|
117
|
+
- doc/Tor/LongCircuit.html
|
96
118
|
- doc/Tor/StatsObj.html
|
97
119
|
- doc/Tor/Bridge.html
|
98
120
|
- doc/Tor/Router.html
|
99
121
|
- doc/Tor/TController.html
|
100
122
|
- doc/Tor/CachedDesc.html
|
101
123
|
- doc/lib/constants_rb.html
|
124
|
+
- doc/lib/circuits_rb.html
|
102
125
|
- doc/lib/tor_extend_rb.html
|
103
126
|
- doc/lib/tcontroller_rb.html
|
104
127
|
- doc/lib/tstats_rb.html
|
@@ -107,6 +130,7 @@ files:
|
|
107
130
|
- lib/httpmod.rb
|
108
131
|
- lib/tor_extend.rb
|
109
132
|
- lib/tstats.rb
|
133
|
+
- lib/circuits.rb
|
110
134
|
- lib/tcontroller.rb
|
111
135
|
- lib/constants.rb
|
112
136
|
- tor_extend.gemspec
|
@@ -128,9 +152,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
152
|
- - ! '>='
|
129
153
|
- !ruby/object:Gem::Version
|
130
154
|
version: '0'
|
131
|
-
requirements:
|
155
|
+
requirements:
|
156
|
+
- ! ' ruby'
|
157
|
+
- ! ' socksify'
|
158
|
+
- ! ' tor'
|
159
|
+
- ! ' eventmachine'
|
132
160
|
rubyforge_project: tor_extend
|
133
|
-
rubygems_version: 1.8.
|
161
|
+
rubygems_version: 1.8.12
|
134
162
|
signing_key:
|
135
163
|
specification_version: 3
|
136
164
|
summary: TController inherits the features from the Controller class in Arto Bendiken's
|