-
Notifications
You must be signed in to change notification settings - Fork 1
/
cloud.sh
92 lines (90 loc) · 2.64 KB
/
cloud.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
#!/usr/bin/bash
# made by prince kumar
# date 10 may
trap exit_out SIGINT
trap exit_out SIGTERM
# make a function to exit out of program
exit_out(){
echo -e "\033[31;1m Program terminated "
}
#make a banner for the tools
banner(){
echo -e "\e[33;1m "
echo " .-~~~-.
.- ~ ~-( )_ _
/ ~ -.
| ',
\ .'
~- ._ ,. ,.,.,., ,.. -~
' '"
echo -e "\e[32;1m MADE BY PRINCE"
}
# make a function to install all the requirements ..
req(){
if [[ -d "/data/data/com.termux/files/home" ]];then
if [[ `command -v proot` ]];then
echo ""
else
echo -e "\e[33;1m Installing some pkg"
pkg install proot resolv-conf
fi
else
if [[ `command -v wget` ]];then
echo ""
else
echo -e "\e[33;1m Installing some pkg"
apt install wget
fi
fi
}
req
# make a help function
help(){
echo -e "\e[35;1m Cloud is a portforwoding tool using cloudflared"
}
# now start the cloudflare
start_cloud(){
# remove the previous log file
rm -rf .pk.txt > /dev/null 2>&1
# now ask the url
echo -ne "\e[34;1m [~] Enter the url: "
read link
echo -e "\e[0;1m Starting clodflare.. "
#check fi it is termux or not ..
if [[ `command -v termux-chroot` ]];then
sleep 3 && termux-chroot ./cloudflare tunnel -url $link --logfile .pk.txt > /dev/null 2>&1 & #throw all the process in background ..
else
sleep 3 && ./cloudflare tunnel -url $link --logfile .pk.txt > /dev/null 2>&1 &
fi
# now extract the link from the logfile ..
sleep 8
clear
banner
echo -ne "\e[36;1m Link: "
cat .pk.txt | grep "trycloudflare" | cut -d "|" -f2 | cut -d "}" -f2
}
#make a function to download the cloudflared
download(){
wget --no-check-certificate $1 -O cloudflare
chmod +x cloudflare
}
#first check the platform of the machine
check_platform(){
if [[ -e cloudflare ]];then
echo -e "\e[36;1m[~] Cloudflared already installed ."
else
echo -e "\e[32;1m Downloding coludflared"
host=$(uname -m)
if [[($host == "arm") || ($host == "Android")]];then
download "https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-arm"
elif [[ $host == "aarch64" ]];then
download "https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-arm64"
elif [[ $host == "x86_64" ]];then
download "https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64"
else
download "https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-386"
fi
fi
}
check_platform
start_cloud