forked from tgMember/tgAds
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TG
292 lines (268 loc) · 8.47 KB
/
TG
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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
#!/usr/bin/env bash
THIS_DIR=$(cd $(dirname $0); pwd)
cd $THIS_DIR
logo() {
declare -A logo
seconds="0.004"
logo[0]=" . '|| ||' '||'''| '|| ||' '||'|. '||'''| '||''|."
logo[1]=".||. ... . ||| ||| || . ||| ||| || || || . || ||"
logo[2]=" || || || |'|..'|| ||'| |'|..'|| ||''|. ||'| ||''|'"
logo[3]=" || |'' | '|' || || | '|' || || || || || |."
logo[4]=" '|.' '|||. .|. | .||. .||....| .|. | .||. .||..|' .||....| .||. '|'"
logo[5]=" .|...'"
logo[6]="➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖"
logo[7]="Channel : @tgMember"
logo[8]="Develop by @sajjad_021"
printf "\e[38;5;213m\t"
for i in ${!logo[@]}; do
for x in `seq 0 ${#logo[$i]}`; do
printf "${logo[$i]:$x:1}"
sleep $seconds
done
printf "\n\t"
done
printf "\n"
}
log() {
echo -e "\033[38;5;105m . /|\,/ |\, ,- _~, /\|,/ \|, - _,, ,- _~, -_ /\,\033[0;00m"
echo -e "\033[38;5;142m|| _ /| || || (' /| / /| || || -/ ) (' /| / || ,,\033[0;00m"
echo -e "\033[38;5;099m=||= / \\ || || || (( ||/= || || || ~||_< (( || = /|| /|.\033[0;00m"
echo -e "\033[38;5;034m|| || || ||=|= || (( || ||=|= || || |\ (( ||| \||/-\,\033[0;00m"
echo -e "\033[38;5;406m|| || || ~|| || || ( / | ~|| || || ,/--|| ( | || \.,\033[0;00m"
echo -e "\033[38;5;129m|| \|_-| |, |\,|\, -____- |, |\,|\, _--_-' -____- _---_-|.\033[0;00m"
echo -e "\033[38;5;129m|| -_-_\033[0;00m"
echo -e "\033[38;5;129m,_-_-\.\033[0;00m"
}
install_luarocks() {
echo -e "\e[38;5;142mInstalling LuaRocks\e"
git clone https://github.com/keplerproject/luarocks.git
cd luarocks
git checkout tags/v2.4.2 # Current stable
PREFIX="$THIS_DIR/.luarocks"
./configure --prefix=$PREFIX --sysconfdir=$PREFIX/luarocks --force-config
make build && make install
cd ..
rm -rf luarocks
}
install_rocks() {
./.luarocks/bin/luarocks install redis-lua
sudo service redis-server restart
sudo service redis-server start
}
tg() {
echo -e "\e[38;5;099minstall telegram-cli\e"
wget https://valtman.name/files/telegram-cli-1121
mv telegram-cli-1121 telegram-cli
chmod +x telegram-cli
chmod +x TG
}
py() {
sudo apt-get install python-setuptools python-dev build-essential -y
sudo easy_install pip
sudo pip install redis
}
install2() {
echo -e "\e[38;5;034mInstalling more dependencies\e"
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get --force-yes install git wget screen tmux libconfig9 libevent-dev libjansson4 libstdc++6 lua-socket lua5.2 liblua5.2 make unzip redis-server software-properties-common g++
sudo apt-get install g++-4.7 -y c++-4.7 -y
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install libreadline-dev -y libconfig-dev -y libssl-dev -y lua5.2 -y liblua5.2-dev -y lua-socket -y lua-sec -y lua-expat -y libevent-dev -y make unzip git redis-server autoconf g++ -y libjansson-dev -y libpython-dev -y expat libexpat1-dev -y
sudo apt-get install screen -y
sudo apt-get install tmux -y
sudo apt-get install libstdc++6 -y
sudo apt-get install lua-lgi -y
sudo apt-get install libnotify-dev -y
sudo update-alternatives —install /usr/bin/gcc gcc /usr/bin/gcc-4.9 60 —slave /usr/bin/g++ g++ /usr/bin/g++-4.9
}
install() {
echo -e "\e[38;5;035mUpdating packages\e"
sudo apt-get update -y
sudo apt-get upgrade -y
echo -e "\\e[38;5;129mInstalling dependencies\e"
sudo apt install tor -y
sudo apt install -y obfs4proxy
sudo systemctl daemon-reload
sudo systemctl restart tor.service
sudo apt install obfsproxy -y
sudo apt install polipo -y
sudo systemctl restart tor.service
sudo apt install -y polipo
sudo apt install torsocks
sudo apt install dnscrypt-proxy -y
sudo systemctl daemon-reload
sudo systemctl restart tor.service
sudo cat /var/log/tor/log
sudo add-apt-repository ppa:dani.behzi/traktor
sudo apt update -y
sudo apt install -y traktor
install2
install_luarocks
install_rocks
py
tg
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y dist-upgrade
sudo apt-get -y autoremove
sudo apt autoclean
sudo service redis-server restart
sudo service redis-server start
log
echo -e "\e[38;5;046mInstalling packages successfully\033[0;00m"
menu
}
inf() {
memTotal_b=`free -b |grep Mem |awk '{print $2}'`
memFree_b=`free -b |grep Mem |awk '{print $4}'`
memBuffer_b=`free -b |grep Mem |awk '{print $6}'`
memCache_b=`free -b |grep Mem |awk '{print $7}'`
memTotal_m=`free -m |grep Mem |awk '{print $2}'`
memFree_m=`free -m |grep Mem |awk '{print $4}'`
memBuffer_m=`free -m |grep Mem |awk '{print $6}'`
memCache_m=`free -m |grep Mem |awk '{print $7}'`
CPUPer=`top -b -n1 | grep "Cpu(s)" | awk '{print $2 + $4}'`
uptime=`uptime`
ProcessCnt=`ps -A | wc -l`
memUsed_b=$(($memTotal_b-$memFree_b-$memBuffer_b-$memCache_b))
memUsed_m=$(($memTotal_m-$memFree_m-$memBuffer_m-$memCache_m))
memUsedPrc=$((($memUsed_b*100)/$memTotal_b))
echo -e "➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖\033[38;5;208mServer Information\033[0;00m➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖"
echo ">Total Ram : $memTotal_m MB Ram in use : $memUsed_m MB - $memUsedPrc% used!"
echo '>Cpu in use : '"$CPUPer"'%'
echo '>Server Uptime : '"$uptime"
}
cln() {
sudo service redis-server start
echo ">> Enter the ADS-ID,that you wanna delete :"
read -rp ' ' ID
rm -rf ~/.telegram-cli/TG-"$ID"/data
rm -rf TG-"$ID".lua
redis-cli --raw keys "TG"$ID* | xargs redis-cli del
echo ">> Bot number '$ID' seccessfuly deleted."
}
cr() {
name=TG
if [[ -e $name.lua ]] ; then
i=1
while [[ -e $name-$i.lua ]] ; do
let i++
done
name=$name-$i
fi
cat main.lua >> "$name".lua
sed -i 's/ADS-ID/'$i'/g' "$name".lua
echo -e "New bot Created, you can run your bot with\033[38;5;208m./TG "$i"\033[0;0mcommand"
read -p "Do you want launch your robot? [y/n] = "
if [ "$REPLY" == "y" ] || [ "$REPLY" == "Y" ]; then
./TG "$i"
elif [ "$REPLY" == "n" ] || [ "$REPLY" == "N" ]; then
exit 1
fi
}
anticrash() {
while true ; do
for tgAds in TG-*.lua ; do
entr="${tgAds%.*}"
entry="${entr/TG-/}"
tmux kill-session -t entr-"$entry"
tmux new-session -d -s entr-"$entry" "./TG $entry"
tmux detach -s entr-"$entry"
done
echo -e "\n\e[1;32mRun All tgAds Bot\n\e[0;00m"
sleep 1200
done
}
menu() {
echo -e "➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖\033[38;5;208mMENU\033[0;00m➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖"
echo -e "1 => \033[38;5;208mInstall\033[0;00m"
echo -e "2 => \033[38;5;208mNew bot\033[0;00m"
echo -e "3 => \033[38;5;208manticrash - Trun On All Robot's\033[0;00m"
echo -e "4 => \033[38;5;208mTrun Off All Robot's\033[0;00m"
echo -e "5 => \033[38;5;208mReturn last session\033[0;00m"
echo -e "6 => \033[38;5;208mServer info\033[0;00m"
echo -e "7 => \033[38;5;208mRemove bot\033[0;00m"
echo -e "0 => \033[38;5;208mExit\033[0;00m"
echo -e "\033[38;5;208m ➖ ➖ ➖➖➖➖➖➖ ➖ ➖ ➖ \033[0;00m"
echo '>Channel : '"@tgMember"
echo '>Develop by '"@sajjad_021"
# Options in ./config.sh <option>
read VAR
if [ "$VAR" = 1 ]; then
clear
logo
install
menu
elif [ "$VAR" = 2 ]; then
cr
exit
elif [ "$VAR" = 3 ]; then
log
anticrash
menu
elif [ "$VAR" = 4 ]; then
killall telegram-cli
tmux kill-session -t $THIS_DIR
log
echo -e '\e[34mSessions closed\e[0m'
menu
elif [ "$VAR" = 5 ]; then
tmux attach-session -t $THIS_DIR
elif [ "$VAR" = 6 ]; then
log
inf
menu
elif [ "$VAR" = 7 ]; then
cln
menu
elif [ "$VAR" = 0 ]; then
clear
log
exit
elif [ "$VAR" = "" ]; then
clear
echo -e '\e[31mOpcion invalida\e[0m'
else
clear
echo -e '\e[31mOpcion invalida\e[0m'
fi
}
if [ "$1" ]; then
id="${1/a/}"
if [ -a "$THIS_DIR"/TG-"$id".lua ]; then
./telegram-cli -p TG-"$id" -s TG-"$id".lua
fi
if [[ "$1" =~ ^[0-9]+$ ]] ; then
./telegram-cli -p TG-"$1" -s TG-"$1".lua
else
menu
fi
fi
if [ "$1" = "info" ]; then
clear
log
inf
fi
if [ "$1" = "tmux" ]; then
log
anticrash
fi
if [ "$1" = "cr" ]; then
log
cr
fi
if [ "$1" = "help" ]; then
menu
fi
if [ ! -f telegram-cli ]; then
echo -e "\033[38;5;208mError! telegram-cli not found, Please reply to this message:\033[1;208m"
read -p "Do you want to install and config? [y/n] = "
if [ "$REPLY" == "y" ] || [ "$REPLY" == "Y" ]; then
install
menu
elif [ "$REPLY" == "n" ] || [ "$REPLY" == "N" ]; then
exit 1
fi
fi
menu