forked from bepass-org/warp-plus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
termux.sh
203 lines (182 loc) · 6.55 KB
/
termux.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
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
#!/bin/bash
# Colors
red='\033[0;31m'
green='\033[0;32m'
yellow='\033[0;33m'
blue='\033[0;34m'
purple='\033[0;35m'
cyan='\033[0;36m'
rest='\033[0m'
# Check Dependencies build
check_dependencies_build() {
local dependencies=("curl" "wget" "git" "golang")
for dep in "${dependencies[@]}"; do
if ! dpkg -s "${dep}" &> /dev/null; then
echo -e "${yellow}${dep} is not installed. Installing...${rest}"
pkg install "${dep}" -y
fi
done
}
# Check Dependencies
check_dependencies() {
local dependencies=("curl" "openssl-tool" "wget" "unzip")
for dep in "${dependencies[@]}"; do
if ! dpkg -s "${dep}" &> /dev/null; then
echo -e "${yellow}${dep} is not installed. Installing...${rest}"
pkg install "${dep}" -y
fi
done
}
# Build
build() {
if command -v warp &> /dev/null || command -v usef &> /dev/null; then
echo -e "${green}Warp is already installed.${rest}"
return
fi
echo -e "${green}Installing Warp...${rest}"
pkg update -y && pkg upgrade -y
check_dependencies_build
if git clone https://github.com/uoosef/wireguard-go.git &&
cd wireguard-go &&
go build main.go &&
chmod +x main &&
cp main "$PREFIX/bin/usef" &&
cp main "$PREFIX/bin/warp"; then
echo -e "${green}Warp installed successfully.${rest}"
else
echo -e "${red}Error installing WireGuard VPN.${rest}"
fi
}
# Install
install() {
if command -v warp &> /dev/null || command -v usef &> /dev/null; then
echo -e "${green}Warp is already installed.${rest}"
return
fi
echo -e "${green}Installing Warp...${rest}"
pkg update -y && pkg upgrade -y
check_dependencies
if wget https://github.com/uoosef/wireguard-go/releases/download/v0.0.3-alpha/warp-android-arm64.3410f4.zip &&
unzip warp-android-arm64.3410f4.zip &&
chmod +x warp &&
cp warp "$PREFIX/bin/usef" &&
cp warp "$PREFIX/bin/warp"; then
rm "README.md" "LICENSE" "warp-android-arm64.3410f4.zip"
echo "================================================"
echo -e "${green}Warp installed successfully.${rest}"
socks
else
echo -e "${red}Error installing Warp.${rest}"
fi
}
# arm 64 (old phone)
install_old() {
if command -v warp &> /dev/null || command -v usef &> /dev/null; then
echo -e "${green}Warp is already installed.${rest}"
return
fi
echo -e "${green}Installing Warp...${rest}"
pkg update -y && pkg upgrade -y
check_dependencies
if wget https://github.com/uoosef/wireguard-go/releases/download/v0.0.3-alpha/warp-linux-arm64.3410f4.zip &&
unzip warp-linux-arm64.3410f4.zip &&
chmod +x warp &&
cp warp "$PREFIX/bin/usef" &&
cp warp "$PREFIX/bin/warp"; then
rm "README.md" "LICENSE" "warp-linux-arm64.3410f4.zip"
echo "================================================"
echo -e "${green}Warp installed successfully.${rest}"
socks
else
echo -e "${red}Error installing Warp.${rest}"
fi
}
# Get socks config
socks() {
echo ""
echo -e "${yellow}Copy this Config to ${purple}V2ray${green} Or ${purple}Nekobox ${yellow}and Exclude Termux${rest}"
echo "================================================"
echo -e "${green}socks://Og==@127.0.0.1:8086#warp_(usef)${rest}"
echo "or"
echo -e "${green}Manually create a SOCKS configuration with IP ${purple}127.0.0.1 ${green}and port${purple} 8086..${rest}"
echo "================================================"
echo -e "${yellow}To run again, type:${green} warp ${rest}or${green} usef ${rest}or${green} ./warp${rest}"
echo "================================================"
echo -e "${green} If you get a 'Bad address' error, run ${yellow}[arm64]${rest}"
echo ""
}
#Uninstall
uninstall() {
warp="$PREFIX/bin/warp"
directory="/data/data/com.termux/files/home/wireguard-go"
home="/data/data/com.termux/files/home"
if [ -f "$warp" ]; then
rm -rf "$directory" "$PREFIX/bin/usef" "wa.py" "$PREFIX/bin/warp" "$home/wgcf-profile.ini" "$home/warp" "$home/wgcf-identity.json" > /dev/null 2>&1
echo -e "${red}Uninstallation completed.${rest}"
else
echo -e "${yellow} ____________________________________${rest}"
echo -e "${red} Not installed.Please Install First.${rest}${yellow}|"
echo -e "${yellow} ____________________________________${rest}"
fi
}
# Warp to Warp plus
warp_plus() {
if ! command -v python &> /dev/null; then
echo "Installing Python..."
pkg install python -y
fi
echo -e "${green}Downloading and running${purple} Warp+ script...${rest}"
wget -O wa.py https://raw.githubusercontent.com/Ptechgithub/configs/main/wa.py
python wa.py
}
# Menu
menu() {
clear
echo -e "${green}By --> Peyman * github.com/Ptechgithub * ${rest}"
echo ""
echo -e "${yellow}❤️github.com/${cyan}uoosef${yellow}/wireguard-go❤️${rest}"
echo -e "${purple}*********************************${rest}"
echo -e "${blue} ###${cyan} Warp in Termux ${blue}###${rest} ${purple} * ${rest}"
echo -e "${purple}*********************************${rest}"
echo -e "${cyan}1)${rest} ${green}Install Warp (vpn)${purple} * ${rest}"
echo -e " ${purple} * ${rest}"
echo -e "${cyan}2)${rest} ${green}Install Warp (vpn) [${yellow}arm 64${green}] ${purple} * ${rest}"
echo -e " ${purple} * ${rest}"
echo -e "${cyan}3)${rest} ${green}Uninstall${rest}${purple} * ${rest}"
echo -e " ${purple} * ${rest}"
echo -e "${cyan}4)${rest} ${green}Warp to ${purple}Warp plus${green} [${yellow}Free GB${green}]${rest}${purple} * ${rest}"
echo -e " ${purple} * ${rest}"
echo -e "${cyan}5)${rest} ${green}Build (warp)${purple} * ${rest}"
echo -e " ${purple} * ${rest}"
echo -e "${red}0)${rest} ${green}Exit ${purple}* ${rest}"
echo -e "${purple}*********************************${rest}"
}
# Main
menu
read -p "Please enter your selection [0-5]:" choice
case "$choice" in
1)
install
warp
;;
2)
install_old
warp
;;
3)
uninstall
;;
4)
warp_plus
;;
5)
build
;;
0)
echo -e "${cyan}Exiting...${rest}"
exit
;;
*)
echo "Invalid choice. Please select a valid option."
;;
esac