/
opt
/
dedrads
/
/opt/dedrads
mkdir
upload
Name
Size
Mode
Actions
account_review/
-
0555
rm
check_software_mods/
-
0555
rm
cms_tools/
-
0555
rm
etc/
-
0555
rm
extras/
-
0555
rm
mailparse/
-
0555
rm
mysql/
-
0555
rm
nlp_scripts/
-
0555
rm
oldrads/
-
0555
rm
perl/
-
0555
rm
provision/
-
0555
rm
python/
-
0555
rm
suspended/
-
0555
rm
__pycache__/
-
0555
rm
account-review
799
0555
edit
dl
rm
allfw
6259
0555
edit
dl
rm
alp.py
16553
0555
edit
dl
rm
autossl_sync
6267
0555
edit
dl
rm
check_apache
9205
0555
edit
dl
rm
check_bandwidth
4546
0555
edit
dl
rm
check_boxtrapper
1684
0555
edit
dl
rm
check_cpu
12212
0555
edit
dl
rm
check_crons
1827
0555
edit
dl
rm
check_dcpumon
1973
0555
edit
dl
rm
check_dns
1827
0555
edit
dl
rm
check_domlogs
61
0555
edit
dl
rm
check_exim
3731
0555
edit
dl
rm
check_hacks
22604
0555
edit
dl
rm
check_imap
5249
0555
edit
dl
rm
check_io
6635
0555
edit
dl
rm
check_max_children
16341
0555
edit
dl
rm
check_mem
1660
0555
edit
dl
rm
check_misc
1510
0555
edit
dl
rm
check_pacct
5201
0555
edit
dl
rm
check_php
4344
0555
edit
dl
rm
check_pop3
2295
0555
edit
dl
rm
check_prov.py
4714
0555
edit
dl
rm
check_server
696
0555
edit
dl
rm
check_size
490
0555
edit
dl
rm
check_software
9849
0555
edit
dl
rm
check_spamd
2426
0555
edit
dl
rm
check_traffic
1933
0555
edit
dl
rm
check_user
1887
0555
edit
dl
rm
clean_exim.py
6390
0555
edit
dl
rm
clusterfix
5343
0555
edit
dl
rm
cmspass.py
3970
0555
edit
dl
rm
cms_check.py
9825
0555
edit
dl
rm
cms_counter.py
36734
0555
edit
dl
rm
cms_creds
713
0555
edit
dl
rm
cms_dumpdb
4485
0555
edit
dl
rm
cms_pw
1416
0555
edit
dl
rm
cpanel-api
7040
0555
edit
dl
rm
cpanel_postgres_manager.py
29004
0555
edit
dl
rm
cpmerge
4631
0555
edit
dl
rm
cpumon
2195
0555
edit
dl
rm
dcpumon.pl
1239
0555
edit
dl
rm
dedcheck
18127
0555
edit
dl
rm
dns-sync
14386
0555
edit
dl
rm
docroot.py
4425
0555
edit
dl
rm
du-tree
7450
0555
edit
dl
rm
envinfo.py
6633
0555
edit
dl
rm
exclude_rbl.py
5249
0555
edit
dl
rm
extract-vhost
2691
0555
edit
dl
rm
filescan
3566
0555
edit
dl
rm
find_warez
1460
0555
edit
dl
rm
first_setup.py
19120
0555
edit
dl
rm
fixwpcron.py
4822
0555
edit
dl
rm
fix_dns_cluster
353
0555
edit
dl
rm
goaccess
1217720
0555
edit
dl
rm
hostsfilemods
4467
0555
edit
dl
rm
imap_io
2323
0555
edit
dl
rm
innodb_converter.py
9343
0555
edit
dl
rm
killall911
530
0555
edit
dl
rm
killdns
941
0555
edit
dl
rm
lastcommcache.sh
1374
0555
edit
dl
rm
legal_lock_down.sh
7450
0555
edit
dl
rm
lil-cpanel
52002
0555
edit
dl
rm
listacct
4575
0555
edit
dl
rm
mailscan
4544
0555
edit
dl
rm
mail_sources.py
7407
0555
edit
dl
rm
megaclisas-status
38664
0555
edit
dl
rm
migrate2central.sh
14418
0555
edit
dl
rm
modify-account
40631
0555
edit
dl
rm
modsec_disable.py
11461
0555
edit
dl
rm
monarxctl
8912
0555
edit
dl
rm
msp.pl
27714
0555
edit
dl
rm
mysql_dstat
474
0555
edit
dl
rm
mysql_selector.py
73102
0555
edit
dl
rm
nlp
4582
0555
edit
dl
rm
procscrape
1863
0555
edit
dl
rm
quarantine
11083
0555
edit
dl
rm
radsfunctions.sh
863
0555
edit
dl
rm
recent-cp
16148
0555
edit
dl
rm
remote_dump
18347
0555
edit
dl
rm
reset_cpanel
3205
0555
edit
dl
rm
server-load
2192
0555
edit
dl
rm
show-conns
20105
0555
edit
dl
rm
show-conns-adv.py
54667
0555
edit
dl
rm
sparta.py
382498
0555
edit
dl
rm
sqltop
27129
0555
edit
dl
rm
telcheck
2411
0555
edit
dl
rm
temprootreset
186
0555
edit
dl
rm
unsuspend_user
1307
0555
edit
dl
rm
unsusprunner.sh
1840
0555
edit
dl
rm
updatednsadmin
526
0555
edit
dl
rm
update_spf
14972
0555
edit
dl
rm
upgrade-check
9216
0555
edit
dl
rm
vhost_data.py
6221
0555
edit
dl
rm
wp-xray.sh
85816
0555
edit
dl
rm
Edit:
/opt/dedrads/mailscan
(4544B)
#!/bin/bash ###################################################################################################### # Script: mailscan # Author: Jason N # Version: 1.0.2 # Contact: jasonn@inmotionhosting.com # Purpose: Scans all account mail inboxes, sent boxes, and recent login usage and reports account size, message counts, and logins per protocol ###################################################################################################### # Version 1.0.2 - minor bugfix / removal of extra code # variables userpath=/var/cpanel/users username=$1 maildomains= logcount=300000 inbox_limit=0 #functions function usagetxt { if [[ $errortxt != "" && "$helptxt" != "1" ]] ; then echo -e "\nERROR: $errortxt"; fi echo -e "\nUsage: mailscan <username> <options>"; if [[ "$helptxt" -eq "1" ]] ; then echo -e "\n\tAvailable options:"; echo -e "\t\t-s / --summary\t\t: Only output account, size, and inbox count fields"; # echo -e "\t\t-c / --current\t\t: Get mail account list from current process list - in development"; # echo -e "\t\t-ac / --all-current\t: Get all current mail connections to the system - in development"; echo -e "\t\t-lc= / --log-count=\t: Change the default line history mailscan will use when reviewing /var/log/maillog (default is $logcount)"; echo -e "\t\t-il= / --inbox-limit=\t: Change the default inbox message count that will be displayed (default is $inbox_limit)\n"; else echo -e "\n\tHelp available with option -h or --help"; fi exit; } #parse command options for i in "$@" ; do case $i in -s | --summary) summary="1" ;; -ac | --all-current) all_current="1" ;; -c | --current) current_conns="1" ;; -lc* | --log-count*) logcount=`echo $i | awk -F'=' '{gsub(/ /,"",$2); print $2}'` ;; -il* | --inbox-limit*) inbox_limit=`echo $i | awk -F'=' '{gsub(/ /,"",$2); print $2}'` ;; -h | --help) errortxt="Help page."; helptxt="1" ; usagetxt ;; esac done # get list of local home directories from system homedirs=`ls / | sed -e 's/\///g' | egrep "^home$|^home[0-9]$"` if [[ "$#" -eq "0" ]] ; then errortxt="No user provided"; usagetxt exit fi #parse_options if [[ "$all_current" -eq "1" ]] ; then echo "Under Development"; exit elif [[ -e $userpath/$username ]] then echo "User $username found, scanning" else errortxt="User $username does not exist on this system"; usagetxt exit fi # find users home directory and verify it exists for tmphomedir in $homedirs ; do if [[ -e /$tmphomedir/$username ]] ; then homedir=$tmphomedir fi done # get the list of mail domains on the account from etc in their home directory maildomains=`ls /$homedir/$username/etc| egrep -v "\.\/|\.\.\/|\.boxtrapper|ftpquota|rcube.db|passwd\,v|quota\,v|shadow\,v|\.imapv4"` #loop through list of mail domains and get email account details for currentdomain in $maildomains ; do scandomain=/$homedir/$username/mail/$currentdomain ; # path to domain to scan if [[ -e "$scandomain" ]] ; then cd $scandomain ; workingdomain=`pwd|awk -F'/' '{print $5}'`; # loop through the list of users in the domains mail directory for i in $(ls| egrep -v "\.\/|\.\.\/"| awk -F'/' '{print $1}') ; do address="$i@$workingdomain"; # email address if [[ ! -e $i/cur ]] ; then continue; fi dsize=`du -sh $i/cur | awk '{print $1}'` ; # size of mail inbox inboxcount=`ls $i/cur | wc -l`; # number of messages in inbox if [[ -e $i/.Sent/cur ]] ; then sentcount=`ls $i/.Sent/cur | wc -l`; # number of sent messages else sentcount=0; fi # get number of recent imap logins imapcount=`tail -n$logcount /var/log/maillog | grep $address | egrep "imapd:|imapd-ssl:" | grep LOGIN | wc -l`; # get number of recent pop logins popcount=`tail -n$logcount /var/log/maillog | grep $address | egrep "pop3d:|pop3d-ssl:" | grep LOGIN | wc -l`; # output the results if [[ "$summary" -eq "1" ]] ; then echo $address","$dsize","$inboxcount","$inbox_limit | awk -F',' '$3 >= $4 {printf "%40s\t Inbox Size: %6s\tInbox Count: %6s\n",$1, $2, $3}'; else echo $address","$dsize","$inboxcount","$sentcount","$imapcount","$popcount","$inbox_limit | awk -F',' '$3 >= $7 {printf "%40s\t Inbox Size: %6s\tInbox: %6s\tSent:%6s\tIMAP: %4s\tPOP: %4s\n",$1, $2, $3, $4, $5, $6}'; fi done; fi done;
Save
cmd:
run