onion 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.
@@ -55,18 +55,14 @@ module Onion
55
55
  def router_status_info(nicknames=nil,fingerprints=nil)
56
56
  statuses = ""
57
57
 
58
- p "start!"
59
-
60
58
  if nicknames
61
59
  nicknames.each do |name|
62
60
  send("getinfo ns/name/#{name}")
63
- statuses << @sock.gets
64
- end
65
- while not @sock.eof?
66
- statuses << @sock.gets
61
+ result << @sock.gets
67
62
  end
63
+ result << @sock.gets
68
64
  end
69
- p "done!"
65
+
70
66
  Onion::RouterList.new(statuses)
71
67
  end
72
68
 
@@ -1,40 +1,40 @@
1
1
  module Onion
2
2
  grammar CircuitLists
3
- include Common
4
-
5
- rule circuit_list
6
- circuit_list_entry+ {
7
- def circuits
8
- circuits = []
9
- self.elements.each do |circuit|
10
- if circuit.respond_to? :p
11
- to_process = [circuit.p.first]
12
- counter = 1
13
- circuit.p.rest.elements.each do |e|
14
- to_process << e.LongName
15
- end
16
- routers = []
17
- to_process.each do |router|
18
- if router.respond_to? :n
19
- routers << Router.new(router.n.text_value.strip, router.f.text_value.strip, nil)
20
- else
21
- routers << Router.new(nil, nil, nil)
22
- end
23
- end
24
- circuits << Circuit.new(circuit.id.text_value.strip, routers)
25
- else
26
- circuits << Circuit.new(circuit.id.text_value.strip, [])
27
- end
3
+ include Common
4
+
5
+ rule circuit_list
6
+ circuit_list_entry+ {
7
+ def circuits
8
+ circuits = []
9
+ self.elements.each do |circuit|
10
+ if circuit.respond_to? :p
11
+ to_process = [circuit.p.first]
12
+ counter = 1
13
+ circuit.p.rest.elements.each do |e|
14
+ to_process << e.LongName
15
+ end
16
+ routers = []
17
+ to_process.each do |router|
18
+ if router.respond_to? :n
19
+ routers << Router.new(router.n.text_value.strip, router.f.text_value.strip, nil)
20
+ else
21
+ routers << Router.new(nil, nil, nil)
22
+ end
28
23
  end
29
- return circuits
24
+ circuits << Circuit.new(circuit.id.text_value.strip, routers)
25
+ else
26
+ circuits << Circuit.new(circuit.id.text_value.strip, [])
30
27
  end
31
- }
28
+ end
29
+ return circuits
32
30
  end
31
+ }
32
+ end
33
33
 
34
- rule circuit_list_entry
35
- id:CircuitID SP s:CircStatus SP p:Path SP "PURPOSE=" purp:Purpose "\n" /
36
- id:CircuitID SP s:CircStatus SP p:Path "\n" /
37
- id:CircuitID SP s:CircStatus "\n"
34
+ rule circuit_list_entry
35
+ id:CircuitID SP s:CircStatus SP p:Path SP "PURPOSE=" purp:Purpose "\n" /
36
+ id:CircuitID SP s:CircStatus SP p:Path "\n" /
37
+ id:CircuitID SP s:CircStatus "\n"
38
38
  end
39
39
 
40
40
  rule Path
@@ -51,3 +51,4 @@ module Onion
51
51
 
52
52
  end
53
53
  end
54
+
metadata CHANGED
@@ -1,20 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onion
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 1
8
- - 2
9
- version: 0.1.2
4
+ prerelease:
5
+ version: 0.1.3
10
6
  platform: ruby
11
7
  authors:
12
- - Poet (Tim Sally)
8
+ - Tim Sally
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2010-11-18 00:00:00 -06:00
13
+ date: 2011-04-10 00:00:00 -05:00
18
14
  default_executable:
19
15
  dependencies:
20
16
  - !ruby/object:Gem::Dependency
@@ -25,15 +21,11 @@ dependencies:
25
21
  requirements:
26
22
  - - ">="
27
23
  - !ruby/object:Gem::Version
28
- segments:
29
- - 1
30
- - 4
31
- - 8
32
24
  version: 1.4.8
33
25
  type: :runtime
34
26
  version_requirements: *id001
35
27
  description: Interact with Tor.
36
- email: poet@stack.io
28
+ email: tss@timsally.com
37
29
  executables: []
38
30
 
39
31
  extensions: []
@@ -42,7 +34,6 @@ extra_rdoc_files: []
42
34
 
43
35
  files:
44
36
  - README.txt
45
- - License.txt
46
37
  - Rakefile
47
38
  - lib/onion/control_client.rb
48
39
  - lib/onion/elements/circuit.rb
@@ -52,18 +43,14 @@ files:
52
43
  - lib/onion/elements/stream.rb
53
44
  - lib/onion/elements/stream_list.rb
54
45
  - lib/onion/elements.rb
55
- - lib/onion/parsers/circuit_lists.rb
56
46
  - lib/onion/parsers/circuit_lists.treetop
57
- - lib/onion/parsers/common.rb
58
47
  - lib/onion/parsers/common.treetop
59
- - lib/onion/parsers/router_statuses.rb
60
48
  - lib/onion/parsers/router_statuses.treetop
61
- - lib/onion/parsers/stream_lists.rb
62
49
  - lib/onion/parsers/stream_lists.treetop
63
50
  - lib/onion.rb
64
51
  - lib/tasks/treetop.rake
65
52
  has_rdoc: true
66
- homepage: http://stack.io
53
+ homepage: http://www.timsally.com
67
54
  licenses: []
68
55
 
69
56
  post_install_message:
@@ -76,21 +63,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
76
63
  requirements:
77
64
  - - ">="
78
65
  - !ruby/object:Gem::Version
79
- segments:
80
- - 0
81
66
  version: "0"
82
67
  required_rubygems_version: !ruby/object:Gem::Requirement
83
68
  none: false
84
69
  requirements:
85
70
  - - ">="
86
71
  - !ruby/object:Gem::Version
87
- segments:
88
- - 0
89
72
  version: "0"
90
73
  requirements: []
91
74
 
92
75
  rubyforge_project:
93
- rubygems_version: 1.3.7
76
+ rubygems_version: 1.6.2
94
77
  signing_key:
95
78
  specification_version: 3
96
79
  summary: Onion is a library you can use to interact with Tor. It includes parsers and clients for Tor's protocols.
@@ -1,23 +0,0 @@
1
- LICENSE.txt
2
- ===========
3
-
4
- Copyright (c) 2010 Tim Sally
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining
7
- a copy of this software and associated documentation files (the
8
- 'Software'), to deal in the Software without restriction, including
9
- without limitation the rights to use, copy, modify, merge, publish,
10
- distribute, sublicense, and/or sell copies of the Software, and to
11
- permit persons to whom the Software is furnished to do so, subject to
12
- the following conditions:
13
-
14
- The above copyright notice and this permission notice shall be
15
- included in all copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
18
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,491 +0,0 @@
1
- # Autogenerated from a Treetop grammar. Edits may be lost.
2
-
3
-
4
- module Onion
5
- module CircuitLists
6
- include Treetop::Runtime
7
-
8
- def root
9
- @root ||= :circuit_list
10
- end
11
-
12
- include Common
13
-
14
- module CircuitList0
15
- def circuits
16
- circuits = []
17
- self.elements.each do |circuit|
18
- if circuit.respond_to? :p
19
- to_process = [circuit.p.first]
20
- counter = 1
21
- circuit.p.rest.elements.each do |e|
22
- to_process << e.LongName
23
- end
24
- routers = []
25
- to_process.each do |router|
26
- if router.respond_to? :n
27
- routers << Router.new(router.n.text_value.strip, router.f.text_value.strip, nil)
28
- else
29
- routers << Router.new(nil, nil, nil)
30
- end
31
- end
32
- circuits << Circuit.new(circuit.id.text_value.strip, routers)
33
- else
34
- circuits << Circuit.new(circuit.id.text_value.strip, [])
35
- end
36
- end
37
- return circuits
38
- end
39
- end
40
-
41
- def _nt_circuit_list
42
- start_index = index
43
- if node_cache[:circuit_list].has_key?(index)
44
- cached = node_cache[:circuit_list][index]
45
- if cached
46
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
47
- @index = cached.interval.end
48
- end
49
- return cached
50
- end
51
-
52
- s0, i0 = [], index
53
- loop do
54
- r1 = _nt_circuit_list_entry
55
- if r1
56
- s0 << r1
57
- else
58
- break
59
- end
60
- end
61
- if s0.empty?
62
- @index = i0
63
- r0 = nil
64
- else
65
- r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
66
- r0.extend(CircuitList0)
67
- end
68
-
69
- node_cache[:circuit_list][start_index] = r0
70
-
71
- r0
72
- end
73
-
74
- module CircuitListEntry0
75
- def id
76
- elements[0]
77
- end
78
-
79
- def SP1
80
- elements[1]
81
- end
82
-
83
- def s
84
- elements[2]
85
- end
86
-
87
- def SP2
88
- elements[3]
89
- end
90
-
91
- def p
92
- elements[4]
93
- end
94
-
95
- def SP3
96
- elements[5]
97
- end
98
-
99
- def purp
100
- elements[7]
101
- end
102
-
103
- end
104
-
105
- module CircuitListEntry1
106
- def id
107
- elements[0]
108
- end
109
-
110
- def SP1
111
- elements[1]
112
- end
113
-
114
- def s
115
- elements[2]
116
- end
117
-
118
- def SP2
119
- elements[3]
120
- end
121
-
122
- def p
123
- elements[4]
124
- end
125
-
126
- end
127
-
128
- module CircuitListEntry2
129
- def id
130
- elements[0]
131
- end
132
-
133
- def SP
134
- elements[1]
135
- end
136
-
137
- def s
138
- elements[2]
139
- end
140
-
141
- end
142
-
143
- def _nt_circuit_list_entry
144
- start_index = index
145
- if node_cache[:circuit_list_entry].has_key?(index)
146
- cached = node_cache[:circuit_list_entry][index]
147
- if cached
148
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
149
- @index = cached.interval.end
150
- end
151
- return cached
152
- end
153
-
154
- i0 = index
155
- i1, s1 = index, []
156
- r2 = _nt_CircuitID
157
- s1 << r2
158
- if r2
159
- r3 = _nt_SP
160
- s1 << r3
161
- if r3
162
- r4 = _nt_CircStatus
163
- s1 << r4
164
- if r4
165
- r5 = _nt_SP
166
- s1 << r5
167
- if r5
168
- r6 = _nt_Path
169
- s1 << r6
170
- if r6
171
- r7 = _nt_SP
172
- s1 << r7
173
- if r7
174
- if has_terminal?("PURPOSE=", false, index)
175
- r8 = instantiate_node(SyntaxNode,input, index...(index + 8))
176
- @index += 8
177
- else
178
- terminal_parse_failure("PURPOSE=")
179
- r8 = nil
180
- end
181
- s1 << r8
182
- if r8
183
- r9 = _nt_Purpose
184
- s1 << r9
185
- if r9
186
- if has_terminal?("\n", false, index)
187
- r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
188
- @index += 1
189
- else
190
- terminal_parse_failure("\n")
191
- r10 = nil
192
- end
193
- s1 << r10
194
- end
195
- end
196
- end
197
- end
198
- end
199
- end
200
- end
201
- end
202
- if s1.last
203
- r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
204
- r1.extend(CircuitListEntry0)
205
- else
206
- @index = i1
207
- r1 = nil
208
- end
209
- if r1
210
- r0 = r1
211
- else
212
- i11, s11 = index, []
213
- r12 = _nt_CircuitID
214
- s11 << r12
215
- if r12
216
- r13 = _nt_SP
217
- s11 << r13
218
- if r13
219
- r14 = _nt_CircStatus
220
- s11 << r14
221
- if r14
222
- r15 = _nt_SP
223
- s11 << r15
224
- if r15
225
- r16 = _nt_Path
226
- s11 << r16
227
- if r16
228
- if has_terminal?("\n", false, index)
229
- r17 = instantiate_node(SyntaxNode,input, index...(index + 1))
230
- @index += 1
231
- else
232
- terminal_parse_failure("\n")
233
- r17 = nil
234
- end
235
- s11 << r17
236
- end
237
- end
238
- end
239
- end
240
- end
241
- if s11.last
242
- r11 = instantiate_node(SyntaxNode,input, i11...index, s11)
243
- r11.extend(CircuitListEntry1)
244
- else
245
- @index = i11
246
- r11 = nil
247
- end
248
- if r11
249
- r0 = r11
250
- else
251
- i18, s18 = index, []
252
- r19 = _nt_CircuitID
253
- s18 << r19
254
- if r19
255
- r20 = _nt_SP
256
- s18 << r20
257
- if r20
258
- r21 = _nt_CircStatus
259
- s18 << r21
260
- if r21
261
- if has_terminal?("\n", false, index)
262
- r22 = instantiate_node(SyntaxNode,input, index...(index + 1))
263
- @index += 1
264
- else
265
- terminal_parse_failure("\n")
266
- r22 = nil
267
- end
268
- s18 << r22
269
- end
270
- end
271
- end
272
- if s18.last
273
- r18 = instantiate_node(SyntaxNode,input, i18...index, s18)
274
- r18.extend(CircuitListEntry2)
275
- else
276
- @index = i18
277
- r18 = nil
278
- end
279
- if r18
280
- r0 = r18
281
- else
282
- @index = i0
283
- r0 = nil
284
- end
285
- end
286
- end
287
-
288
- node_cache[:circuit_list_entry][start_index] = r0
289
-
290
- r0
291
- end
292
-
293
- module Path0
294
- def LongName
295
- elements[1]
296
- end
297
- end
298
-
299
- module Path1
300
- def first
301
- elements[0]
302
- end
303
-
304
- def rest
305
- elements[1]
306
- end
307
- end
308
-
309
- def _nt_Path
310
- start_index = index
311
- if node_cache[:Path].has_key?(index)
312
- cached = node_cache[:Path][index]
313
- if cached
314
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
315
- @index = cached.interval.end
316
- end
317
- return cached
318
- end
319
-
320
- i0, s0 = index, []
321
- r1 = _nt_LongName
322
- s0 << r1
323
- if r1
324
- s2, i2 = [], index
325
- loop do
326
- i3, s3 = index, []
327
- if has_terminal?(",", false, index)
328
- r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
329
- @index += 1
330
- else
331
- terminal_parse_failure(",")
332
- r4 = nil
333
- end
334
- s3 << r4
335
- if r4
336
- r5 = _nt_LongName
337
- s3 << r5
338
- end
339
- if s3.last
340
- r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
341
- r3.extend(Path0)
342
- else
343
- @index = i3
344
- r3 = nil
345
- end
346
- if r3
347
- s2 << r3
348
- else
349
- break
350
- end
351
- end
352
- r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
353
- s0 << r2
354
- end
355
- if s0.last
356
- r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
357
- r0.extend(Path1)
358
- else
359
- @index = i0
360
- r0 = nil
361
- end
362
-
363
- node_cache[:Path][start_index] = r0
364
-
365
- r0
366
- end
367
-
368
- def _nt_CircStatus
369
- start_index = index
370
- if node_cache[:CircStatus].has_key?(index)
371
- cached = node_cache[:CircStatus][index]
372
- if cached
373
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
374
- @index = cached.interval.end
375
- end
376
- return cached
377
- end
378
-
379
- i0 = index
380
- if has_terminal?("LAUNCHED", false, index)
381
- r1 = instantiate_node(SyntaxNode,input, index...(index + 8))
382
- @index += 8
383
- else
384
- terminal_parse_failure("LAUNCHED")
385
- r1 = nil
386
- end
387
- if r1
388
- r0 = r1
389
- else
390
- if has_terminal?("BUILT", false, index)
391
- r2 = instantiate_node(SyntaxNode,input, index...(index + 5))
392
- @index += 5
393
- else
394
- terminal_parse_failure("BUILT")
395
- r2 = nil
396
- end
397
- if r2
398
- r0 = r2
399
- else
400
- if has_terminal?("EXTENDED", false, index)
401
- r3 = instantiate_node(SyntaxNode,input, index...(index + 8))
402
- @index += 8
403
- else
404
- terminal_parse_failure("EXTENDED")
405
- r3 = nil
406
- end
407
- if r3
408
- r0 = r3
409
- else
410
- if has_terminal?("FAILED", false, index)
411
- r4 = instantiate_node(SyntaxNode,input, index...(index + 6))
412
- @index += 6
413
- else
414
- terminal_parse_failure("FAILED")
415
- r4 = nil
416
- end
417
- if r4
418
- r0 = r4
419
- else
420
- if has_terminal?("CLOSED", false, index)
421
- r5 = instantiate_node(SyntaxNode,input, index...(index + 6))
422
- @index += 6
423
- else
424
- terminal_parse_failure("CLOSED")
425
- r5 = nil
426
- end
427
- if r5
428
- r0 = r5
429
- else
430
- @index = i0
431
- r0 = nil
432
- end
433
- end
434
- end
435
- end
436
- end
437
-
438
- node_cache[:CircStatus][start_index] = r0
439
-
440
- r0
441
- end
442
-
443
- def _nt_Purpose
444
- start_index = index
445
- if node_cache[:Purpose].has_key?(index)
446
- cached = node_cache[:Purpose][index]
447
- if cached
448
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
449
- @index = cached.interval.end
450
- end
451
- return cached
452
- end
453
-
454
- i0 = index
455
- if has_terminal?("GENERAL", false, index)
456
- r1 = instantiate_node(SyntaxNode,input, index...(index + 7))
457
- @index += 7
458
- else
459
- terminal_parse_failure("GENERAL")
460
- r1 = nil
461
- end
462
- if r1
463
- r0 = r1
464
- else
465
- if has_terminal?("CONTROLER", false, index)
466
- r2 = instantiate_node(SyntaxNode,input, index...(index + 9))
467
- @index += 9
468
- else
469
- terminal_parse_failure("CONTROLER")
470
- r2 = nil
471
- end
472
- if r2
473
- r0 = r2
474
- else
475
- @index = i0
476
- r0 = nil
477
- end
478
- end
479
-
480
- node_cache[:Purpose][start_index] = r0
481
-
482
- r0
483
- end
484
-
485
- end
486
-
487
- class CircuitListsParser < Treetop::Runtime::CompiledParser
488
- include CircuitLists
489
- end
490
-
491
- end