generated from ChumoGH/chumogh-gmail.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathusercodes
580 lines (566 loc) · 21.5 KB
/
usercodes
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
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
#!/bin/bash
#user=$(echo ${saks:0:5})
fun_ovpn_onl () {
for userovpn in `cat /etc/passwd | grep ovpn | awk -F: '{print $1}'`; do
us=$(cat /etc/openvpn/openvpn-status.log | grep $userovpn | wc -l)
if [ "$us" != "0" ]; then
echo "$userovpn"
fi
done
}
net_meter () {
net_dir="/etc/adm-lite/userDIR/usr_cnx"
if [ ! -e "$net_dir" ]; then
echo -e "${cor[5]} ${txt[289]}"
echo -e "${cor[1]} ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆\033[0m"
return
fi
net_cent="/tmp/porcentagem"
sed -i '/^$/d' $net_dir
[[ ! -e "$net_cent" ]] && touch $net_cent
while read cent; do
echo "$cent" | awk '{print $2}' >> $net_cent
done < $net_dir
por_cent=$(paste -sd+ $net_cent | bc)
rm $net_cent
bb=$(printf '%-18s' "${txt[285]}")
aa=$(printf '%-19s' "${txt[287]}")
cc=$(printf '%-18s' "${txt[286]}")
echo -e "${cor[1]} ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆\033[0m"
echo -e "\033[1;33m $aa $bb $cc"
echo -e "${cor[1]} ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆\033[0m"
while read u; do
b=$(printf '%-18s' "$(($(echo $u | awk '{print $2}')/970)) - MB")
a=$(printf '%-20s' "$(echo $u | awk '{print $1}')")
[[ "$por_cent" = "0" || "$por_cent" = "" ]] && por_cent="1"
pip=$(echo $u | awk '{print $2}')
[[ "$pip" = "" || "$pip" = "0" ]] && pip="1"
percent_user=$(($pip*100/$por_cent)) > /dev/null 2>&1
[[ $percent_user = "0" ]] && percent_user="1"
c=$(printf '%-18s' "$percent_user %%")
if [ "$(($(echo $u | awk '{print $2}')/970))" -gt "1" ]; then
echo -e "\033[1;32m $a \033[1;31m$b \033[1;32m$c"
fi
done < $net_dir
[[ "$(cat $net_dir)" = "" ]] && echo -e "${cor[5]} ${txt[289]}"
echo -e "${cor[1]} ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆\033[0m"
unset net_dir
}
drop_kill () {
user="$1"
tmp_verifica="./tmp_tmp"
function_dropb | grep "$user" | awk '{print $2}' > $tmp_verifica
echo "$user $for_kill"
for pid in `cat $tmp_verifica`; do
kill $pid
done
rm $tmp_verifica
}
fun_time_user () {
declare -A data
tempousers="./tempo_conexao"
usr_pids_var="./userDIR"
user_x="$1"
if [ -e $usr_pids_var/$user_x.pid2 ]; then
source $usr_pids_var/$user_x.pid2
[[ ${data[$user_x]} != +([0-9]) ]] && data[$user_x]="0"
_data_now=$(date +%s)
time[$user_x]=$(($_data_now - ${data[$user_x]}))
else
time[$user_x]="0"
fi
}
function_dropb () {
port_dropbear=`ps aux | grep dropbear | awk NR==1 | awk '{print $17;}'`
[[ $port_dropbear = "" ]] && return
log=/var/log/auth.log
loginsukses='Password auth succeeded'
echo ' '
pids=`ps ax |grep dropbear |grep " $port_dropbear" |awk -F" " '{print $1}'`
for pid in $pids
do
pidlogs=`grep $pid $log |grep "$loginsukses" |awk -F" " '{print $3}'`
i=0
for pidend in $pidlogs
do
let i=i+1
done
if [ $pidend ]; then
login=`grep $pid $log |grep "$pidend" |grep "$loginsukses"`
PID=$pid
user=`echo $login |awk -F" " '{print $10}' | sed -r "s/'/ /g"`
waktu=`echo $login |awk -F" " '{print $2"-"$1,$3}'`
while [ ${#waktu} -lt 13 ]; do
waktu=$waktu" "
done
while [ ${#user} -lt 16 ]; do
user=$user" "
done
while [ ${#PID} -lt 8 ]; do
PID=$PID" "
done
echo "$user $PID $waktu"
fi
done
echo ""
return
}
function_1 () {
echo -e "${cor[1]} ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ${cor[0]}"
echo -e "${cor[4]} ${txt[38]}"
echo -e "${cor[1]} ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ${cor[0]}"
for u in `awk -F : '$3 > 900 { print $1 }' /etc/passwd |grep -v "nobody" |grep -vi polkitd |grep -vi system-`; do
echo -e "${cor[5]} $u"
done
echo -e "${cor[1]} ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ${cor[0]}"
echo -e "${cor[4]} ${txt[27]}"
echo -e "${cor[1]} ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ${cor[0]}"
echo -e "${cor[5]} ${txt[28]}"; read -p " ⌐╦╦═─ : " name
if [ -z $name ]; then
echo -e "${cor[5]} ${txt[29]} ${cor[0]}"
return
fi
if cat /etc/passwd |grep $name: |grep -vi [a-z]$name |grep -v [0-9]$name > /dev/null
then
echo -e "${cor[5]} ${txt[30]} ${cor[0]}"
return
fi
echo -e "${cor[1]} ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ${cor[0]}"
echo -e "${cor[5]} ${txt[31]} $name"
read -p " ${txt[35]} " pass
echo -e "${cor[1]} ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ${cor[0]}"
echo -e "${cor[5]} ${txt[32]} $name"
read -p " ${txt[37]} " daysrnf
echo -e "${cor[1]} ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ${cor[0]}"
echo -e "${cor[5]} ${txt[33]} $name"
read -p " ${txt[36]} " limit
echo -e "${cor[1]} ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ${cor[0]}"
meu_ip
if [ "$OPENVPN" = "on" ]; then
open_1 $name $pass $daysrnf $limit s
echo -e "${cor[5]} IP => ${cor[4]}$IP"
echo -e "${cor[5]} ${txt[34]} ${cor[4]}$name"
echo -e "${cor[5]} ${txt[35]} ${cor[4]}$pass"
echo -e "${cor[5]} ${txt[36]} ${cor[4]}$limit"
echo -e "${cor[5]} ${txt[37]} ${cor[4]}$datexp"
echo -e "${cor[1]} ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆ ${cor[0]}"
rm ./$CLIENT.ovpn > /dev/null 2>&1
return
fi
valid=$(date '+%C%y-%m-%d' -d " +$daysrnf days")
datexp=$(date "+%d/%m/%Y" -d " +$daysrnf days")
useradd -M -s /bin/false $name -e $valid
(echo $pass; echo $pass)|passwd $name 2>/dev/null
echo -e "${cor[5]} IP => ${cor[4]}$IP"
echo -e "${cor[5]} ${txt[34]} ${cor[4]}$name"
echo -e "${cor[5]} ${txt[35]} ${cor[4]}$pass"
echo -e "${cor[5]} ${txt[36]} ${cor[4]}$limit"
echo -e "${cor[5]} ${txt[37]} ${cor[4]}$datexp"
echo -e "${cor[1]} ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆ ${cor[0]}"
echo "senha: $pass" > $dir_user/$name
echo "limite: $limit" >> $dir_user/$name
echo "data: $valid" >> $dir_user/$name
echo -ne "${cor[2]}"
return
}
function_2 () {
echo -e "${cor[1]} ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ${cor[0]}"
echo -e "${cor[4]} ${txt[39]}"
echo -e "${cor[1]} ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ${cor[0]}"
echo -e "${cor[2]} |1| >${cor[3]} ${txt[40]}"
echo -e "${cor[2]} |2| >${cor[3]} ${txt[41]}"
echo -e "${cor[1]} ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ${cor[0]}"
echo -ne "${cor[6]}"
read -p "${txt[9]} " opc_del
if [ "$opc_del" = "1" ]; then
echo -e "${cor[1]} ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ${cor[0]}"
echo -e "${cor[4]} ${txt[38]}"
echo -e "${cor[1]} ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ${cor[0]}"
select_users
name="$select_name"
if [ "$name" = "" ]; then
return
fi
if [ "$OPENVPN" = "on" ]; then
open_2 $name
echo -e "${cor[1]} ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ${cor[0]}"
return
fi
userdel --force $name > /dev/null 2>/dev/null
kill -9 `ps aux |grep -vi '[a-z]$name' |grep -vi '$name[a-z]' |grep -v '[1-9]$name' |grep -v '$name[1-9]' |grep $name |awk {'print $2'}` 2> /dev/null
pid_kill=$(function_dropb | grep "$name" | awk '{print $2}')
if [ "$pid_kill" != "" ]; then
drop_kill $name
fi
if [ -e $dir_user/$name ]; then
rm $dir_user/$name
fi
echo -e "${cor[1]} ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ${cor[0]}"
echo -e " $name ${cor[2]} ${txt[45]} "
echo -e "${cor[1]} ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ${cor[0]}"
return
fi
if [ "$opc_del" = "2" ]; then
for name in `awk -F : '$3 > 900 { print $1 }' /etc/passwd |grep -v "nobody" |grep -vi polkitd |grep -vi system-`; do
echo -e "${cor[1]} ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ${cor[0]}"
echo -e "${cor[5]} ${txt[46]} $name ?"
read -p " [S/N]: " _remover_
if [[ "$_remover_" = "s" || "$_remover_" = "S" ]]; then
if [ "$OPENVPN" = "on" ]; then
open_2 $name
else
userdel --force $name > /dev/null 2>&1
kill -9 `ps aux |grep -vi '[a-z]$name' |grep -vi '$name[a-z]' |grep -v '[1-9]$name' |grep -v '$name[1-9]' |grep $name |awk {'print $2'}` > /dev/null 2>&1
pid_kill=$(function_dropb | grep "$name" | awk '{print $2}')
if [ "$pid_kill" != "" ]; then
drop_kill $name
fi
if [ -e $dir_user/$name ]; then
rm $dir_user/$name
fi
echo -e "\033[1;37m $name ${cor[5]} ${txt[46]}"
sleep 0.3s
fi
fi
done
echo -e "${cor[1]} ○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○ ${cor[0]}"
else
return
fi
}
function_3 () {
echo -e "${cor[1]} ➶➶➶➶➶➶➶➶➶➶➶➶➶➶➶➶➶➶➶➶➶➶➶➶➶➶ ${cor[0]}"
echo -e "${cor[4]} ${txt[48]}"
echo -e "${cor[1]} ➷➷➷➷➷➷➷➷➷➷➷➷➷➷➷➷➷➷➷➷➷➷➷➷➷➷ ${cor[0]}"
select_users
if [ "$select_name" = "" ]; then
return
fi
namer="$select_name"
echo -e "${cor[5]} ${txt[50]} $namer"
echo -e "${cor[2]} |1| >${cor[3]} ${txt[51]} $namer"
echo -e "${cor[2]} |2| >${cor[3]} ${txt[52]} $namer"
echo -e "${cor[2]} |3| >${cor[3]} ${txt[53]} $namer"
echo -e "${cor[1]} ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ${cor[0]}"
read -p " ${txt[9]} " _opt
if [ "$_opt" = "1" ]; then
read -p "${txt[54]} " new_limit
if [ "$new_limit" = "" ]; then
echo -e "${cor[5]} ${txt[55]}"
return
fi
usr_var=$(cat $dir_user/$namer | grep -v "limite:")
echo "$usr_var" > $dir_user/$namer
echo "limite: $new_limit" >> $dir_user/$namer
echo -e "${cor[5]} ${txt[56]}"
unset new_limit
unset usr_var
return
fi
if [ "$_opt" = "2" ]; then
echo -e "${cor[5]} ${txt[57]}"
read -p ": " date
if [ "$date" = "" ]; then
echo -e "${cor[5]} ${txt[58]}"
return
fi
datexp=$(date "+%d/%m/%Y" -d " + $date days")
valid=$(date '+%C%y-%m-%d' -d " + $date days")
chage -E $valid $namer 2> /dev/null
echo -e "${cor[5]} ${txt[59]}"
usr_var=$(cat $dir_user/$namer | grep -v "data")
echo -e "$usr_var" > $dir_user/$namer
echo -e "data: $valid" >> $dir_user/$namer
echo -e "$namer: $datexp"
unset datexp
unset valid
unset usr_var
return
fi
if [ "$_opt" = "3" ]; then
echo -e "${cor[5]} ${txt[60]} $namer"
read -p " : " nova_senha
if [ "$nova_senha" = "" ]; then
echo -e "${cor[5]} ${txt[61]}"
return
fi
(echo "$nova_senha" ; echo "$nova_senha" ) |passwd $namer > /dev/null 2>/dev/null
usr_var1=$(cat $dir_user/$namer | grep -v "senha")
echo -e "$usr_var1" > $dir_user/$namer
echo -e "senha: $nova_senha" >> $dir_user/$namer
echo -e "${cor[5]} ${txt[62]}"
unset nova_senha
unset usr_var1
return
else
echo -e "${cor[5]} ${txt[63]}"
fi
}
function_4 () {
echo -e "${cor[1]} ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ${cor[0]}"
echo -e "${cor[4]} > ${txt[64]} ${txt[65]} ${txt[66]} ${txt[85]} ${txt[67]}"
echo -e "${cor[1]} ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ${cor[0]}"
_cont="0"
if [ ! -e $tempousers ]; then
touch $tempousers
fi
for namer in `awk -F : '$3 > 900 { print $1 }' /etc/passwd |grep -v "nobody" |grep -vi polkitd |grep -vi system-`; do
if [ "$namer" = "" ]; then
break
fi
if [ -e $dir_user/$namer ]; then
_sen=$(cat $dir_user/$namer | grep "senha" | awk '{print $2}')
_limit=$(cat $dir_user/$namer | grep "limite" | awk '{print $2}')
else
_limit="${txt[68]}"
_sen="${txt[68]}"
fi
if [ -z "$_limit" ]; then
_limit="${txt[68]}"
fi
if [ -z "$_sen" ]; then
_sen="${txt[68]}"
fi
data_sec=$(date +%s)
data_user=$(chage -l "$namer" |grep -i co |awk -F ":" '{print $2}')
if [ "$data_user" = " never" ]; then
dias_user="\033[1;37m${txt[69]}"
else
data_user_sec=$(date +%s --date="$data_user")
if [ "$data_sec" -gt "$data_user_sec" ]; then
dias_user="\033[1;31m${txt[70]}"
else
variavel_soma=$(($data_user_sec - $data_sec))
dias_use=$(($variavel_soma / 86400))
dias_user="\033[1;32m$dias_use ${txt[73]}"
fi
fi
unset SEC
unset MIN
unset HOR
SEC=$(cat $tempousers | grep "$namer" | awk '{print $2}')
number_var $SEC
if [ "$var_number" = "" ]; then
SEC="0"
else
SEC="$var_number"
fi
hour_var=$(echo "${txt[83]}" | cut -b 1)
min_var=$(echo "${txt[84]}" | cut -b 1)
MIN=$(($SEC / 60))
SEC=$(($SEC - $MIN * 60))
HOR=$(($MIN / 60))
MIN=$(($MIN - $HOR * 60))
txto[1]=$(printf '%-10s' "$namer")
txto[2]=$(printf '%-12s' "$_sen")
txto[3]=$(printf '%-10s' "$_limit")
txto[4]=$(printf '%-10s' "${HOR}h:${MIN}m:${SEC}s")
txto[5]=$(printf '%-2s' "$dias_user")
unset open_vpn
echo "$(cat /etc/passwd | grep -v ovpn | awk -F : '$3 > 900 { print $1 }' |grep -v "nobody" | grep -vi polkitd |grep -vi system-)" > $_tmp
open_vpn=$(cat $_tmp | grep "$namer")
rm $_tmp
if [ "$open_vpn" != "" ]; then
#user ssh
echo -e " ${cor[2]} > ${cor[5]} ${txto[1]} ${txto[2]} ${txto[3]} ${txto[4]} ${txto[5]}"
else
#user openvpn
echo -e " ${cor[2]} > ${cor[7]} ${txto[1]} ${txto[2]} ${txto[3]} ${txto[4]} ${txto[5]}"
fi
_cont=$(($_cont + 1))
done
echo -e "${cor[1]} ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆ ${cor[0]}"
echo -e " ∆ ${txt[71]} $_cont ${txt[72]}"
echo -e "${cor[1]} ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆ ${cor[0]}"
unset txt_
}
function_5 () {
echo -e "${cor[1]} =================================== ${cor[0]}"
msga[1]=$(printf '%-12s' "${txt[74]}")
msga[2]=$(printf '%-9s' "${txt[75]}")
msga[3]=$(printf '%-6s' "${txt[76]} HH:MM")
echo -e "${cor[4]} ${msga[1]} ${msga[2]} ${msga[3]} ${cor[0]}"
unset msga
echo -e "${cor[1]} =================================== ${cor[0]}"
[[ ! -e $tempousers ]] && touch $tempousers
_data_now=$(date +%s)
for user in `awk -F : '$3 > 900 { print $1 }' /etc/passwd |grep -v "nobody" |grep -vi polkitd |grep -vi system-`; do
unset ssh
ssh+="$(ps -u $user|grep sshd|wc -l)+"
ssh+="$(function_dropb|grep "$user"|wc -l)+"
[[ "$OPENVPN" = "on" ]] && ssh+="$(fun_ovpn_onl|grep "$user"|wc -l)+"
ssh+="0"
user_pid=$(echo $ssh|bc)
declare -A time
fun_time_user "$user"
SEC="${time[$user]}"
[[ "$SEC" = "" ]] && SEC="0"
[[ "$SEC" != +([0-9]) ]] && SEC="0"
hour_var=$(echo "${txt[83]}" | cut -b 1)
min_var=$(echo "${txt[84]}" | cut -b 1)
MIN=$(($SEC/60))
SEC=$(($SEC-$MIN*60))
HOR=$(($MIN/60))
MIN=$(($MIN-$HOR*60))
msg[1]=$(printf '%-12s' "${user}")
msg[2]=$(printf '%-7s' "${user_pid}")
msg[3]=$(printf '%-1s' "${HOR}h:${MIN}m:${SEC}s")
if [ "$user_pid" -gt "0" ]; then
echo -e "\033[1;32m ${msg[1]} ${msg[2]} ${msg[3]} ${cor[0]}"
algumon="on"
else
[[ -e $usr_pids_var/$user.pid2 ]] && rm $usr_pids_var/$user.pid2
fi
done
[[ "$algumon" = "" ]] && echo -e "\033[1;31m ${txt[86]}" && unset algumon
echo -e "${cor[1]} ➶➶➶➶➶➶➶➶➶➶➶➶➶➶➶➶➶➶ ${cor[0]}"
}
function_6 () {
unset _removidos
echo -e "${cor[1]} ➷➷➷➷➷➷➷➷➷➷➷➷➷➷➷➷➷➷ ${cor[0]}"
datenow=$(date +%s)
for user in $(awk -F: '{print $1}' /etc/passwd); do
expdate=$(chage -l $user|awk -F: '/Account expires/{print $2}')
echo $expdate|grep -q never && continue
datanormal=$(date -d"$expdate" '+%d/%m/%Y')
expsec=$(date +%s --date="$expdate")
diff=$(echo $datenow - $expsec|bc -l)
echo $diff|grep -q ^\- && continue
userdel --force $user > /dev/null 2>/dev/null
kill -9 `ps aux |grep -vi '[a-z]$user' |grep -vi '$user[a-z]' |grep -v '[1-9]$user' |grep -v '$user[1-9]' |grep $user |awk {'print $2'}` 2> /dev/null
pid_kill=$(function_dropb | grep "$user" | awk '{print $2}')
[[ "$pid_kill" != "" ]] && drop_kill $user
[[ "$OPENVPN" = "on" ]] && open_2 $name
[[ -e $dir_user/$user ]] && rm $dir_user/$user
_removidos="on"
echo -e "\033[1;37m $user ${cor[2]} ${txt[45]} "
done
if [ "$_removidos" = "" ]; then
echo -e "${cor[5]} ${txt[88]}"
unset _removidos
fi
echo -e "${cor[1]} ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆ ${cor[0]}"
}
txt_font () {
echo -ne "\033[1;37m"
read -p " ${txt[226]}: " ban_ner2
echo -e " \033[1;31m[ 1 ]\033[1;33m - ${txt[227]}"
echo -e " \033[1;31m[ 2 ]\033[1;33m - ${txt[228]}"
echo -e " \033[1;31m[ 3 ]\033[1;33m - ${txt[229]}"
echo -e " \033[1;31m[ 4 ]\033[1;33m - ${txt[230]}"
echo -e " \033[1;31m[ 5 ]\033[1;33m - ${txt[231]}"
read -p " Digite A Cor [ 1 - 5 ]: " ban_ner2_cor
if [ "$ban_ner2_cor" = "1" ]; then
echo '<h6><font color="green">' >> $local
elif [ "$ban_ner2_cor" = "2" ]; then
echo '<h6><font color="red">' >> $local
elif [ "$ban_ner2_cor" = "3" ]; then
echo '<h6><font color="blue">' >> $local
elif [ "$ban_ner2_cor" = "4" ]; then
echo '<h6><font color="yellow">' >> $local
elif [ "$ban_ner2_cor" = "5" ]; then
echo '<h6><font color="purple">' >> $local
else
echo '<h6><font color="red">' >> $local
fi
echo "$ban_ner2" >> $local
echo "</h6></font>" >> $local
}
function_7 () {
echo -e "${cor[3]} "Esta SEGURO:""
read -p " [S/N]: " -e -i n sshsn
[[ "$sshsn" = @(s|S|y|Y) ]] && {
local2="/etc/dropbear/banner"
chk=$(cat /etc/ssh/sshd_config | grep Banner)
if [ "$(echo "$chk" | grep -v "#Banner" | grep Banner)" != "" ]; then
local=$(echo "$chk" |grep -v "#Banner" | grep Banner | awk '{print $2}')
else
echo "Banner /etc/bannerssh" >> /etc/ssh/sshd_config
local="/etc/bannerssh"
fi
echo -e "${cor[1]} ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ${cor[0]}"
echo -ne "\033[1;37m"
read -p " ${txt[232]}: " ban_ner
echo -e " \033[1;31m[ 1 ]\033[1;33m - ${txt[227]}"
echo -e " \033[1;31m[ 2 ]\033[1;33m - ${txt[228]}"
echo -e " \033[1;31m[ 3 ]\033[1;33m - ${txt[229]}"
echo -e " \033[1;31m[ 4 ]\033[1;33m - ${txt[230]}"
echo -e " \033[1;31m[ 5 ]\033[1;33m - ${txt[231]}"
read -p " [ 1 - 5 ]: " ban_ner_cor
echo '<h1><font>●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●</font></h1>' > $local
if [[ "$ban_ner_cor" = "1" ]]; then
echo '<h1><font color="green">' >> $local
elif [[ "$ban_ner_cor" = "2" ]]; then
echo '<h1><font color="red">' >> $local
elif [[ "$ban_ner_cor" = "3" ]]; then
echo '<h1><font color="blue">' >> $local
elif [[ "$ban_ner_cor" = "4" ]]; then
echo '<h1><font color="yellow">' >> $local
elif [[ "$ban_ner_cor" = "5" ]]; then
echo '<h1><font color="purple">' >> $local
else
echo '<h1><font color="blue">' >> $local
fi
echo "$ban_ner" >> $local
echo '</font></h1>' >> $local
echo '<h1><font>●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●</font></h1>' >> $local
while true; do
echo -e " ${txt[233]}"
read -p " [ s | n ]: " sin_nao
if [[ "$sin_nao" = @(s|S|y|Y) ]]; then
txt_font
elif [[ "$sin_nao" = @(n|N) ]]; then
break
fi
done
echo '</h8><font color="purple">@ChumoGH-ADM</font></h8>' >> $local
echo '<h1><font>●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●</font></h1>' >> $local
if [ -e "$local2" ]; then
rm $local2 > /dev/null 2>&1
cp $local $local2 > /dev/null 2>&1
fi
echo -e "${cor[1]} ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ${cor[0]}"
service ssh restart > /dev/null 2>&1 &
service sshd restart > /dev/null 2>&1 &
service dropbear restart > /dev/null 2>&1 &
}
return 0
}
limiter_fun () {
[[ "$VERIFICAR" = "on" ]] && {
echo -e "${cor[1]} ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ${cor[0]}"
echo -e "${cor[5]} VERIFICANDO LIMITADOR ${cor[0]}"
echo -e "${cor[1]} ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ${cor[0]}"
return
}
if [[ $limiter_on = "" ]]; then
unset limiter_on
chmod +x /etc/adm-lite/limiter.sh &
/etc/adm-lite/limiter.sh &
screen -dmS Limiter-ssh /etc/adm-lite/limiter.sh
echo -e "${cor[1]} ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ${cor[0]}"
echo -e "${cor[5]} LIMITADOR INICIADO ${cor[0]}"
echo -e "${cor[1]} ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ${cor[0]}"
else
unset limiter_on
killall limiter.sh > /dev/null 2>&1
kill -9 $(ps x|grep -v grep|grep limiter.sh|awk '{print $1}')
echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e "${cor[5]} LIMITADOR DETENIDO ${cor[0]}"
echo -e "${cor[1]} =================================== ${cor[0]}"
fi
}
[[ "$1" = "1" ]] && function_1
[[ "$1" = "2" ]] && function_2
[[ "$1" = "3" ]] && function_3
[[ "$1" = "4" ]] && function_4
[[ "$1" = "5" ]] && function_5
[[ "$1" = "6" ]] && function_6
[[ "$1" = "7" ]] && function_7
[[ "$1" = "8" ]] && net_meter
[[ "$1" = "9" ]] && limiter_fun
####_Eliminar_Tmps_####
[[ -e $_tmp ]] && rm $_tmp
[[ -e $_tmp2 ]] && rm $_tmp2
[[ -e $_tmp3 ]] && rm $_tmp3
[[ -e $_tmp4 ]] && rm $_tmp4