spior 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +7 -0
- data/README.md +15 -2
- data/Rakefile +1 -1
- data/lib/spior/clear.rb +0 -1
- data/lib/spior/copy.rb +0 -1
- data/lib/spior/dep.rb +37 -0
- data/lib/spior/iptables/root.rb +1 -5
- data/lib/spior/iptables/tor.rb +1 -6
- data/lib/spior/menu.rb +1 -1
- data/lib/spior/msg.rb +0 -4
- data/lib/spior/options.rb +2 -2
- data/lib/spior/service/restart.rb +21 -0
- data/lib/spior/service/start.rb +26 -0
- data/lib/spior/service.rb +7 -0
- data/lib/spior/tor/info.rb +12 -29
- data/lib/spior/tor.rb +0 -1
- data/lib/spior/version.rb +1 -1
- data/lib/spior.rb +5 -3
- data/man/spior.1 +53 -0
- data/man/spior.1.html +122 -0
- data/man/spior.1.ronn +46 -0
- data/spior.gemspec +2 -2
- data.tar.gz.sig +0 -0
- metadata +27 -23
- metadata.gz.sig +0 -0
- data/lib/spior/install.rb +0 -33
- data/lib/spior/network.rb +0 -45
- data/lib/spior/tor/restart.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc3cc3a5fd8b8a7ace72820d60d145efa04795f86a3381e3156178d4d4cfd09c
|
4
|
+
data.tar.gz: 8de21a9ee54c6dc50f3aad1e1a828dd92173c7a5b31571498af19d75b6fd20bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acb66a1dd30e69c73f7ac79dbca7263fee90bd8bd6a8a1ace9dc7b35365a4996ce29aebde3d0652d1039f56ddcff259c29b739b8f3421bb9701b33a3d7b97c71
|
7
|
+
data.tar.gz: 284146408ef4dd90edf60e74f98488d0f5bf1ea92fdfff72edd30c219c26600c5e7934e71c7b54fc07bf7cf11a0e8b06ab31515d1314cc23ca570c029da551d3
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## 0.1.6, release 2021-12-30
|
2
|
+
* Make it work for Voidlinux.
|
3
|
+
* Add a man page.
|
4
|
+
* Support init script (but not yet very well).
|
5
|
+
* Stop changing /etc/resolv.conf.
|
6
|
+
* Dependencies are checked before start anything. Spior exit(1) if fail.
|
7
|
+
|
1
8
|
## 0.1.5, release 2020-11-01
|
2
9
|
* Simplify lib/spior/copy, lib/spior/clear
|
3
10
|
* Write iptables rules for --clearnet and --tor
|
data/README.md
CHANGED
@@ -1,4 +1,13 @@
|
|
1
|
-
#
|
1
|
+
# Spior
|
2
|
+
|
3
|
+
<div align="center">
|
4
|
+
<br/>
|
5
|
+
|
6
|
+
[![Gem Version](https://badge.fury.io/rb/spior.svg)](https://badge.fury.io/rb/spior)
|
7
|
+
![GitHub](https://img.shields.io/github/license/szorfein/spior)
|
8
|
+
|
9
|
+
</div>
|
10
|
+
|
2
11
|
(Spider|Tor) A tool to make TOR your default gateway.
|
3
12
|
|
4
13
|
## Install
|
@@ -6,10 +15,14 @@ Spior is cryptographically signed, so add my public key (if you haven’t alread
|
|
6
15
|
|
7
16
|
$ gem cert --add <(curl -Ls https://raw.githubusercontent.com/szorfein/spior/master/certs/szorfein.pem)
|
8
17
|
|
9
|
-
And install the gem
|
18
|
+
And install the gem:
|
10
19
|
|
11
20
|
$ gem install spior -P MediumSecurity
|
12
21
|
|
22
|
+
Or user wide (Spior will use `sudo`)
|
23
|
+
|
24
|
+
$ gem install --user-install spior
|
25
|
+
|
13
26
|
## Usage
|
14
27
|
|
15
28
|
$ spior -h
|
data/Rakefile
CHANGED
@@ -13,7 +13,7 @@ namespace :gem do
|
|
13
13
|
task :build do
|
14
14
|
Dir["spior*.gem"].each {|f| File.unlink(f) }
|
15
15
|
system("gem build spior.gemspec")
|
16
|
-
system("gem install spior-#{Spior::VERSION}.gem -P MediumSecurity")
|
16
|
+
system("gem install --user-install spior-#{Spior::VERSION}.gem -P MediumSecurity")
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
data/lib/spior/clear.rb
CHANGED
data/lib/spior/copy.rb
CHANGED
data/lib/spior/dep.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'nomansland'
|
2
|
+
require 'tty-which'
|
3
|
+
|
4
|
+
module Spior
|
5
|
+
module Dep
|
6
|
+
def self.check
|
7
|
+
deps = [ 'iptables', 'tor' ]
|
8
|
+
is_ok = true
|
9
|
+
Msg.p 'Searching dependencies...'
|
10
|
+
deps.each {|dep|
|
11
|
+
unless TTY::Which.exist? dep
|
12
|
+
Msg.err "-> #{dep} is lacked."
|
13
|
+
is_ok = false
|
14
|
+
end
|
15
|
+
}
|
16
|
+
exit 1 unless is_ok
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.install
|
20
|
+
case Nomansland::installer?
|
21
|
+
when :emerge
|
22
|
+
Helpers::Exec.new('emerge -av').run('tor iptables')
|
23
|
+
when :pacman
|
24
|
+
Helpers::Exec.new('pacman -S').run('tor iptables')
|
25
|
+
when :yum
|
26
|
+
Helpers::Exec.new('yum install').run('tor iptables')
|
27
|
+
when :void
|
28
|
+
Helpers::Exec.new('xbps-install -y').run('tor iptables runit-iptables')
|
29
|
+
when :debian
|
30
|
+
Helpers::Exec.new('apt-get install').run('tor iptables iptables-persistent')
|
31
|
+
else
|
32
|
+
Msg.report 'Your system is not yet supported.'
|
33
|
+
end
|
34
|
+
exit 0
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/lib/spior/iptables/root.rb
CHANGED
data/lib/spior/iptables/tor.rb
CHANGED
@@ -9,7 +9,7 @@ module Spior
|
|
9
9
|
end
|
10
10
|
|
11
11
|
private
|
12
|
-
|
12
|
+
|
13
13
|
def redirect
|
14
14
|
@tables.each { |table|
|
15
15
|
target = "ACCEPT"
|
@@ -46,8 +46,6 @@ module Spior
|
|
46
46
|
ipt "-A INPUT -p tcp --dport 22 -m conntrack --ctstate NEW -j ACCEPT"
|
47
47
|
# Allow loopback
|
48
48
|
ipt "-A INPUT -i #{@lo} -j ACCEPT"
|
49
|
-
# Allow DNS lookups from connected clients and internet access through tor.
|
50
|
-
ipt "-A INPUT -p udp -m udp --dport #{@tor.dns} -j ACCEPT"
|
51
49
|
# Accept related
|
52
50
|
ipt "-A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT"
|
53
51
|
end
|
@@ -55,9 +53,6 @@ module Spior
|
|
55
53
|
def all
|
56
54
|
ipt "-t filter -A OUTPUT -p udp -j REJECT"
|
57
55
|
ipt "-t filter -A OUTPUT -p icmp -j REJECT"
|
58
|
-
ipt "-P INPUT DROP"
|
59
|
-
ipt "-P FORWARD DROP"
|
60
|
-
ipt "-P OUTPUT DROP"
|
61
56
|
end
|
62
57
|
end
|
63
58
|
end
|
data/lib/spior/menu.rb
CHANGED
data/lib/spior/msg.rb
CHANGED
data/lib/spior/options.rb
CHANGED
@@ -15,7 +15,7 @@ module Spior
|
|
15
15
|
|
16
16
|
def parse(argv)
|
17
17
|
OptionParser.new do |opts|
|
18
|
-
opts.on("-i", "--install", "
|
18
|
+
opts.on("-i", "--install", "Install the dependencies") do
|
19
19
|
@install = true
|
20
20
|
end
|
21
21
|
|
@@ -24,7 +24,7 @@ module Spior
|
|
24
24
|
end
|
25
25
|
|
26
26
|
opts.on("-r", "--reload", "Reload TOR to change your ip") do
|
27
|
-
Spior::
|
27
|
+
Spior::Service.restart
|
28
28
|
exit
|
29
29
|
end
|
30
30
|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'tty-which'
|
2
|
+
|
3
|
+
module Spior
|
4
|
+
module Service
|
5
|
+
module_function
|
6
|
+
|
7
|
+
def restart
|
8
|
+
if TTY::Which.exist?('systemctl')
|
9
|
+
Helpers::Exec.new("systemctl").run("restart tor")
|
10
|
+
Msg.p "ip changed."
|
11
|
+
elsif TTY::Which.exist? 'sv'
|
12
|
+
Helpers::Exec.new('sv').run('restart tor')
|
13
|
+
Msg.p 'ip changed.'
|
14
|
+
elsif File.exist? '/etc/init.d/tor'
|
15
|
+
Helpers::Exec.new('/etc/init.d/tor').run('restart')
|
16
|
+
else
|
17
|
+
Msg.report "Don't known yet how to restart Tor for your system."
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'tty-which'
|
2
|
+
|
3
|
+
module Spior
|
4
|
+
module Service
|
5
|
+
module_function
|
6
|
+
|
7
|
+
def start
|
8
|
+
if TTY::Which.exist?('systemctl')
|
9
|
+
state = `systemctl is-active tor`.chomp
|
10
|
+
unless state == 'active'
|
11
|
+
Helpers::Exec.new("systemctl").run("start tor")
|
12
|
+
Msg.p "TOR started."
|
13
|
+
end
|
14
|
+
elsif TTY::Which.exist? 'sv'
|
15
|
+
unless File.exist? '/var/service/tor'
|
16
|
+
Helpers::Exec.new('ln').run('-s /etc/sv/tor /var/service/tor')
|
17
|
+
Msg.p "TOR started."
|
18
|
+
end
|
19
|
+
elsif File.exist? '/etc/init.d/tor'
|
20
|
+
Helpers::Exec.new('/etc/init.d/tor').run('start')
|
21
|
+
else
|
22
|
+
Msg.report "Don't known yet how to start Tor for your system."
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/spior/tor/info.rb
CHANGED
@@ -9,7 +9,6 @@ module Spior
|
|
9
9
|
|
10
10
|
def initialize
|
11
11
|
@systemctl = Helpers::Exec.new("systemctl")
|
12
|
-
check_deps
|
13
12
|
@dns = search_dns
|
14
13
|
@uid = search_uid
|
15
14
|
@trans_port = search_trans_port
|
@@ -19,18 +18,9 @@ module Spior
|
|
19
18
|
private
|
20
19
|
|
21
20
|
def check_deps
|
22
|
-
Spior::Install::check_deps
|
23
21
|
Spior::Copy.new.save
|
24
|
-
add_resolv
|
25
22
|
add_torrc
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
def add_resolv
|
30
|
-
string = "nameserver 127.0.0.1"
|
31
|
-
new_file = Helpers::NewFile.new(string, "resolv.conf", "/etc")
|
32
|
-
new_file.add
|
33
|
-
new_file.perm("root", "644")
|
23
|
+
Spior::Service.start
|
34
24
|
end
|
35
25
|
|
36
26
|
def self.grep?(file, regex)
|
@@ -45,14 +35,20 @@ module Spior
|
|
45
35
|
end
|
46
36
|
|
47
37
|
def add_torrc
|
48
|
-
user =
|
49
|
-
pid =
|
50
|
-
dir =
|
38
|
+
user = 'User tor'
|
39
|
+
pid = ''
|
40
|
+
dir = 'DataDirectory /var/lib/tor'
|
41
|
+
|
51
42
|
case Nomansland::distro?
|
52
43
|
when :gentoo
|
53
|
-
|
54
|
-
|
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'
|
55
50
|
end
|
51
|
+
|
56
52
|
string = <<EOF
|
57
53
|
# Generated by Spior
|
58
54
|
#{user}
|
@@ -95,19 +91,6 @@ EOF
|
|
95
91
|
def search_virt_addr
|
96
92
|
"10.192.0.0/10"
|
97
93
|
end
|
98
|
-
|
99
|
-
def verify_service
|
100
|
-
if TTY::Which.exist?('systemctl')
|
101
|
-
state = `systemctl is-active tor`.chomp
|
102
|
-
if state == 'active'
|
103
|
-
@systemctl.run('restart tor')
|
104
|
-
else
|
105
|
-
@systemctl.run('start tor')
|
106
|
-
end
|
107
|
-
else
|
108
|
-
Msg.for_no_systemd
|
109
|
-
end
|
110
|
-
end
|
111
94
|
end
|
112
95
|
end
|
113
96
|
end
|
data/lib/spior/tor.rb
CHANGED
data/lib/spior/version.rb
CHANGED
data/lib/spior.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
require_relative 'spior/clear'
|
2
2
|
require_relative 'spior/copy'
|
3
|
-
require_relative 'spior/
|
3
|
+
require_relative 'spior/dep'
|
4
4
|
require_relative 'spior/iptables'
|
5
5
|
require_relative 'spior/msg'
|
6
6
|
require_relative 'spior/options'
|
7
7
|
require_relative 'spior/status'
|
8
8
|
require_relative 'spior/tor'
|
9
9
|
require_relative 'spior/persist'
|
10
|
-
require_relative 'spior/network'
|
11
10
|
require_relative 'spior/menu'
|
11
|
+
require_relative 'spior/service'
|
12
12
|
require_relative 'spior/helpers'
|
13
13
|
|
14
14
|
module Spior
|
@@ -25,10 +25,12 @@ module Spior
|
|
25
25
|
|
26
26
|
if options.install
|
27
27
|
Msg.head
|
28
|
-
|
28
|
+
Dep.install
|
29
29
|
Copy.new.save
|
30
30
|
end
|
31
31
|
|
32
|
+
Dep.check
|
33
|
+
|
32
34
|
if options.tor
|
33
35
|
Msg.head
|
34
36
|
Iptables::Tor.new.run!
|
data/man/spior.1
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
.\" generated with Ronn/v0.7.3
|
2
|
+
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
|
+
.
|
4
|
+
.TH "SPIOR" "1" "December 2021" "" ""
|
5
|
+
.
|
6
|
+
.SH "NAME"
|
7
|
+
\fBspior\fR \- Redirect all traffic to the Tor network
|
8
|
+
.
|
9
|
+
.SH "SYNOPSIS"
|
10
|
+
\fBspior\fR [\fIOPTIONS\fR\.\.\.]
|
11
|
+
.
|
12
|
+
.SH "DESCRIPTION"
|
13
|
+
\fBSpior\fR can redirect all the local traffic to the Tor network\.
|
14
|
+
.
|
15
|
+
.SH "OPTIONS"
|
16
|
+
.
|
17
|
+
.TP
|
18
|
+
\fB\-h\fR, \fB\-\-help\fR
|
19
|
+
Display the help and exit\.
|
20
|
+
.
|
21
|
+
.TP
|
22
|
+
\fB\-t\fR, \fB\-\-tor\fR
|
23
|
+
Spior will backup and create a new \fB/etc/tor/torrc\fR to add the required \fBtor\fR options and finally use \fBiptables\fR to create a transparent proxy throught Tor\.
|
24
|
+
.
|
25
|
+
.TP
|
26
|
+
\fB\-p\fR, \fB\-\-persist\fR
|
27
|
+
This option use \fBiptable\-save\fR to save actual rules and try to enable the service \fBiptables\fR for boot\.
|
28
|
+
.
|
29
|
+
.TP
|
30
|
+
\fB\-r\fR, \fB\-\-reload\fR
|
31
|
+
This option reload the Tor circuit which change your current ip address\. Use this option if your actual ip is blacklisted\.
|
32
|
+
.
|
33
|
+
.TP
|
34
|
+
\fB\-c\fR, \fB\-\-clearnet\fR
|
35
|
+
This option stop to redirect to Tor (by cleaning \fBiptables\fR rules) and use the normal connection\.
|
36
|
+
.
|
37
|
+
.SH "EXAMPLES"
|
38
|
+
Display the help:
|
39
|
+
.
|
40
|
+
.br
|
41
|
+
$ spior \-h
|
42
|
+
.
|
43
|
+
.P
|
44
|
+
Redirect all the traffic throught Tor:
|
45
|
+
.
|
46
|
+
.br
|
47
|
+
$ spior \-\-tor
|
48
|
+
.
|
49
|
+
.SH "SEE ALSO"
|
50
|
+
iptables(8), tor(1)
|
51
|
+
.
|
52
|
+
.SH "ISSUES"
|
53
|
+
You are free to report any new bugs|features|issues at https://github\.com/szorfein/spior/issues\.
|
data/man/spior.1.html
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv='content-type' value='text/html;charset=utf8'>
|
5
|
+
<meta name='generator' value='Ronn/v0.7.3 (http://github.com/rtomayko/ronn/tree/0.7.3)'>
|
6
|
+
<title>spior(1) - Redirect all traffic to the Tor network</title>
|
7
|
+
<style type='text/css' media='all'>
|
8
|
+
/* style: man */
|
9
|
+
body#manpage {margin:0}
|
10
|
+
.mp {max-width:100ex;padding:0 9ex 1ex 4ex}
|
11
|
+
.mp p,.mp pre,.mp ul,.mp ol,.mp dl {margin:0 0 20px 0}
|
12
|
+
.mp h2 {margin:10px 0 0 0}
|
13
|
+
.mp > p,.mp > pre,.mp > ul,.mp > ol,.mp > dl {margin-left:8ex}
|
14
|
+
.mp h3 {margin:0 0 0 4ex}
|
15
|
+
.mp dt {margin:0;clear:left}
|
16
|
+
.mp dt.flush {float:left;width:8ex}
|
17
|
+
.mp dd {margin:0 0 0 9ex}
|
18
|
+
.mp h1,.mp h2,.mp h3,.mp h4 {clear:left}
|
19
|
+
.mp pre {margin-bottom:20px}
|
20
|
+
.mp pre+h2,.mp pre+h3 {margin-top:22px}
|
21
|
+
.mp h2+pre,.mp h3+pre {margin-top:5px}
|
22
|
+
.mp img {display:block;margin:auto}
|
23
|
+
.mp h1.man-title {display:none}
|
24
|
+
.mp,.mp code,.mp pre,.mp tt,.mp kbd,.mp samp,.mp h3,.mp h4 {font-family:monospace;font-size:14px;line-height:1.42857142857143}
|
25
|
+
.mp h2 {font-size:16px;line-height:1.25}
|
26
|
+
.mp h1 {font-size:20px;line-height:2}
|
27
|
+
.mp {text-align:justify;background:#fff}
|
28
|
+
.mp,.mp code,.mp pre,.mp pre code,.mp tt,.mp kbd,.mp samp {color:#131211}
|
29
|
+
.mp h1,.mp h2,.mp h3,.mp h4 {color:#030201}
|
30
|
+
.mp u {text-decoration:underline}
|
31
|
+
.mp code,.mp strong,.mp b {font-weight:bold;color:#131211}
|
32
|
+
.mp em,.mp var {font-style:italic;color:#232221;text-decoration:none}
|
33
|
+
.mp a,.mp a:link,.mp a:hover,.mp a code,.mp a pre,.mp a tt,.mp a kbd,.mp a samp {color:#0000ff}
|
34
|
+
.mp b.man-ref {font-weight:normal;color:#434241}
|
35
|
+
.mp pre {padding:0 4ex}
|
36
|
+
.mp pre code {font-weight:normal;color:#434241}
|
37
|
+
.mp h2+pre,h3+pre {padding-left:0}
|
38
|
+
ol.man-decor,ol.man-decor li {margin:3px 0 10px 0;padding:0;float:left;width:33%;list-style-type:none;text-transform:uppercase;color:#999;letter-spacing:1px}
|
39
|
+
ol.man-decor {width:100%}
|
40
|
+
ol.man-decor li.tl {text-align:left}
|
41
|
+
ol.man-decor li.tc {text-align:center;letter-spacing:4px}
|
42
|
+
ol.man-decor li.tr {text-align:right;float:right}
|
43
|
+
</style>
|
44
|
+
</head>
|
45
|
+
<!--
|
46
|
+
The following styles are deprecated and will be removed at some point:
|
47
|
+
div#man, div#man ol.man, div#man ol.head, div#man ol.man.
|
48
|
+
|
49
|
+
The .man-page, .man-decor, .man-head, .man-foot, .man-title, and
|
50
|
+
.man-navigation should be used instead.
|
51
|
+
-->
|
52
|
+
<body id='manpage'>
|
53
|
+
<div class='mp' id='man'>
|
54
|
+
|
55
|
+
<div class='man-navigation' style='display:none'>
|
56
|
+
<a href="#NAME">NAME</a>
|
57
|
+
<a href="#SYNOPSIS">SYNOPSIS</a>
|
58
|
+
<a href="#DESCRIPTION">DESCRIPTION</a>
|
59
|
+
<a href="#OPTIONS">OPTIONS</a>
|
60
|
+
<a href="#EXAMPLES">EXAMPLES</a>
|
61
|
+
<a href="#SEE-ALSO">SEE ALSO</a>
|
62
|
+
<a href="#ISSUES">ISSUES</a>
|
63
|
+
</div>
|
64
|
+
|
65
|
+
<ol class='man-decor man-head man head'>
|
66
|
+
<li class='tl'>spior(1)</li>
|
67
|
+
<li class='tc'></li>
|
68
|
+
<li class='tr'>spior(1)</li>
|
69
|
+
</ol>
|
70
|
+
|
71
|
+
<h2 id="NAME">NAME</h2>
|
72
|
+
<p class="man-name">
|
73
|
+
<code>spior</code> - <span class="man-whatis">Redirect all traffic to the Tor network</span>
|
74
|
+
</p>
|
75
|
+
|
76
|
+
<h2 id="SYNOPSIS">SYNOPSIS</h2>
|
77
|
+
|
78
|
+
<p><code>spior</code> [<var>OPTIONS</var>...]</p>
|
79
|
+
|
80
|
+
<h2 id="DESCRIPTION">DESCRIPTION</h2>
|
81
|
+
|
82
|
+
<p><strong>Spior</strong> can redirect all the local traffic to the Tor network.</p>
|
83
|
+
|
84
|
+
<h2 id="OPTIONS">OPTIONS</h2>
|
85
|
+
|
86
|
+
<dl>
|
87
|
+
<dt><code>-h</code>, <code>--help</code></dt><dd><p>Display the help and exit.</p></dd>
|
88
|
+
<dt><code>-t</code>, <code>--tor</code></dt><dd><p>Spior will backup and create a new <code>/etc/tor/torrc</code> to add the required
|
89
|
+
<code>tor</code> options and finally use <code>iptables</code> to create a transparent proxy
|
90
|
+
throught Tor.</p></dd>
|
91
|
+
<dt><code>-p</code>, <code>--persist</code></dt><dd><p>This option use <code>iptable-save</code> to save actual rules and try to enable the service <code>iptables</code> for boot.</p></dd>
|
92
|
+
<dt><code>-r</code>, <code>--reload</code></dt><dd><p>This option reload the Tor circuit which change your current ip address. Use this option if your actual ip is blacklisted.</p></dd>
|
93
|
+
<dt><code>-c</code>, <code>--clearnet</code></dt><dd><p>This option stop to redirect to Tor (by cleaning <code>iptables</code> rules) and use the normal connection.</p></dd>
|
94
|
+
</dl>
|
95
|
+
|
96
|
+
|
97
|
+
<h2 id="EXAMPLES">EXAMPLES</h2>
|
98
|
+
|
99
|
+
<p>Display the help:<br />
|
100
|
+
$ spior -h</p>
|
101
|
+
|
102
|
+
<p>Redirect all the traffic throught Tor:<br />
|
103
|
+
$ spior --tor</p>
|
104
|
+
|
105
|
+
<h2 id="SEE-ALSO">SEE ALSO</h2>
|
106
|
+
|
107
|
+
<p><span class="man-ref">iptables<span class="s">(8)</span></span>, <span class="man-ref">tor<span class="s">(1)</span></span></p>
|
108
|
+
|
109
|
+
<h2 id="ISSUES">ISSUES</h2>
|
110
|
+
|
111
|
+
<p>You are free to report any new bugs|features|issues at https://github.com/szorfein/spior/issues.</p>
|
112
|
+
|
113
|
+
|
114
|
+
<ol class='man-decor man-foot man foot'>
|
115
|
+
<li class='tl'></li>
|
116
|
+
<li class='tc'>December 2021</li>
|
117
|
+
<li class='tr'>spior(1)</li>
|
118
|
+
</ol>
|
119
|
+
|
120
|
+
</div>
|
121
|
+
</body>
|
122
|
+
</html>
|
data/man/spior.1.ronn
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
spior(1) -- Redirect all traffic to the Tor network
|
2
|
+
====================================================
|
3
|
+
|
4
|
+
## SYNOPSIS
|
5
|
+
|
6
|
+
`spior` [<OPTIONS>...]
|
7
|
+
|
8
|
+
## DESCRIPTION
|
9
|
+
|
10
|
+
**Spior** can redirect all the local traffic to the Tor network.
|
11
|
+
|
12
|
+
## OPTIONS
|
13
|
+
|
14
|
+
* `-h`, `--help`:
|
15
|
+
Display the help and exit.
|
16
|
+
|
17
|
+
* `-t`, `--tor`:
|
18
|
+
Spior will backup and create a new `/etc/tor/torrc` to add the required
|
19
|
+
`tor` options and finally use `iptables` to create a transparent proxy
|
20
|
+
throught Tor.
|
21
|
+
|
22
|
+
* `-p`, `--persist`:
|
23
|
+
This option use `iptable-save` to save actual rules and try to enable the service `iptables` for boot.
|
24
|
+
|
25
|
+
* `-r`, `--reload`:
|
26
|
+
This option reload the Tor circuit which change your current ip address. Use this option if your actual ip is blacklisted.
|
27
|
+
|
28
|
+
* `-c`, `--clearnet`:
|
29
|
+
This option stop to redirect to Tor (by cleaning `iptables` rules) and use the normal connection.
|
30
|
+
|
31
|
+
## EXAMPLES
|
32
|
+
|
33
|
+
Display the help:<br>
|
34
|
+
$ spior -h
|
35
|
+
|
36
|
+
Redirect all the traffic throught Tor:<br>
|
37
|
+
$ spior --tor
|
38
|
+
|
39
|
+
|
40
|
+
## SEE ALSO
|
41
|
+
|
42
|
+
iptables(8), tor(1)
|
43
|
+
|
44
|
+
## ISSUES
|
45
|
+
|
46
|
+
You are free to report any new bugs|features|issues at https://github.com/szorfein/spior/issues.
|
data/spior.gemspec
CHANGED
@@ -34,10 +34,10 @@ Gem::Specification.new do |s|
|
|
34
34
|
s.requirements << 'tor'
|
35
35
|
s.requirements << 'iptables'
|
36
36
|
|
37
|
-
s.required_ruby_version = '>=2.
|
37
|
+
s.required_ruby_version = '>=2.5'
|
38
38
|
|
39
39
|
s.add_runtime_dependency('rainbow', '3.0.0')
|
40
40
|
s.add_runtime_dependency('interfacez', '1.0.3')
|
41
|
-
s.add_runtime_dependency('nomansland', '0.0.
|
41
|
+
s.add_runtime_dependency('nomansland', '0.0.3')
|
42
42
|
s.add_runtime_dependency('tty-which', '0.4.2')
|
43
43
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spior
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- szorfein
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIETTCCArWgAwIBAgIBATANBgkqhkiG9w0BAQsFADAoMSYwJAYDVQQDDB1zem9y
|
14
|
-
|
15
|
-
|
14
|
+
ZmVpbi9EQz1wcm90b25tYWlsL0RDPWNvbTAeFw0yMTA1MTEyMTAzNDZaFw0yMjA1
|
15
|
+
MTEyMTAzNDZaMCgxJjAkBgNVBAMMHXN6b3JmZWluL0RDPXByb3Rvbm1haWwvREM9
|
16
16
|
Y29tMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAxCTYZRndCTRy18rE
|
17
17
|
exr2wig/staa0G5kt99xqaBYD0dnIRBr/GO5dFntlBVwmefQlTrNbygVUIYTb8Vg
|
18
18
|
B1oX3v/LLW9SRQcWaZwou0tARqanm5WhgV1ZYQTs22endTazsDHw0uhM3V+FgDh+
|
@@ -25,17 +25,17 @@ cert_chain:
|
|
25
25
|
BgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUc8XWveAjxS5fVEOZeeZe
|
26
26
|
uUQmbhMwIgYDVR0RBBswGYEXc3pvcmZlaW5AcHJvdG9ubWFpbC5jb20wIgYDVR0S
|
27
27
|
BBswGYEXc3pvcmZlaW5AcHJvdG9ubWFpbC5jb20wDQYJKoZIhvcNAQELBQADggGB
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
28
|
+
AHuRqWvtAx1PSIEcvq1uzgBclzP+Lhp6J1f7McvbfzHAZuLo5Nv9iFHkLl2ad9gx
|
29
|
+
p/X2/p8PmgiUNFSXDdB12Pn/VbX4DdoQujwXvmZbQo2KmooklHIhM6AJMafOHW1N
|
30
|
+
qjHIwGvMY5bJfn+3qEQNV+yip6KnCUQVklw132IFvdusoBOPfEP48p41deXbIhNP
|
31
|
+
GNJQ4qkZfXWdLumikb2Y432kIIeugIIAL57VD+wwDUJ3MciiLufYT7v9WNSFRenV
|
32
|
+
JDNGIh3AYiCnNO2DWIArrW6/jaof3A0OnjRQ64vS+EKhZFp8+y6rfC3Clrfjdjse
|
33
|
+
a4zH3TI57bnzfkx5xhjhIu6LJnBpk0x8Y/N2kVmwB+GonFiRcVzZpIfOLvy03tn5
|
34
|
+
dAHfUn//hrBJAT9EXRHNUoLyEmFsCPabTCXjQH6EM2uBcsrjQN4SlgBNzsKc8bS4
|
35
|
+
F9Dl4EPzjBJOgQWf+NxzxNuNKI46Lp5Q8AI+xtDUHAPbSswHa40BA6ChFehP+j0L
|
36
|
+
fg==
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date:
|
38
|
+
date: 2021-12-30 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: rainbow
|
@@ -71,14 +71,14 @@ dependencies:
|
|
71
71
|
requirements:
|
72
72
|
- - '='
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: 0.0.
|
74
|
+
version: 0.0.3
|
75
75
|
type: :runtime
|
76
76
|
prerelease: false
|
77
77
|
version_requirements: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - '='
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: 0.0.
|
81
|
+
version: 0.0.3
|
82
82
|
- !ruby/object:Gem::Dependency
|
83
83
|
name: tty-which
|
84
84
|
requirement: !ruby/object:Gem::Requirement
|
@@ -113,22 +113,26 @@ files:
|
|
113
113
|
- lib/spior.rb
|
114
114
|
- lib/spior/clear.rb
|
115
115
|
- lib/spior/copy.rb
|
116
|
+
- lib/spior/dep.rb
|
116
117
|
- lib/spior/helpers.rb
|
117
|
-
- lib/spior/install.rb
|
118
118
|
- lib/spior/iptables.rb
|
119
119
|
- lib/spior/iptables/default.rb
|
120
120
|
- lib/spior/iptables/root.rb
|
121
121
|
- lib/spior/iptables/tor.rb
|
122
122
|
- lib/spior/menu.rb
|
123
123
|
- lib/spior/msg.rb
|
124
|
-
- lib/spior/network.rb
|
125
124
|
- lib/spior/options.rb
|
126
125
|
- lib/spior/persist.rb
|
126
|
+
- lib/spior/service.rb
|
127
|
+
- lib/spior/service/restart.rb
|
128
|
+
- lib/spior/service/start.rb
|
127
129
|
- lib/spior/status.rb
|
128
130
|
- lib/spior/tor.rb
|
129
131
|
- lib/spior/tor/info.rb
|
130
|
-
- lib/spior/tor/restart.rb
|
131
132
|
- lib/spior/version.rb
|
133
|
+
- man/spior.1
|
134
|
+
- man/spior.1.html
|
135
|
+
- man/spior.1.ronn
|
132
136
|
- spior.gemspec
|
133
137
|
- test/test_install.rb
|
134
138
|
- test/test_options.rb
|
@@ -139,7 +143,7 @@ metadata:
|
|
139
143
|
changelog_uri: https://github.com/szorfein/spior/blob/master/CHANGELOG.md
|
140
144
|
bug_tracker_uri: https://github.com/szorfein/spior/issues
|
141
145
|
wiki_uri: https://github.com/szorfein/spior
|
142
|
-
post_install_message:
|
146
|
+
post_install_message:
|
143
147
|
rdoc_options: []
|
144
148
|
require_paths:
|
145
149
|
- lib
|
@@ -147,7 +151,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
147
151
|
requirements:
|
148
152
|
- - ">="
|
149
153
|
- !ruby/object:Gem::Version
|
150
|
-
version: '2.
|
154
|
+
version: '2.5'
|
151
155
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
156
|
requirements:
|
153
157
|
- - ">="
|
@@ -156,8 +160,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
160
|
requirements:
|
157
161
|
- tor
|
158
162
|
- iptables
|
159
|
-
rubygems_version: 3.
|
160
|
-
signing_key:
|
163
|
+
rubygems_version: 3.2.32
|
164
|
+
signing_key:
|
161
165
|
specification_version: 4
|
162
166
|
summary: A tool to make TOR your default gateway
|
163
167
|
test_files:
|
metadata.gz.sig
CHANGED
Binary file
|
data/lib/spior/install.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'nomansland'
|
2
|
-
require 'tty-which'
|
3
|
-
|
4
|
-
module Spior
|
5
|
-
class Install
|
6
|
-
class << self
|
7
|
-
def check_deps
|
8
|
-
base_packages
|
9
|
-
end
|
10
|
-
|
11
|
-
private
|
12
|
-
|
13
|
-
def base_packages
|
14
|
-
if not TTY::Which.exist?('iptables') or not TTY::Which.exist?('tor')
|
15
|
-
case Nomansland::installer?
|
16
|
-
when :emerge
|
17
|
-
emerge = Helpers::Exec.new("emerge -av --changed-use")
|
18
|
-
emerge.run("tor iptables")
|
19
|
-
when :pacman
|
20
|
-
pacman = Helpers::Exec.new("pacman -S --needed")
|
21
|
-
pacman.run("tor iptables")
|
22
|
-
when :yum
|
23
|
-
yum = Helpers::Exec.new("yum install")
|
24
|
-
yum.run("tor iptables")
|
25
|
-
else
|
26
|
-
apt_get = Helpers::Exec.new("apt-get install")
|
27
|
-
apt_get.run("tor iptables iptables-persistent")
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
data/lib/spior/network.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'interfacez'
|
2
|
-
|
3
|
-
module Spior
|
4
|
-
class Network
|
5
|
-
attr_accessor :card
|
6
|
-
|
7
|
-
def initialize(name = false)
|
8
|
-
@name = name
|
9
|
-
@check = false
|
10
|
-
end
|
11
|
-
|
12
|
-
def card
|
13
|
-
verify_card
|
14
|
-
if @check == false then
|
15
|
-
ask_for_card
|
16
|
-
end
|
17
|
-
@name
|
18
|
-
end
|
19
|
-
|
20
|
-
private
|
21
|
-
|
22
|
-
def verify_card
|
23
|
-
return if @check or not @name
|
24
|
-
Interfacez.all do |interface|
|
25
|
-
if interface == @name then
|
26
|
-
@check = true
|
27
|
-
end
|
28
|
-
end
|
29
|
-
if not @check then
|
30
|
-
Msg.err "Your interface #{@name} is no found"
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def ask_for_card
|
35
|
-
until @check == true
|
36
|
-
Interfacez.all do |interface|
|
37
|
-
print interface + " "
|
38
|
-
end
|
39
|
-
printf "\nWhat is the name of the card to be used? "
|
40
|
-
@name = gets.chomp
|
41
|
-
verify_card
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
data/lib/spior/tor/restart.rb
DELETED