Repository navigation
Expand file tree
/
Copy pathCSI_TorVPN
More file actions
147 lines (127 loc) · 5.67 KB
/
Copy pathCSI_TorVPN
File metadata and controls
147 lines (127 loc) · 5.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#!/bin/bash
# CSI TorVPN proxy
# This script was built by CSI Linux to automate the process of switching on|off traffic through the CSI TorVPN internal vpn.
export PATH="/opt/csitools:/opt/csitools/helper:$HOME/bin:$HOME/.local/bin:/usr/sbin:$PATH"
export JAVA_HOME=/usr/lib/jvm/bellsoft-java8-full-amd64
echo "Setting up proxy through CSI's internal TorVPN. Tor"
# [ "root" != "$USER" ] && exec sudo $0 "$@"
if [ -z "$1" ]
then
key=$(zenity --password --title "Enter you SUDO password." --text "Enter you SUDO password." --width 400) || exit
else
echo "key is set"
key=$1
fi
#define choices
opt1="CSI TorVPN On"
opt2="CSI TorVPN Off"
#test=$(ifconfig enp0s8 | grep 10.152.152.11); echo $test
ifconfig
if [ -z "$2" ]
then
adapt=$(zenity --list --radiolist --column="Pick" --column="Network Adapter" TRUE $(ifconfig | grep flags | sed -e "s/:/\ FALSE\ :/g"| cut -d: -f1) --mid-search --height=185 --width=250 2> >(grep -v 'GtkDialog' >&2)) || exit
else
echo "Adapter is set to $2"
adapt=$2
fi
changenet=$(zenity --list --title "CSI TorVPN Setting" --text "What do you want to do?" --width=300 --height=125 --radiolist --column "Choose" --column "Option" TRUE "$opt1" FALSE "$opt2" 2> >(grep -v 'GtkDialog' >&2)) || exit
case $changenet in
$opt1 ) #Turn On
# comment
# clearwebip=$(curl https://ipv4.icanhazip.com/)
# echo $key | sudo -S /opt/csitools/iptable_flush
# echo $key | sudo -S /opt/csitools/CSI_TorScript $adapt
# echo $key | sudo -S ip link set $adapt down
# echo $key | sudo -S ip link set $adapt up
# sleep 2 | zenity --progress --pulsate --auto-close --auto-kill
# echo "Restarting Tor Service"
# echo $key | sudo -S systemctl restart tor
# sleep 2 | zenity --progress --pulsate --auto-close --auto-kill
# echo "Waiting 10 seconds for Tor to Restart"
# echo $key | sudo -S echo "nameserver 127.0.0.1" | sudo tee /etc/resolv.conf
# echo "Setting NameServer for DNS to 127.0.0.1 to prevent DNS leaks"
# sleep 10 | zenity --progress --pulsate --auto-close --auto-kill
# echo "Attempting to connect to external website through Tor to get external IP address..."
# wget ipinfo.io/ip | zenity --progress --pulsate --auto-close --auto-kill
#
# if [ $1 -gt 0 ]
# then
# echo "Still connecting to Tor"
# echo $key | sudo -S echo "nameserver 127.0.0.1" | sudo tee /etc/resolv.conf | zenity --progress --pulsate --auto-close --auto-kill
# fi
echo "# Pulling Clear Web IP"
clearwebip=$(curl https://ipv4.icanhazip.com/)
echo "CanIHaz: $clearwebip"
if test -z "$clearwebip"
then
clearwebip=$(curl https://ipinfo.io/ip)
echo "IPInfo: $clearwebip"
fi
(
echo 15
echo "# Flushing IPTables"
echo $key | sudo -S /opt/csitools/iptable_flush
echo 20
echo "# Flushing IPTables"
echo $key | sudo -S /opt/csitools/CSI_TorScript $adapt
echo 25
echo "# Resetting Network Card"
echo $key | sudo -S ip link set $adapt down
echo $key | sudo -S ip link set $adapt up
sleep 2
echo 30
echo "# Restarting the Tor Service"
echo $key | sudo -S systemctl restart tor
sleep 2
echo 60
echo "# Forcing DNS through Tor"
echo $key | sudo -S echo "nameserver 127.0.0.1" | sudo tee /etc/resolv.conf
echo 75
echo "# Testing Connection"
curl ipinfo.io/ip || sleep 10; echo $key | sudo -S echo "nameserver 127.0.0.1"
echo 100
echo "# CSI TorVPN complete! Verify connection..."
) | zenity --title "CSI TorVPN Connection Progress Bar" --progress --auto-close
darkwebip=$(curl https://ipv4.icanhazip.com/)
echo "CanIHaz: $darkwebip"
if test -z "$darkwebip"
then
darkwebip=$(curl https://ipinfo.io/ip)
echo "IPInfo: $darkwebip"
if test -z "$darkwebip"
then
echo "Verify Tor connection. Something isn't right"
fi
fi
echo "-----"
echo "Your Clearweb IP address was: " $clearwebip
echo "Your Tor IP address is now: " $darkwebip
curl ipinfo.io | tee ~/Cases/Network-data.txt
#gsettings set org.gnome.desktop.background picture-uri /home/csi/Pictures/Secured.jpg
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitorVirtual1/workspace0/last-image -n -t string -s /opt/csitools/wallpaper/CSI_TorVPN.jpg
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitoreDP-1/workspace0/last-image -n -t string -s /opt/csitools/wallpaper/CSI_TorVPN.jpg
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitorHDMI-A-0/workspace0/last-image -n -t string -s /opt/csitools/wallpaper/CSI_TorVPN.jpg
sleep 10
;;
$opt2 ) #Turn Off
echo $key | sudo -S /opt/csitools/iptable_flush
echo $key | sudo -S iptables-restore < /opt/csitools/CSI_IPtables.v4
echo $key | sudo -S ifconfig $adapt down
echo $key | sudo -S ip link set $adapt up
sleep 2
echo "Setting NameServer for DNS to 8.8.8.8 for normal Internet DNS"
echo $key | sudo -S echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf
echo "Restarting NetworkManager Service"
echo $key | sudo -S systemctl restart NetworkManager
echo "Restarting Tor Service"
echo $key | sudo -S systemctl restart tor
sleep 2
curl ipinfo.io | tee ~/Cases/Network-data.txt
#gsettings set org.gnome.desktop.background picture-uri /home/csi/Pictures/CSI-Dark.jpg
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitorVirtual1/workspace0/last-image -n -t string -s /opt/csitools/wallpaper/CSI-Linux-Dark.jpg
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitoreDP-1/workspace0/last-image -n -t string -s /opt/csitools/wallpaper/CSI-Linux-Dark.jpg
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitorHDMI-A-0/workspace0/last-image -n -t string -s /opt/csitools/wallpaper/CSI-Linux-Dark.jpg
sleep 10
esac
exit 1
}