spior 0.0.9 → 0.1.0

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: 99feec0241976ee0c1fb2113f6b4ac1c72d8593e5d5901e559e642408c37f0ef
4
- data.tar.gz: b74ce8165d4fc6538651769fac0ce6b7c79a1d05ab5ddcb68763f548569b2925
3
+ metadata.gz: '01991c016f887cb41723c10909810d4bc7c762ad844d85a3bd094653123b891f'
4
+ data.tar.gz: 6df20aa83ef6b7c2201bde879f4927183476b3b35d41eec6415ca7d0c3d0c8c5
5
5
  SHA512:
6
- metadata.gz: d98ee9554cc7218957d7d3ff00240af12e5fb7e373ce2f080903182354f2cbb09d2fb7e2caa3b45a4a5065dd55b698d2c62d267007ca0d4ef03899529643e3cc
7
- data.tar.gz: eb7ab480de17e9ab34ccae56c6da96408ce2206492f7071083702f8cbc8df0ad2cb183ba42bf9bf98173e3cca69d14293dc7caa06c6d98a01a93d5f00412eab6
6
+ metadata.gz: 4b0d5ab4e4ccd4a8563eaae7e1aee31f77041b5d1dd593e79719ec82cb51868b24958cd8b92973fbc03303d8e54d9f0f9d9837913af9474e3099f4c867e14902
7
+ data.tar.gz: f3bf8c16db8f5d8ec3e42b65f30567921ac4b0de3fffe2615e5ad045228920eed77ca5520c77b4b776ab75cbeda9455dab5bfe715a14b351e5711b5ca7b46ec9
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -1,4 +1,11 @@
1
- ## 0.0.9
1
+ ## 0.1.0, release 2020-05-08
2
+ * Will manage differents version of torrc, if your distro fail to start TOR, report an issue.
3
+ * Ensure than TOR is start before proceed.
4
+ * New option -p|--persist, work with systemd for now.
5
+ * Remove duplicate code at lib/spior/mac.rb.
6
+ * Correct apt-get install.
7
+
8
+ ## 0.0.9, release 2020-05-07
2
9
  * Add an option to reload TOR -r|--reload
3
10
  * Cleanup few characters from -s|--status
4
11
  * Correct path for search config files
@@ -0,0 +1,18 @@
1
+ DataDirectory /var/lib/tor/data
2
+
3
+ Log notice stdout
4
+
5
+ GeoIPExcludeUnknown 1
6
+
7
+ ## Torified DNS
8
+ DNSPort 127.0.0.1:9061
9
+ AutomapHostsOnResolve 1
10
+ AutomapHostsSuffixes .exit,.onion
11
+
12
+ SocksPort 9050
13
+
14
+ VirtualAddrNetworkIPv4 10.192.0.0/10
15
+ TransPort 9040 IsolateClientAddr IsolateClientProtocol IsolateDestAddr IsolateDestPort
16
+
17
+ TestSocks 1
18
+ MaxCircuitDirtiness 600
File without changes
data/lib/spior/clear.rb CHANGED
@@ -24,7 +24,7 @@ module Spior
24
24
  elsif File.exist?("/etc/iptables.rules")
25
25
  ipt_restore "/etc/iptables.rules"
26
26
  else
27
- Msg.report "Do not known where search you previous iptables rules"
27
+ Msg.p "I couldn't find any old rules for iptables to restore, skipping..."
28
28
  end
29
29
  end
30
30
 
data/lib/spior/copy.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'pathname'
1
+ require 'nomansland'
2
2
  require 'date'
3
3
  require 'digest'
4
4
  require_relative 'msg'
@@ -8,7 +8,7 @@ module Spior
8
8
 
9
9
  def self.config_files
10
10
  @conf_dir = File.expand_path('../..' + '/conf', __dir__)
11
- copy_file(@conf_dir + "/torrc", "/etc/tor/torrc")
11
+ copy_torrc
12
12
  copy_file(@conf_dir + "/resolv.conf", "/etc/resolv.conf")
13
13
  copy_file(@conf_dir + "/ipt_mod.conf", "/etc/modules-load.d/ipt_mod.conf")
14
14
  end
@@ -18,6 +18,26 @@ module Spior
18
18
  backup_exist("/etc/resolv.conf")
19
19
  end
20
20
 
21
+ def self.search_systemd_dir
22
+ if Dir.exist?("/usr/lib/systemd/system")
23
+ @systemd_dir = '/usr/lib/systemd/system'
24
+ elsif Dir.exist?("/lib/systemd/system")
25
+ @systemd_dir = '/lib/systemd/system'
26
+ else
27
+ Msg.report "Directory systemd/system is no found on your system."
28
+ exit(-1)
29
+ end
30
+ end
31
+
32
+ def self.systemd_services
33
+ search_systemd_dir
34
+ case Nomansland::installer?
35
+ when :gentoo
36
+ Msg.p "Copy #{@conf_dir}/iptables.service"
37
+ copy_file(@conf_dir + "/iptables.service", @systemd_dir + "/iptables.service")
38
+ end
39
+ end
40
+
21
41
  private
22
42
 
23
43
  def self.copy_file(conf, target)
@@ -26,14 +46,23 @@ module Spior
26
46
  if File.exist? target then
27
47
  if ! previous_copy target
28
48
  backup_file(target)
29
- else
30
- add_file target
31
- end
49
+ end
50
+ add_file target
32
51
  else
33
52
  add_file target
34
53
  end
35
54
  end
36
55
 
56
+ def self.copy_torrc
57
+ case Nomansland::distro?
58
+ when :archlinux
59
+ copy_file(@conf_dir + "/torrc/torrc_archlinux", "/etc/tor/torrc")
60
+ else
61
+ copy_file(@conf_dir + "/torrc/torrc_default", "/etc/tor/torrc")
62
+ Msg.report "If tor fail to start with the default torrc"
63
+ end
64
+ end
65
+
37
66
  def self.previous_copy(target)
38
67
  backup=`ls #{target}.backup-* | head -n 1`.chomp
39
68
  return false if !File.exist?(backup)
data/lib/spior/install.rb CHANGED
@@ -12,6 +12,7 @@ module Spior
12
12
 
13
13
  def self.check_base
14
14
  base_packages
15
+ verify_services
15
16
  end
16
17
 
17
18
  def self.check_mac
@@ -30,11 +31,17 @@ module Spior
30
31
  when :yum
31
32
  system('sudo yum install tor iptables')
32
33
  else
33
- system('sudo apt-get tor iptables')
34
+ system('sudo apt-get install tor iptables')
34
35
  end
35
36
  end
36
37
  end
37
38
 
39
+ def self.verify_services
40
+ if TTY::Which.exist?('systemctl')
41
+ system('if ! systemctl is-active tor ; then sudo systemctl start tor ; fi')
42
+ end
43
+ end
44
+
38
45
  def self.pkg_mac
39
46
  pkg_name="deceitmac"
40
47
  if not TTY::Which.exist?(pkg_name)
data/lib/spior/mac.rb CHANGED
@@ -3,21 +3,9 @@ require_relative "msg"
3
3
 
4
4
  module Spior
5
5
  module MAC
6
- extend self
7
-
8
- def randomize(interface)
6
+ def self.randomize(interface)
9
7
  @network_int = interface
10
- check_dep
11
8
  system("deceitmac --interface #{@network_int} --random --dhcpcd --tor --no-banner")
12
9
  end
13
-
14
- private
15
-
16
- def check_dep
17
- if ! Pathname.new("/usr/local/bin/deceitmac") then
18
- Msg.error "deceitmac is not installed, please, exec spior --install"
19
- exit(-1)
20
- end
21
- end
22
10
  end
23
11
  end
data/lib/spior/msg.rb CHANGED
@@ -13,9 +13,13 @@ module Msg
13
13
  puts Rainbow("[").red + Rainbow("-").white + Rainbow("]").red + " " + text
14
14
  end
15
15
 
16
+ def self.info(text)
17
+ puts Rainbow("-").blue + Rainbow("-").white + Rainbow("-").blue + " " + text + " " + Rainbow("-").blue + Rainbow("-").white + Rainbow("-").blue
18
+ end
19
+
16
20
  def self.report(text)
17
21
  puts ""
18
- self.err text
22
+ info text
19
23
  puts "Please, report this issue at https://github.com/szorfein/spior/issues"
20
24
  end
21
25
  end
data/lib/spior/options.rb CHANGED
@@ -5,12 +5,13 @@ require_relative 'clear'
5
5
 
6
6
  module Spior
7
7
  class Options
8
- attr_reader :install , :mac , :interface , :tor
8
+ attr_reader :install , :mac , :interface , :tor , :persist
9
9
 
10
10
  def initialize(argv)
11
11
  @install = false
12
12
  @mac = false
13
13
  @tor = false
14
+ @persist = false
14
15
  parse(argv)
15
16
  end
16
17
 
@@ -46,6 +47,10 @@ module Spior
46
47
  Spior::Status::info
47
48
  end
48
49
 
50
+ opts.on("-p", "--persist", "Active Spior at every boot.") do
51
+ @persist = true
52
+ end
53
+
49
54
  opts.on("-h", "--help", "Show this message") do
50
55
  puts opts
51
56
  exit
@@ -0,0 +1,39 @@
1
+ require 'nomansland'
2
+ require 'tty-which'
3
+ require_relative 'copy'
4
+ require_relative 'msg'
5
+
6
+ module Spior
7
+ module Persist
8
+ extend self
9
+
10
+ def all(card_name)
11
+ @card_name = card_name
12
+ @services=[ "tor", "iptables", "deceitmac@" + @card_name ]
13
+ search_for_systemd
14
+ end
15
+
16
+ private
17
+
18
+ def search_for_systemd
19
+ return if !TTY::Which.exist?('systemctl')
20
+ Spior::Copy::systemd_services
21
+ @services.each do |service|
22
+ Msg.p "Search for service #{service}..."
23
+ system("if ! systemctl is-enabled #{service} ; then sudo systemctl enable #{service} ; fi")
24
+ end
25
+ iptables_systemd
26
+ end
27
+
28
+ def iptables_systemd
29
+ case Nomansland::installer?
30
+ when :pacman
31
+ system('sudo iptables-save -f /etc/iptables/iptables.rules')
32
+ when :emerge
33
+ system('sudo systemctl start iptables-store')
34
+ else
35
+ Msg.report "Fail for save iptables-rule, your system is not yet supported"
36
+ end
37
+ end
38
+ end
39
+ end
data/lib/spior/runner.rb CHANGED
@@ -4,6 +4,7 @@ require_relative 'copy'
4
4
  require_relative 'mac'
5
5
  require_relative 'iptables'
6
6
  require_relative 'network'
7
+ require_relative 'persist'
7
8
  require_relative 'msg'
8
9
 
9
10
  module Spior
@@ -36,6 +37,12 @@ module Spior
36
37
  end
37
38
  Spior::Iptables::tor(@network.card)
38
39
  end
40
+ if @options.persist then
41
+ if not @network
42
+ @network = Spior::Network.new(@options.interface)
43
+ end
44
+ Spior::Persist::all(@network.card)
45
+ end
39
46
  end
40
47
  end
41
48
  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.9"
15
+ s.version = "0.1.0"
16
16
  s.requirements << 'tor'
17
17
  s.requirements << 'sudo'
18
18
  s.requirements << 'iptables'
data.tar.gz.sig CHANGED
Binary file
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.9
4
+ version: 0.1.0
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-07 00:00:00.000000000 Z
38
+ date: 2020-05-08 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: rainbow
@@ -111,7 +111,8 @@ files:
111
111
  - conf/ssh.conf
112
112
  - conf/sshd.conf
113
113
  - conf/sshuttle.service
114
- - conf/torrc
114
+ - conf/torrc/torrc_archlinux
115
+ - conf/torrc/torrc_default
115
116
  - lib/spior/clear.rb
116
117
  - lib/spior/copy.rb
117
118
  - lib/spior/install.rb
@@ -120,6 +121,7 @@ files:
120
121
  - lib/spior/msg.rb
121
122
  - lib/spior/network.rb
122
123
  - lib/spior/options.rb
124
+ - lib/spior/persist.rb
123
125
  - lib/spior/reload.rb
124
126
  - lib/spior/runner.rb
125
127
  - lib/spior/status.rb
metadata.gz.sig CHANGED
Binary file