spior 0.0.8 → 0.0.9

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: e9da29ea66a46968397265faf097f4fcdb111849af6563ca1157b7a1ca0606da
4
- data.tar.gz: 8406d29cdd50d1bbe4c0048f1c6030f8159c7156a0f63066465a6b0624a19c76
3
+ metadata.gz: 99feec0241976ee0c1fb2113f6b4ac1c72d8593e5d5901e559e642408c37f0ef
4
+ data.tar.gz: b74ce8165d4fc6538651769fac0ce6b7c79a1d05ab5ddcb68763f548569b2925
5
5
  SHA512:
6
- metadata.gz: 47ce8c96a9aab4f5c3f156445cd114f522e4b66c5d7b614b6fb19c0697a41670dd4b6cbba905558d2ca27d509cbfd0160dceb8ad3ddb48d5d9c9ebff16ff0d99
7
- data.tar.gz: d4c5cf050ad3cb485a9e9f09c80d634ea837b6bd0d8b5a648c29a3518126b56da0c0ddbc9a85e66f6e9c4d00219b2f95116e38300e95969cd4a8b3d1c2b53744
6
+ metadata.gz: d98ee9554cc7218957d7d3ff00240af12e5fb7e373ce2f080903182354f2cbb09d2fb7e2caa3b45a4a5065dd55b698d2c62d267007ca0d4ef03899529643e3cc
7
+ data.tar.gz: eb7ab480de17e9ab34ccae56c6da96408ce2206492f7071083702f8cbc8df0ad2cb183ba42bf9bf98173e3cca69d14293dc7caa06c6d98a01a93d5f00412eab6
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.0.9
2
+ * Add an option to reload TOR -r|--reload
3
+ * Cleanup few characters from -s|--status
4
+ * Correct path for search config files
5
+
1
6
  ## 0.0.8, release 2020-05-06
2
7
  * Always make a copy and replace original file, do not ask, the program is dependent of his config file for now.
3
8
  * Correct install where Dir.chdir don't back to the previous location.
data/lib/spior/copy.rb CHANGED
@@ -7,9 +7,10 @@ module Spior
7
7
  class Copy
8
8
 
9
9
  def self.config_files
10
- copy_file("torrc", "/etc/tor/torrc")
11
- copy_file("resolv.conf", "/etc/resolv.conf")
12
- copy_file("ipt_mod.conf", "/etc/modules-load.d/ipt_mod.conf")
10
+ @conf_dir = File.expand_path('../..' + '/conf', __dir__)
11
+ copy_file(@conf_dir + "/torrc", "/etc/tor/torrc")
12
+ copy_file(@conf_dir + "/resolv.conf", "/etc/resolv.conf")
13
+ copy_file(@conf_dir + "/ipt_mod.conf", "/etc/modules-load.d/ipt_mod.conf")
13
14
  end
14
15
 
15
16
  def self.restore_files
@@ -20,7 +21,7 @@ module Spior
20
21
  private
21
22
 
22
23
  def self.copy_file(conf, target)
23
- @config_file = "conf/#{conf}"
24
+ @config_file = conf
24
25
  return if check_hash(@config_file, target)
25
26
  if File.exist? target then
26
27
  if ! previous_copy target
@@ -40,6 +41,7 @@ module Spior
40
41
  end
41
42
 
42
43
  def self.check_hash(src, target)
44
+ return if not File.exist?(target)
43
45
  sha256conf = Digest::SHA256.file src
44
46
  sha256target = Digest::SHA256.file target
45
47
  sha256conf === sha256target
data/lib/spior/options.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'optparse'
2
+ require_relative 'reload'
2
3
  require_relative 'status'
3
4
  require_relative 'clear'
4
5
 
@@ -17,7 +18,7 @@ module Spior
17
18
 
18
19
  def parse(argv)
19
20
  OptionParser.new do |opts|
20
- opts.on("-i", "--install", "Install dependencies") do
21
+ opts.on("-i", "--install", "Install and update dependencies") do
21
22
  @install = true
22
23
  end
23
24
 
@@ -33,6 +34,10 @@ module Spior
33
34
  @tor = true
34
35
  end
35
36
 
37
+ opts.on("-r", "--reload", "Reload TOR to change your ip") do
38
+ Spior::Reload::tor
39
+ end
40
+
36
41
  opts.on("-c", "--clear", "Clear iptables rules and restore files") do
37
42
  Spior::Clear::all
38
43
  end
@@ -0,0 +1,13 @@
1
+ require 'tty-which'
2
+ require_relative 'msg'
3
+
4
+ module Spior
5
+ module Reload
6
+ def self.tor
7
+ if TTY::Which.exist?('systemctl')
8
+ system('sudo systemctl restart tor')
9
+ Msg.p "ip changed"
10
+ end
11
+ end
12
+ end
13
+ end
data/lib/spior/status.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'open-uri'
4
- require 'json'
5
4
 
6
5
  module Spior
7
6
  class Status
@@ -12,7 +11,7 @@ module Spior
12
11
  uri = URI.parse("https://ipleak.net/json")
13
12
  uri.open {|f|
14
13
  f.each_line {|line|
15
- p line
14
+ p line.chomp.delete("/\",{}")
16
15
  }
17
16
  }
18
17
  end
data/spior.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  "wiki_uri" => "https://github.com/szorfein/spior"
13
13
  }
14
14
 
15
- s.version = "0.0.8"
15
+ s.version = "0.0.9"
16
16
  s.requirements << 'tor'
17
17
  s.requirements << 'sudo'
18
18
  s.requirements << 'iptables'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spior
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - szorfein
@@ -35,7 +35,7 @@ cert_chain:
35
35
  J/zT/q2Ac7BWpSLbv6p9lChBiEnD9j24x463LR5QQjDNS5SsjzRQfFuprsa9Nqf2
36
36
  Tw==
37
37
  -----END CERTIFICATE-----
38
- date: 2020-05-06 00:00:00.000000000 Z
38
+ date: 2020-05-07 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: rainbow
@@ -120,6 +120,7 @@ files:
120
120
  - lib/spior/msg.rb
121
121
  - lib/spior/network.rb
122
122
  - lib/spior/options.rb
123
+ - lib/spior/reload.rb
123
124
  - lib/spior/runner.rb
124
125
  - lib/spior/status.rb
125
126
  - lib/spior/tor.rb
metadata.gz.sig CHANGED
Binary file