torrific 0.0.2 → 0.9.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/README.md +8 -4
- data/lib/application.rb +31 -6
- data/lib/torrific.rb +1 -0
- data/lib/torrific/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# Torrific
|
2
2
|
|
3
|
-
A wrapper to 'tor' gem for change Tor identity from the command line
|
3
|
+
A wrapper to 'tor' gem for change Tor identity from the command line.
|
4
|
+
For this program to work correctly, Tor cli should be installed and the
|
5
|
+
ControlPort part of the torrc file should be uncommented.
|
4
6
|
|
5
7
|
## Installation
|
6
8
|
|
@@ -22,9 +24,11 @@ torrific [options]
|
|
22
24
|
|
23
25
|
### Options
|
24
26
|
|
25
|
-
* host: Tor control host
|
26
|
-
* port: Tor control port
|
27
|
-
* password: Tor control authentication password
|
27
|
+
* host: Tor control host(default is 127.0.0.1)
|
28
|
+
* port: Tor control port(default is 9051)
|
29
|
+
* password: Tor control authentication password(default is empty)
|
30
|
+
* d(daemonize): Daemonize the process.
|
31
|
+
* interval: Set interval for the process.
|
28
32
|
|
29
33
|
## Contributing
|
30
34
|
|
data/lib/application.rb
CHANGED
@@ -4,12 +4,28 @@ require 'torrific'
|
|
4
4
|
module Torrific
|
5
5
|
class Application
|
6
6
|
class << self
|
7
|
-
attr_accessor :password, :port, :host
|
7
|
+
attr_accessor :password, :port, :host, :interval, :daemonize, :tor_controller
|
8
8
|
def run
|
9
9
|
self.parse_options
|
10
|
+
|
11
|
+
Process.daemon if self.daemonize
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
+
trap('SIGINT') do
|
14
|
+
puts "Bye Bye!"
|
15
|
+
exit
|
16
|
+
end
|
17
|
+
|
18
|
+
self.tor_controller = TorControl.new(host: self.host, port: self.port, password: self.password)
|
19
|
+
|
20
|
+
while true
|
21
|
+
self.tor_controller.change_ip
|
22
|
+
puts "Your identity has been changed."
|
23
|
+
if(self.interval && self.interval > 0)
|
24
|
+
sleep self.interval
|
25
|
+
else
|
26
|
+
break
|
27
|
+
end
|
28
|
+
end
|
13
29
|
end
|
14
30
|
|
15
31
|
def parse_options
|
@@ -17,18 +33,27 @@ module Torrific
|
|
17
33
|
opts.banner = "Usage: torrific [options]"
|
18
34
|
|
19
35
|
opts.on("--password PASSWORD",
|
20
|
-
"Sets the authentication password(default is nil)") do |pass
|
36
|
+
"Sets the authentication password(default is nil)") do |pass|
|
21
37
|
self.password = pass
|
22
38
|
end
|
23
39
|
|
24
|
-
opts.on("--host HOST", "Tor Control host(default is localhost)") do |host
|
40
|
+
opts.on("--host HOST", "Tor Control host(default is localhost)") do |host|
|
25
41
|
self.host = host
|
26
42
|
end
|
27
43
|
|
28
44
|
opts.on("--port PORT",
|
29
|
-
"Tor Control port(default is 9051).") do |port
|
45
|
+
"Tor Control port(default is 9051).") do |port|
|
30
46
|
self.port = port
|
31
47
|
end
|
48
|
+
|
49
|
+
opts.on("--interval INT",
|
50
|
+
"Changes identity each INT seconds.(default is only once)") do |seconds|
|
51
|
+
self.interval = seconds.to_i
|
52
|
+
end
|
53
|
+
|
54
|
+
opts.on("-d", "Daemonize the process") do
|
55
|
+
self.daemonize = true
|
56
|
+
end
|
32
57
|
end
|
33
58
|
|
34
59
|
options.parse!
|
data/lib/torrific.rb
CHANGED
data/lib/torrific/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: torrific
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.9.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-05-
|
12
|
+
date: 2014-05-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|