-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathstart.sh
101 lines (89 loc) · 2.01 KB
/
start.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
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
#!/bin/bash
# set -x
red='\033[0;31m'
green='\033[1;32m'
blue='\033[1;36m'
white='\033[1;37m'
plain='\033[0m'
os() {
if [[ -f /etc/os-release ]]; then
source /etc/os-release
release=$ID
elif [[ -f /usr/lib/os-release ]]; then
source /usr/lib/os-release
release=$ID
else
echo "Failed to check the system OS, please contact the author!" >&2
exit 1
fi
echo "The OS release is: $release"
if [[ "${release}" == "debian" ]] || [[ "${release}" == "ubuntu" ]]; then
apt install -y conntrack ipset iptables
./multi.sh
else
./multi.sh
fi
}
wrapup() {
echo -e "\n${green}These are the values you entered: ${plain}\n"
echo
echo -e "${white}$(cat ipv4.txt) ${plain}"
echo
echo -e "${white}$(cat ipv6.txt) ${plain}"
echo
echo -e "${green}"
read -p "Are these values correct? <y/n> " response
echo -e "${plain}"
case $response in
[yY]*)
os
;;
[nN]*)
echo -e ${green} "Okay then, we start again." ${plain}
start
;;
*)
echo -e ${red}"Invalid option. Let's start again"${plain}
sleep 1
start
;;
esac
}
start() {
echo -e "\n${green}Please enter your IPv4 (e.g. 10.10.10.10):\n ${plain}"
read IP
echo -e "\n${green}Enter your ORPort or comma separated multiple ORPorts (e.g. 443,80,8080):\n ${plain}"
read OR
if [[ -f "ipv4.txt" ]]; then
/bin/rm -r ipv4.txt
fi
IFS=","
for v in $OR; do
echo $IP:$v >>ipv4.txt
done
echo -e "${green}"
read -p "Do you have an IPv6 address? <y/n> " prompt
echo -e "${plain}"
case $prompt in
[yY]*)
echo -e "\n${green}enter your IPv6:\n ${plain}"
read IP6
if [[ -f "ipv6.txt" ]]; then
/bin/rm -r ipv6.txt
fi
for v in $OR; do
echo [$IP6]:$v >>ipv6.txt
done
wrapup
;;
[nN]*)
echo >ipv6.txt
wrapup
;;
*)
echo -e ${red}"You entered an invalid option. Let's start again."${plain}
start
;;
esac
}
start