spior 0.1.6 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
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.1.6
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - szorfein
@@ -10,89 +10,90 @@ bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIETTCCArWgAwIBAgIBATANBgkqhkiG9w0BAQsFADAoMSYwJAYDVQQDDB1zem9y
14
- ZmVpbi9EQz1wcm90b25tYWlsL0RDPWNvbTAeFw0yMTA1MTEyMTAzNDZaFw0yMjA1
15
- MTEyMTAzNDZaMCgxJjAkBgNVBAMMHXN6b3JmZWluL0RDPXByb3Rvbm1haWwvREM9
16
- Y29tMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAxCTYZRndCTRy18rE
17
- exr2wig/staa0G5kt99xqaBYD0dnIRBr/GO5dFntlBVwmefQlTrNbygVUIYTb8Vg
18
- B1oX3v/LLW9SRQcWaZwou0tARqanm5WhgV1ZYQTs22endTazsDHw0uhM3V+FgDh+
19
- eR5wM9vU+SkRFHWzjVS1OxyTSCBVWb3+nrYTr/OKZ5Fm3Vo1dEQdwBEWLLXuUBxs
20
- dWEDmBk7iTJbvNdd5Kk2wfMKRMOl9NGicJl3Cb5yl5ITeZsXdOsrLBBPepTpNeq2
21
- k1goew3mEd/4pVXrdw6S5Qr6RTbTCLpKNRxWtx01vue9NN1cQ/Ds5FRkCp/Ntw/k
22
- Xroyofo4MW5fEPq+udgvVpdTfguQkpmuJg7TRiq9F5hDhEMnKUsdM2fSev9u8EvL
23
- OkidKy8bnhUOoG9qDxEG/IyibjRLl1i5jtyHa8Jb/We8poZ5LI8qjHwMPjTBhDgi
24
- EzaYV5rLGs5S1/m58XG6a+620x2tcQZph6FFbnQJ8QBuNz6zAgMBAAGjgYEwfzAJ
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v8lVer53sPzm3INPu5xFZyfZ/SXYXPKKwln0efH63K5vuXYwEN7NI
34
+ SBSRTN03Hb65t86m6/r084SrNnLntQjCSqApzFBt1QwJ5cmiVilODN4V7y2hZpyK
35
+ hSk3b2VOotDPiWIm1p/IPXQDfm5x67Z5fJQPAlBTsse4jKyVyW1lZLmERSBuRZ2O
36
+ urXgRIzALxd/xazPCnoLSXPzfJSI6Y77S1EBvhPd9RaSO8IyH9RhPDP9mnTvW2Kl
37
+ NAUnoL+txK5a
37
38
  -----END CERTIFICATE-----
38
- date: 2021-12-30 00:00:00.000000000 Z
39
+ date: 2023-10-26 00:00:00.000000000 Z
39
40
  dependencies:
40
41
  - !ruby/object:Gem::Dependency
41
- name: rainbow
42
+ name: interfacez
42
43
  requirement: !ruby/object:Gem::Requirement
43
44
  requirements:
44
- - - '='
45
+ - - "~>"
45
46
  - !ruby/object:Gem::Version
46
- version: 3.0.0
47
+ version: '1.0'
47
48
  type: :runtime
48
49
  prerelease: false
49
50
  version_requirements: !ruby/object:Gem::Requirement
50
51
  requirements:
51
- - - '='
52
+ - - "~>"
52
53
  - !ruby/object:Gem::Version
53
- version: 3.0.0
54
+ version: '1.0'
54
55
  - !ruby/object:Gem::Dependency
55
- name: interfacez
56
+ name: nomansland
56
57
  requirement: !ruby/object:Gem::Requirement
57
58
  requirements:
58
- - - '='
59
+ - - "~>"
59
60
  - !ruby/object:Gem::Version
60
- version: 1.0.3
61
+ version: '0.0'
61
62
  type: :runtime
62
63
  prerelease: false
63
64
  version_requirements: !ruby/object:Gem::Requirement
64
65
  requirements:
65
- - - '='
66
+ - - "~>"
66
67
  - !ruby/object:Gem::Version
67
- version: 1.0.3
68
+ version: '0.0'
68
69
  - !ruby/object:Gem::Dependency
69
- name: nomansland
70
+ name: rainbow
70
71
  requirement: !ruby/object:Gem::Requirement
71
72
  requirements:
72
- - - '='
73
+ - - "~>"
73
74
  - !ruby/object:Gem::Version
74
- version: 0.0.3
75
+ version: '3.1'
75
76
  type: :runtime
76
77
  prerelease: false
77
78
  version_requirements: !ruby/object:Gem::Requirement
78
79
  requirements:
79
- - - '='
80
+ - - "~>"
80
81
  - !ruby/object:Gem::Version
81
- version: 0.0.3
82
+ version: '3.1'
82
83
  - !ruby/object:Gem::Dependency
83
84
  name: tty-which
84
85
  requirement: !ruby/object:Gem::Requirement
85
86
  requirements:
86
- - - '='
87
+ - - "~>"
87
88
  - !ruby/object:Gem::Version
88
- version: 0.4.2
89
+ version: '0.5'
89
90
  type: :runtime
90
91
  prerelease: false
91
92
  version_requirements: !ruby/object:Gem::Requirement
92
93
  requirements:
93
- - - '='
94
+ - - "~>"
94
95
  - !ruby/object:Gem::Version
95
- version: 0.4.2
96
+ version: '0.5'
96
97
  description: " A tool to make TOR your default gateway\n"
97
98
  email: szorfein@protonmail.com
98
99
  executables:
@@ -102,33 +103,40 @@ extra_rdoc_files:
102
103
  - README.md
103
104
  - CHANGELOG.md
104
105
  files:
106
+ - ".github/workflows/rubocop-analysis.yml"
105
107
  - ".gitignore"
106
108
  - CHANGELOG.md
109
+ - Gemfile
107
110
  - LICENSE
108
111
  - README.md
109
112
  - Rakefile
110
113
  - bin/spior
111
114
  - ext/ipt_mod.conf
112
115
  - ext/iptables.service
116
+ - lib/auth.rb
113
117
  - lib/spior.rb
114
- - lib/spior/clear.rb
115
- - lib/spior/copy.rb
116
118
  - lib/spior/dep.rb
117
119
  - lib/spior/helpers.rb
118
120
  - lib/spior/iptables.rb
119
121
  - lib/spior/iptables/default.rb
120
122
  - lib/spior/iptables/root.rb
123
+ - lib/spior/iptables/rules.rb
121
124
  - lib/spior/iptables/tor.rb
125
+ - lib/spior/ipv6.rb
122
126
  - lib/spior/menu.rb
123
127
  - lib/spior/msg.rb
124
128
  - lib/spior/options.rb
125
- - lib/spior/persist.rb
126
129
  - lib/spior/service.rb
130
+ - lib/spior/service/enable.rb
127
131
  - lib/spior/service/restart.rb
128
132
  - lib/spior/service/start.rb
133
+ - lib/spior/service/stop.rb
129
134
  - lib/spior/status.rb
130
135
  - lib/spior/tor.rb
131
- - lib/spior/tor/info.rb
136
+ - lib/spior/tor/config.rb
137
+ - lib/spior/tor/data.rb
138
+ - lib/spior/tor/start.rb
139
+ - lib/spior/tor/stop.rb
132
140
  - lib/spior/version.rb
133
141
  - man/spior.1
134
142
  - man/spior.1.html
@@ -151,7 +159,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
151
159
  requirements:
152
160
  - - ">="
153
161
  - !ruby/object:Gem::Version
154
- version: '2.5'
162
+ version: '2.6'
155
163
  required_rubygems_version: !ruby/object:Gem::Requirement
156
164
  requirements:
157
165
  - - ">="
@@ -160,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
168
  requirements:
161
169
  - tor
162
170
  - iptables
163
- rubygems_version: 3.2.32
171
+ rubygems_version: 3.3.25
164
172
  signing_key:
165
173
  specification_version: 4
166
174
  summary: A tool to make TOR your default gateway
metadata.gz.sig CHANGED
Binary file
data/lib/spior/clear.rb DELETED
@@ -1,35 +0,0 @@
1
- require 'nomansland'
2
-
3
- module Spior
4
- module Clear
5
- extend self
6
-
7
- def all
8
- iptables
9
- Spior::Copy.new.restore
10
- end
11
-
12
- private
13
-
14
- def iptables
15
- puts "Clearing rules.."
16
- ipt = Spior::Iptables::Default.new
17
- ipt.stop!
18
- #if File.exist?("/var/lib/iptables/rules-save")
19
- # ipt_restore "/var/lib/iptables/rules-save"
20
- #elsif File.exist?("/etc/iptables/rules.save")
21
- # ipt_restore "/etc/iptables/iptables.rules"
22
- #elsif File.exist?("/etc/iptables.rules")
23
- # ipt_restore "/etc/iptables.rules"
24
- #else
25
- #Msg.p "Couldn't find any previous rules for iptables, create basic rules..."
26
- ipt.run!
27
- #end
28
- end
29
-
30
- def ipt_restore(path)
31
- puts "Restoring rules #{path}..."
32
- Helpers::Exec.new("iptables-restore").run("#{path}")
33
- end
34
- end
35
- end
data/lib/spior/copy.rb DELETED
@@ -1,84 +0,0 @@
1
- require 'digest'
2
-
3
- module Spior
4
- class Copy
5
- def initialize
6
- @cp = Helpers::Exec.new("cp -a")
7
- @files = []
8
- search_conf_dir
9
- config_files
10
- list
11
- end
12
-
13
- def save
14
- @files.each { |f|
15
- backup = "#{f}_backup"
16
- if ! File.exist? backup
17
- Msg.p "#{f} saved"
18
- @cp.run("#{f} #{backup}")
19
- end
20
- }
21
- end
22
-
23
- def restore
24
- @files.each { |f|
25
- backup = "#{f}_backup"
26
- if File.exist? backup
27
- Msg.p "#{f} restored"
28
- @cp.run("#{backup} #{f}")
29
- end
30
- }
31
- end
32
-
33
- private
34
-
35
- def config_files
36
- copy_file("#{@conf_dir}/ipt_mod.conf", "/etc/modules-load.d/ipt_mod.conf")
37
- end
38
-
39
- def list
40
- add "/etc/tor/torrc"
41
- add "/etc/systemd/resolved.conf"
42
- add "/var/lib/iptables/rules-save" # gentoo
43
- add "/etc/iptables/iptables.rules" # arch
44
- add "/etc/iptables/rules.v4" # debian
45
- end
46
-
47
- def add(file)
48
- @files << file if File.exist? file
49
- end
50
-
51
- def search_conf_dir
52
- # ebuild on gentoo copy the ext dir at lib/ext
53
- @conf_dir = File.expand_path('../..' + '/lib/ext', __dir__)
54
- if ! Dir.exist?(@conf_dir)
55
- @conf_dir = File.expand_path('../..' + '/ext', __dir__)
56
- end
57
- end
58
-
59
- def previous_copy(target)
60
- backup=`ls #{target}.backup-* | head -1`.chomp
61
- return false if ! File.exist? backup
62
- check_hash(backup, target)
63
- end
64
-
65
- def add_file(target)
66
- @cp.run("#{@config_file} #{target}")
67
- Msg.p "File #{@config_file} has been successfully copied at #{target}"
68
- end
69
-
70
- def copy_file(conf, target)
71
- @config_file = conf
72
- add_file target if ! File.exist? target
73
- return if check_hash(@config_file, target)
74
- add_file target
75
- end
76
-
77
- def check_hash(src, target)
78
- return if not File.exist?(target)
79
- sha256conf = Digest::SHA256.file src
80
- sha256target = Digest::SHA256.file target
81
- sha256conf === sha256target
82
- end
83
- end
84
- end
data/lib/spior/persist.rb DELETED
@@ -1,51 +0,0 @@
1
- require 'nomansland'
2
- require 'tty-which'
3
-
4
- module Spior
5
- module Persist
6
- extend self
7
-
8
- def enable
9
- case Nomansland::distro?
10
- when :gentoo
11
- for_gentoo
12
- else
13
- Msg.p "Your distro is not yet supported."
14
- end
15
- end
16
-
17
- private
18
-
19
- def for_gentoo
20
- if TTY::Which.exist?('systemctl')
21
- systemd_start("iptables-store")
22
- systemd_enable("iptables-restore")
23
- systemd_enable("tor")
24
- else
25
- system("sudo /etc/init.d/iptables save")
26
- rc_upd = Helpers::Exec.new("rc-update")
27
- rc_upd.run("rc-update add iptables boot")
28
- rc_upd.run("rc-update add tor")
29
- rc_upd.run("rc-update add tor default")
30
- end
31
- end
32
-
33
- def systemd_enable(service)
34
- systemctl = Helpers::Exec.new("systemctl")
35
- Msg.p "Search for service #{service}..."
36
- `systemctl is-enabled #{service}`
37
- if not $?.success? then
38
- systemctl.run("enable #{service}")
39
- end
40
- end
41
-
42
- def systemd_start(service)
43
- systemctl = Helpers::Exec.new("systemctl")
44
- Msg.p "Search for service #{service}..."
45
- `systemctl is-active #{service}`
46
- if not $?.success? then
47
- systemctl.run("start #{service}")
48
- end
49
- end
50
- end
51
- end
@@ -1,96 +0,0 @@
1
- require 'pathname'
2
- require 'nomansland'
3
- require 'tty-which'
4
-
5
- module Spior
6
- module Tor
7
- class Info
8
- attr_accessor :dns, :uid, :trans_port, :virt_addr
9
-
10
- def initialize
11
- @systemctl = Helpers::Exec.new("systemctl")
12
- @dns = search_dns
13
- @uid = search_uid
14
- @trans_port = search_trans_port
15
- @virt_addr = search_virt_addr
16
- end
17
-
18
- private
19
-
20
- def check_deps
21
- Spior::Copy.new.save
22
- add_torrc
23
- Spior::Service.start
24
- end
25
-
26
- def self.grep?(file, regex)
27
- is_found = false
28
- return is_found if ! File.exist? file
29
- File.open(file) do |f|
30
- f.each do |line|
31
- is_found = true if line.match(regex)
32
- end
33
- end
34
- is_found
35
- end
36
-
37
- def add_torrc
38
- user = 'User tor'
39
- pid = ''
40
- dir = 'DataDirectory /var/lib/tor'
41
-
42
- case Nomansland::distro?
43
- when :gentoo
44
- pid = 'PIDFile /run/tor/tor.pid'
45
- dir = 'DataDirectory /var/lib/tor/data'
46
- when :debian
47
- user = 'debian-tor'
48
- when :ubuntu
49
- user = 'debian-tor'
50
- end
51
-
52
- string = <<EOF
53
- # Generated by Spior
54
- #{user}
55
- #{pid}
56
- #{dir}
57
- GeoIPExcludeUnknown 1
58
- DNSPort 127.0.0.1:9061
59
- AutomapHostsOnResolve 1
60
- AutomapHostsSuffixes .exit,.onion
61
- SocksPort 9050
62
- VirtualAddrNetworkIPv4 10.192.0.0/10
63
- TransPort 9040 IsolateClientAddr IsolateClientProtocol IsolateDestAddr IsolateDestPort
64
- TestSocks 1
65
- MaxCircuitDirtiness 600
66
- EOF
67
- new_file = Helpers::NewFile.new(string, "torrc", "/etc/tor")
68
- new_file.add
69
- new_file.perm("root", "644")
70
- end
71
-
72
- def search_dns
73
- 9061
74
- end
75
-
76
- def search_uid
77
- case Nomansland::distro?
78
- when :debian
79
- `id -u debian-tor`.chomp
80
- when :ubuntu
81
- `id -u debian-tor`.chomp
82
- else
83
- `id -u tor`.chomp
84
- end
85
- end
86
-
87
- def search_trans_port
88
- 9040
89
- end
90
-
91
- def search_virt_addr
92
- "10.192.0.0/10"
93
- end
94
- end
95
- end
96
- end