-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCPM
More file actions
321 lines (314 loc) · 7.91 KB
/
CPM
File metadata and controls
321 lines (314 loc) · 7.91 KB
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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
#!/usr/bin/env bash
#CerNer Forever
#By CerNerCompany {Amir Bagheri}
GRE='\033[92m' # Green Light
RD='\033[91m' # Red Light
YLW='\033[93m' # Yellow Light
NC='\033[0m' # White
GrepDuo='/' #key dump
trap "exit 1" TERM
export TOP_PID=$$
BotH='Self-Bot-PRO'
function Update_CH {
if ! { sudo apt update && sudo apt upgrade -y echo E: update failed; } | grep -q '^[WE]:'; then
echo success
else
echo failure
exit 1
fi
echo ""
}
function MOREPAK {
rslv
sudo apt install git redis-server lua5.2 liblua5.2-dev lua-lgi libnotify-dev unzip tmux -y && add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get install libconfig++9v5 libstdc++6
sudo apt autoremove
sudo apt-get install gcc-4.9
sudo apt-get --yes install wget libconfig9 libjansson4 lua5.2 liblua5.2 make unzip git redis-server g++ whois fortune fortunes
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get install g++-4.7 -y c++-4.7 -y
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 install lua-redis
sudo apt-get install libstdc++6 -y
sudo apt-get install lua-lgi -y
sudo apt-get install libnotify-dev -y
if [ "$?" != "0" ]; then
exit 1
fi
}
function loading {
spin[0]="-"
spin[1]="\\"
spin[2]="|"
spin[3]="/"
PID=$!
echo -n "${spin[0]}"
while [ -d /proc/$PID ]
do
for i in "${spin[@]}"
do
echo -ne "\b$i"
sleep 0.7
done
done
wait $PID
if [ $? -ne 0 ]; then
echo -e "\n${RD}Failed to Update !"
kill -s TERM $TOP_PID
else
echo -e "\b${GRE}Done."
fi
}
DOVVB() {
local flag=false c count cr=$'\r' nl=$'\n'
while IFS='' read -d '' -rn 1 c; do
if $flag; then
printf '%c' "$c"
else
if [[ $c != $cr && $c != $nl ]]; then
count=0
else
((count++))
if ((count > 1)); then
flag=true
fi
fi
fi
done
}
function c() {
if [ -d "$HOME/$BotH" ];then
if [ ! -f ./tg ]; then
wget --progress=bar:force https://valtman.name/files/telegram-bot-180221-nightly-linux 2>&1 | DOVVB
mv telegram-bot-180221-nightly-linux tg; chmod +x tg
echo -e "\e[1m\e[97m==> TD successfully downloaded "
fi
if [ -d "$HOME/.telegram-bot" ];then
echo -e "\e[1m\e[32m==> \e[97m The file is correct.. Telegram-Bot\e[0m"
else
mkdir $HOME/.telegram-bot; cat <<EOF > $HOME/.telegram-bot/config
default_profile = "MCP";
MCP = {
lua_script = "$HOME/$BotH/bot/bot.cerner";
};
EOF
echo -e "\e[1m\e[32m==> \e[97m The file NotFound .. Telegram-Bot\e[0m"
fi
echo -e "\e[1m\e[32m==> \e[97m The file is correct.. $BotH\e[0m"
else
echo -e "\e[1m\e[97m==> Source not found!,"
fi
echo -e "\e[1m\e[32m"
read -p "==> Do you want to install Packages??[y/n] " -t 10 CerNerCompany
if [ "$CerNerCompany" = "Y" ];then
echo -e "\e[1m\e[97m==> Please choose the right one"
sleep 3
echo -e "\e[1m\e[32m"
read -p "==> Do you want to install Packages??[y/n] " -t 10 CerNerCompany
fi
if [ "$CerNerCompany" = "y" ]
then
echo -ne "\e[1m\e[97mUpdating Packages... "
Update_CH >> /dev/null 2>&1 & loading
sleep 2
echo -ne "\n\e[1m\e[97mInstalling Packages... "
MOREPAK >> /dev/null 2>&1 & loading
sleep 2
echo -ne "\e[1m\e[97mUpdating Packages... "
Update_CH >> /dev/null 2>&1 & loading
fi
echo -e "\n"
read -p "==> Do you want to Edit File ??[y/n] " -t 10 CerNerCompany
echo -e "\e[0m"
if [ "$CerNerCompany" = "Y" ];then
echo -e "\e[1m\e[97m==> Please choose the right one"
sleep 3
read -p "==> Do you want to Edit File ??[y/n] " -t 10 CerNerCompany
fi
if [ "$CerNerCompany" = "y" ];then
if [ -d "$HOME/$BotH" ];then
if [ -f "$HOME/$BotH/bot/utils.cerner" ]
then
echo -e "\e[1m\e[32m==> \e[97mThe file is correct.. [DWN] \e[0m"
else
echo -e "\e[1m\e[97m==> Dwn file not found!,"
printf "\33[1;31mError Exiting..!
\33[m"
exit 0
fi
if [ -f "$HOME/$BotH/bot/function.cerner" ]
then
echo -e "\e[1m\e[32m==> \e[97mThe file is correct.. [DWN] \e[0m"
else
echo -e "\e[1m\e[97m==> Dwn file not found!,"
printf "\33[1;31mError Exiting..!
\33[m"
exit 0
fi
if [ -f "$HOME/$BotH/bot/bot.cerner" ]
then
echo -e "\e[1m\e[32m==> \e[97mThe file is correct.. [bot.cerner]\e[0m"
else
echo -e "\e[1m\e[97m==> [bot.cerner] file not found!,"
printf "\33[1;31mError Exiting..!\n\33[m"
exit 0
fi
nano /$HOME/$BotH/bot/utils.cerner
echo -e "\e[1m\e[32m==> \e[97m==> Applying changes...\e[0m"
sleep 2
echo -e "\e[1m\e[34m -> \e[97m==> Saved !"
if [ -f "$HOME/$BotH/bot/bot.cerner" ]
then
echo -e "\e[1m\e[32m==> \e[97mThe file is correct.. [bot.cerner]\e[0m"
else
echo -e "\e[1m\e[97m==> [bot.cerner] file not found!,"
printf "\33[1;31mError Exiting..!\n\33[m"
exit 0
fi
if [ -f "$HOME/$BotH/libs/redis.lua" ]
then
echo -e "\e[1m\e[32m==> \e[97mThe file is correct.. [redis.lua]\e[0m"
else
echo -e "\e[1m\e[97m==> redis.lua file not found!,"
printf "\33[1;31mError Exiting..!
\33[m"
exit 0
fi
if [ -f "$HOME/$BotH/libs/serpent.lua" ]
then
echo -e "\e[1m\e[32m==> \e[97mThe file is correct.. [serpent.lua]\e[0m"
else
echo -e "\e[1m\e[97m==> serpent.lua file not found!,"
printf "\33[1;31mError Exiting..!
\33[m"
exit 0
fi
if [ -f "$HOME/$BotH/libs/JSON.lua" ]
then
echo -e "\e[1m\e[32m==> \e[97m The file is correct.. [JSON.lua]\e[0m"
else
echo -e "\e[1m\e==> [97m[JSON.lua] file not found!,"
echo -e "\e[1m\e==> [97mError Exiting..!,"
exit 0
fi
if [ -d "$HOME/$BotH/DWN" ]
then
echo -e "\e[1m\e[32m==> \e[97mThe file is correct.. [DWN] \e[0m"
else
echo -e "\e[1m\e[97m==> Dwn file not found!,"
printf "\33[1;31mError Exiting..!
\33[m"
exit 0
fi
if [ -f "$HOME/$BotH/bot/utils.cerner" ]
then
echo -e "\e[1m\e[32m==> \e[97mThe file is correct.. [Utils.cerner] \e[0m"
else
echo -e "\e[1m\e[97m==> Utils.cerner file not found!,"
printf "\33[1;31mError Exiting..!
\33[m"
exit 0
fi
if [ -f "$HOME/$BotH/bot/function.cerner" ]
then
echo -e "\e[1m\e[32m==> \e[97mThe file is correct.. [Function.cerner] \e[0m"
else
echo -e "\e[1m\e[97m==> Function.cerner file not found!,"
printf "\33[1;31mError Exiting..!
\33[m"
exit 0
fi
fi
if [ "$CerNerCompany" = "n" ];then
exit 0
fi
fi
}
botstart() {
if [ -d "$HOME/.telegram-bot" ];then
echo -e "\e[1m\e[32m==> \e[97m The file is correct.. Telegram-Bot\e[0m"
else
echo -e "\e[1m\e[32m==> \e[97m The file NotFound .. Telegram-Bot\e[0m"
printf "\33[1;31mError Exiting..!
\33[m"
exit
fi
if [ -f "$HOME/$BotH/bot/bot.cerner" ]
then
echo -e "\e[1m\e[32m==> \e[97mThe file is correct.. [bot.cerner]\e[0m"
else
echo -e "\e[1m\e[97m==> [bot.cerner] file not found!,"
printf "\33[1;31mError Exiting..!
\33[m"
exit 0
fi
if [ -f "$HOME/$BotH/libs/redis.lua" ]
then
echo -e "\e[1m\e[32m==> \e[97mThe file is correct.. [redis.lua]\e[0m"
else
echo -e "\e[1m\e[97m==> redis.lua file not found!,"
printf "\33[1;31mError Exiting..!
\33[m"
exit 0
fi
if [ -f "$HOME/$BotH/libs/serpent.lua" ]
then
echo -e "\e[1m\e[32m==> \e[97mThe file is correct.. [serpent.lua]\e[0m"
else
echo -e "\e[1m\e[97m==> serpent.lua file not found!,"
printf "\33[1;31mError Exiting..!
\33[m"
exit 0
fi
if [ -f "$HOME/$BotH/libs/JSON.lua" ]
then
echo -e "\e[1m\e[32m==> \e[97m The file is correct.. [JSON.lua]\e[0m"
else
echo -e "\e[1m\e==> [97m[JSON.lua] file not found!,"
printf "\33[1;31mError Exiting..!
\33[m"
exit 0
fi
if [ -d "$HOME/$BotH/DWN" ]
then
echo -e "\e[1m\e[32m==> \e[97mThe file is correct.. [DWN] \e[0m"
else
echo -e "\e[1m\e[97m==> Dwn file not found!,"
printf "\33[1;31mError Exiting..!
\33[m"
exit 0
fi
echo -e "\e[1m\e[32m==> \e[97mGood Lock\e[0m"
./tg | grep -v "{"
echo -e "\e[1m\e[32m==> \e[97m Good bye\e[0m"
}
function loginCLI() {
./tg -p MCP --login --phone=${1}
}
function loginAPI() {
./tg -p MCP --login --bot=${1}
}
case $1 in
l)
echo -e "\e[1m\e[36m==> \e[31m CerNer is runing.. $BotH\e[0m"
botstart
exit;;
lc)
echo -e "\e[1m\e[32m==> \e[97mPlease enter your phone number without interruption\e[0m"
read Num_MPC
loginCLI ${Num_MPC}
echo -e "\e[1m\e[32m==> \e[97mLogin completed\e[0m"
exit;;
c)
c
exit;;
la)
echo -e "\e[1m\e[32m==> \e[97mPlease enter Token without interruption\e[0m"
read BotAPI_TOKEN
loginAPI ${BotAPI_TOKEN}
echo -e "\e[1m\e[32m==> \e[97mLogin completed\e[0m"
exit;;
esac
exit 0