-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtormux.sh
51 lines (34 loc) · 1.7 KB
/
tormux.sh
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
#!/bin/bash
install_tor(){
printf "updating apt data\n"
sleep 3
apt update -y
printf "upgrading aplications\n"
sleep 3
apt upgrade -y
printf "installing tor, privoxy and obfs4socks\n"
apt install -y tor privoxy obfs4proxy
[[ ! $(apt list tor | grep tor) ]] && printf " there is something wrong, tor is not installed\n" && exit 1 || printf "tor is installed\n"
[[ ! $(apt list obfs4proxy | grep obfs4proxy) ]] && printf " there is something wrong, obfs4proxy is not installed\n" && exit 1 || printf "obfs4proxy is installed\n"
[[ ! $(apt list privoxy | grep privoxy) ]] && printf " there is something wrong, privoxy is not installed\n" && exit 1 || printf "privoxy is installed\n"
sleep 3
back_up_config=/data/data/com.termux/files/usr/etc/tor/torrc.bak
tor_config=/data/data/com.termux/files/usr/etc/tor/torrc
[ ! -f "$back_up_config" ] && printf "Backing up the tor original config file\n" && cp "$tor_config" "$back_up_config"
sleep 3
printf "Getting storage access for termux\n"
sleep 3
termux-setup-storage
printf "Config tor and add obfs bridges\n"
[ ! -d ~/.tormux ] && printf "Creating tormux directory\n" && mkdir ~/.tormux
sleep 3
curl -L https://raw.githubusercontent.com/mhdzli/tormux/main/obfs4.txt -o ~/storage/downloads/obfs.txt
curl -L https://raw.githubusercontent.com/mhdzli/tormux/main/tormuxconfig -o ~/.tormux/tormuxconfig
}
obfs_update(){
sed -e '/^[[:space:]]*$/d' -e 's/^/Bridge /' ~/storage/downloads/obfs.txt > ~/.tormux/obfs
cat "$back_up_config" ~/.tormux/tormuxconfig ~/.tormux/obfs > "$tor_config"
printf "Run 'tor &' and check if you can connect to tor network\n"
}
[[ "$1" == "install" ]] && install_tor && obfs_update
[[ "$1" == "update" ]] && obfs_update