Edit File by line
/home/barbar84/www/wp-conte.../plugins/sujqvwi/AnonR/smanonr..../etc/profile....
File: rads-autocomplete.sh
# :vim set ts=4 sw=4 expandtab syntax=sh:
[0] Fix | Delete
#
[1] Fix | Delete
# IMH RADS bash autocomplete
[2] Fix | Delete
# Rev 2 (08 Feb 2016)
[3] Fix | Delete
# J. Hipps <jacobh@inmotionhosting.com>
[4] Fix | Delete
#
[5] Fix | Delete
[6] Fix | Delete
# Check if the directory /usr/local/cpanel/bin exists.
[7] Fix | Delete
# Exit the script if it does not.
[8] Fix | Delete
[ ! -d "/usr/local/cpanel/bin" ] && return
[9] Fix | Delete
[10] Fix | Delete
###############################################################################
[11] Fix | Delete
## account-review
[12] Fix | Delete
## check_cpu
[13] Fix | Delete
## unsuspend_user
[14] Fix | Delete
## fixperms
[15] Fix | Delete
## switch
[16] Fix | Delete
## send_pp_email
[17] Fix | Delete
[18] Fix | Delete
__autocomplete_user()
[19] Fix | Delete
{
[20] Fix | Delete
local cur prev words cword
[21] Fix | Delete
words="$COMP_WORDS"
[22] Fix | Delete
cur="${COMP_WORDS[COMP_CWORD]}"
[23] Fix | Delete
prev="${COMP_WORDS[COMP_CWORD-1]}"
[24] Fix | Delete
cword=$COMP_CWORD
[25] Fix | Delete
[26] Fix | Delete
# auto-complete username
[27] Fix | Delete
COMPREPLY=( $(compgen -W "$(sudo \ls /var/cpanel/users/)" -- $cur) )
[28] Fix | Delete
[29] Fix | Delete
}
[30] Fix | Delete
[31] Fix | Delete
complete -F __autocomplete_user account-review
[32] Fix | Delete
complete -F __autocomplete_user check_cpu
[33] Fix | Delete
complete -F __autocomplete_user unsuspend_user
[34] Fix | Delete
complete -F __autocomplete_user fixperms
[35] Fix | Delete
complete -F __autocomplete_user switch
[36] Fix | Delete
complete -F __autocomplete_user send_pp_email
[37] Fix | Delete
complete -F __autocomplete_user hostsfilemods
[38] Fix | Delete
[39] Fix | Delete
[40] Fix | Delete
###############################################################################
[41] Fix | Delete
## whoowns
[42] Fix | Delete
[43] Fix | Delete
_whoowns()
[44] Fix | Delete
{
[45] Fix | Delete
[46] Fix | Delete
local cur prev words cword
[47] Fix | Delete
words="$COMP_WORDS"
[48] Fix | Delete
cur="${COMP_WORDS[COMP_CWORD]}"
[49] Fix | Delete
prev="${COMP_WORDS[COMP_CWORD-1]}"
[50] Fix | Delete
cword=$COMP_CWORD
[51] Fix | Delete
[52] Fix | Delete
# auto-complete domain names
[53] Fix | Delete
COMPREPLY=( $(compgen -W "$(sudo cat /etc/userdomains | awk -F: '{print $1}' | grep -v '^\*$')" -- $cur) )
[54] Fix | Delete
[55] Fix | Delete
}
[56] Fix | Delete
[57] Fix | Delete
complete -F _whoowns whoowns
[58] Fix | Delete
[59] Fix | Delete
[60] Fix | Delete
###############################################################################
[61] Fix | Delete
## modify-account
[62] Fix | Delete
[63] Fix | Delete
_modify_account()
[64] Fix | Delete
{
[65] Fix | Delete
local cur prev words cword
[66] Fix | Delete
words="$COMP_WORDS"
[67] Fix | Delete
cur="${COMP_WORDS[COMP_CWORD]}"
[68] Fix | Delete
prev="${COMP_WORDS[COMP_CWORD-1]}"
[69] Fix | Delete
cword=$COMP_CWORD
[70] Fix | Delete
[71] Fix | Delete
# option lists
[72] Fix | Delete
opListLong="--new-user --owner --password --domain --theme --cgi --no-cgi --shell --no-shell --ip --package --bandwidth --quota --reseller --no-reseller --acl --self --no-self --ns --custom-ns --allow --deny --force"
[73] Fix | Delete
opListShort="-u -o -w -d -t -c -s -i -p -b -q -r -a -D -b -h -v"
[74] Fix | Delete
opSysOps="--list-users --list-themes --list-ips --list-packages --list-resellers --list-acls --summary --info --debug --bleach --no-color --man --help --version"
[75] Fix | Delete
[76] Fix | Delete
# auto-complete username
[77] Fix | Delete
if [[ $cword == 1 ]]; then
[78] Fix | Delete
COMPREPLY=( $(compgen -W "$(\ls /var/cpanel/users/)" -- $cur) )
[79] Fix | Delete
return 0
[80] Fix | Delete
fi
[81] Fix | Delete
[82] Fix | Delete
# auto-complete options
[83] Fix | Delete
if [[ "$cur" == -* ]]; then
[84] Fix | Delete
COMPREPLY=( $(compgen -W "$opListLong $opListShort $opSysOps" -- $cur) )
[85] Fix | Delete
return 0
[86] Fix | Delete
fi
[87] Fix | Delete
[88] Fix | Delete
# param completion
[89] Fix | Delete
case "$prev" in
[90] Fix | Delete
-p|-a|--package|--acl)
[91] Fix | Delete
COMPREPLY=( $(compgen -W "$(\ls -p /var/cpanel/packages/ | grep -v /)" -- $cur) )
[92] Fix | Delete
return 0
[93] Fix | Delete
;;
[94] Fix | Delete
-i|--ip)
[95] Fix | Delete
COMPREPLY=( $(compgen -W "$(ip a s | grep inet | grep -v -E '(127.0.0.1|inet6| 192.168)' | awk '{print $2}' | sed 's/\/.*//')" -- $cur) )
[96] Fix | Delete
return 0
[97] Fix | Delete
;;
[98] Fix | Delete
-o|--owner)
[99] Fix | Delete
COMPREPLY=( $(compgen -W "$(cat /var/cpanel/resellers | awk -F: '{print $1}')" -- $cur) )
[100] Fix | Delete
return 0
[101] Fix | Delete
;;
[102] Fix | Delete
esac
[103] Fix | Delete
[104] Fix | Delete
}
[105] Fix | Delete
[106] Fix | Delete
complete -F _modify_account modify-account
[107] Fix | Delete
[108] Fix | Delete
[109] Fix | Delete
###############################################################################
[110] Fix | Delete
## check_user
[111] Fix | Delete
## check_crons
[112] Fix | Delete
[113] Fix | Delete
_check_user()
[114] Fix | Delete
{
[115] Fix | Delete
[116] Fix | Delete
local cur prev words cword
[117] Fix | Delete
words="$COMP_WORDS"
[118] Fix | Delete
cur="${COMP_WORDS[COMP_CWORD]}"
[119] Fix | Delete
prev="${COMP_WORDS[COMP_CWORD-1]}"
[120] Fix | Delete
cword=$COMP_CWORD
[121] Fix | Delete
[122] Fix | Delete
opListLong="--recent --full"
[123] Fix | Delete
opListShort=""
[124] Fix | Delete
[125] Fix | Delete
# auto-complete options
[126] Fix | Delete
if [[ "$cur" == -* ]]; then
[127] Fix | Delete
COMPREPLY=( $(compgen -W "$opListLong $opListShort" -- $cur) )
[128] Fix | Delete
return 0
[129] Fix | Delete
fi
[130] Fix | Delete
[131] Fix | Delete
# auto-complete username
[132] Fix | Delete
COMPREPLY=( $(compgen -W "$(sudo \ls /var/cpanel/users/)" -- $cur) )
[133] Fix | Delete
[134] Fix | Delete
}
[135] Fix | Delete
[136] Fix | Delete
complete -F _check_user check_user
[137] Fix | Delete
complete -F _check_user check_crons
[138] Fix | Delete
[139] Fix | Delete
[140] Fix | Delete
###############################################################################
[141] Fix | Delete
## nlp
[142] Fix | Delete
[143] Fix | Delete
_nlp()
[144] Fix | Delete
{
[145] Fix | Delete
[146] Fix | Delete
local cur prev words cword
[147] Fix | Delete
words="$COMP_WORDS"
[148] Fix | Delete
cur="${COMP_WORDS[COMP_CWORD]}"
[149] Fix | Delete
prev="${COMP_WORDS[COMP_CWORD-1]}"
[150] Fix | Delete
cword=$COMP_CWORD
[151] Fix | Delete
[152] Fix | Delete
opListLong="--with-ptr --no-ptr"
[153] Fix | Delete
opListShort="-n -w -p -P -h"
[154] Fix | Delete
[155] Fix | Delete
# auto-complete options
[156] Fix | Delete
if [[ "$cur" == -* ]]; then
[157] Fix | Delete
COMPREPLY=( $(compgen -W "$opListLong $opListShort" -- $cur) )
[158] Fix | Delete
return 0
[159] Fix | Delete
fi
[160] Fix | Delete
[161] Fix | Delete
# auto-complete domlogs path
[162] Fix | Delete
if [ -f /etc/cpanel/ea4/is_ea4 ]; then
[163] Fix | Delete
DOMLOGS_PATH=/var/log/apache2/domlogs
[164] Fix | Delete
else
[165] Fix | Delete
DOMLOGS_PATH=/usr/local/apache/domlogs
[166] Fix | Delete
fi
[167] Fix | Delete
if [[ "$cur" == /* ]]; then
[168] Fix | Delete
COMPREPLY=( $(compgen -W "$(find $DOMLOGS_PATH/*)" -- $cur) )
[169] Fix | Delete
return 0
[170] Fix | Delete
fi
[171] Fix | Delete
[172] Fix | Delete
# auto-complete username
[173] Fix | Delete
COMPREPLY=( $(compgen -W "$(sudo \ls /var/cpanel/users/)" -- $cur) )
[174] Fix | Delete
[175] Fix | Delete
}
[176] Fix | Delete
[177] Fix | Delete
complete -F _nlp nlp
[178] Fix | Delete
[179] Fix | Delete
[180] Fix | Delete
###############################################################################
[181] Fix | Delete
## suspend_user
[182] Fix | Delete
[183] Fix | Delete
_suspend_user()
[184] Fix | Delete
{
[185] Fix | Delete
[186] Fix | Delete
local cur prev words cword
[187] Fix | Delete
words="$COMP_WORDS"
[188] Fix | Delete
cur="${COMP_WORDS[COMP_CWORD]}"
[189] Fix | Delete
prev="${COMP_WORDS[COMP_CWORD-1]}"
[190] Fix | Delete
cword=$COMP_CWORD
[191] Fix | Delete
[192] Fix | Delete
opListLong="--sched --moved --tos --ra --cancel --billing --orphan"
[193] Fix | Delete
opListShort="-u -m"
[194] Fix | Delete
[195] Fix | Delete
# auto-complete username
[196] Fix | Delete
if [ $cword == 1 ] || [ "$prev" == "-u" ]; then
[197] Fix | Delete
COMPREPLY=( $(compgen -W "$(\ls /var/cpanel/users/)" -- $cur) )
[198] Fix | Delete
return 0
[199] Fix | Delete
fi
[200] Fix | Delete
[201] Fix | Delete
# auto-complete options
[202] Fix | Delete
if [[ "$cur" == -* ]]; then
[203] Fix | Delete
COMPREPLY=( $(compgen -W "$opListLong $opListShort" -- $cur) )
[204] Fix | Delete
return 0
[205] Fix | Delete
fi
[206] Fix | Delete
[207] Fix | Delete
}
[208] Fix | Delete
[209] Fix | Delete
complete -F _suspend_user suspend_user
[210] Fix | Delete
[211] Fix | Delete
[212] Fix | Delete
###############################################################################
[213] Fix | Delete
## check_exim
[214] Fix | Delete
[215] Fix | Delete
_check_exim()
[216] Fix | Delete
{
[217] Fix | Delete
[218] Fix | Delete
local cur prev words cword
[219] Fix | Delete
words="$COMP_WORDS"
[220] Fix | Delete
cur="${COMP_WORDS[COMP_CWORD]}"
[221] Fix | Delete
prev="${COMP_WORDS[COMP_CWORD-1]}"
[222] Fix | Delete
cword=$COMP_CWORD
[223] Fix | Delete
[224] Fix | Delete
opListLong="--dirtotals --listdirs --queuebysender --queuebybounceback --bouncesbydomain --recipientisp --recipienttest --fullmbox --fwdtotals --lines --status"
[225] Fix | Delete
opListShort="-h"
[226] Fix | Delete
[227] Fix | Delete
# auto-complete options
[228] Fix | Delete
if [[ "$cur" == -* ]]; then
[229] Fix | Delete
COMPREPLY=( $(compgen -W "$opListLong $opListShort" -- $cur) )
[230] Fix | Delete
return 0
[231] Fix | Delete
fi
[232] Fix | Delete
[233] Fix | Delete
}
[234] Fix | Delete
[235] Fix | Delete
complete -F _check_exim check_exim
[236] Fix | Delete
[237] Fix | Delete
[238] Fix | Delete
###############################################################################
[239] Fix | Delete
## check_mysql
[240] Fix | Delete
[241] Fix | Delete
_check_mysql()
[242] Fix | Delete
{
[243] Fix | Delete
[244] Fix | Delete
local cur prev words cword
[245] Fix | Delete
words="$COMP_WORDS"
[246] Fix | Delete
cur="${COMP_WORDS[COMP_CWORD]}"
[247] Fix | Delete
prev="${COMP_WORDS[COMP_CWORD-1]}"
[248] Fix | Delete
cword=$COMP_CWORD
[249] Fix | Delete
[250] Fix | Delete
opListLong="--sockets --active --kill --killqueries --killselects"
[251] Fix | Delete
opListShort="-h"
[252] Fix | Delete
[253] Fix | Delete
# auto-complete username
[254] Fix | Delete
if [[ "$prev" == "--kill" ]]; then
[255] Fix | Delete
COMPREPLY=( $(compgen -W "$(sudo \ls /var/cpanel/users/)" -- $cur) )
[256] Fix | Delete
return 0
[257] Fix | Delete
fi
[258] Fix | Delete
[259] Fix | Delete
# auto-complete options
[260] Fix | Delete
if [[ "$cur" == -* ]]; then
[261] Fix | Delete
COMPREPLY=( $(compgen -W "$opListLong $opListShort" -- $cur) )
[262] Fix | Delete
return 0
[263] Fix | Delete
fi
[264] Fix | Delete
[265] Fix | Delete
}
[266] Fix | Delete
[267] Fix | Delete
complete -F _check_mysql check_mysql
[268] Fix | Delete
[269] Fix | Delete
[270] Fix | Delete
###############################################################################
[271] Fix | Delete
## shellscan
[272] Fix | Delete
[273] Fix | Delete
_shellscan()
[274] Fix | Delete
{
[275] Fix | Delete
[276] Fix | Delete
local cur prev words cword
[277] Fix | Delete
words="$COMP_WORDS"
[278] Fix | Delete
cur="${COMP_WORDS[COMP_CWORD]}"
[279] Fix | Delete
prev="${COMP_WORDS[COMP_CWORD-1]}"
[280] Fix | Delete
cword=$COMP_CWORD
[281] Fix | Delete
[282] Fix | Delete
opListLong="--listsigs --dir --user --signame --matches --outfile --auto-quarantine --no-quarantine"
[283] Fix | Delete
opListShort="-l -d -u -s -m -o -h -y -n"
[284] Fix | Delete
[285] Fix | Delete
# auto-complete username
[286] Fix | Delete
if [ "$prev" == "-u" ] || [ "$prev" == "--user" ]; then
[287] Fix | Delete
COMPREPLY=( $(compgen -W "$(sudo \ls /var/cpanel/users/)" -- $cur) )
[288] Fix | Delete
return 0
[289] Fix | Delete
fi
[290] Fix | Delete
[291] Fix | Delete
# auto-complete options
[292] Fix | Delete
if [[ "$cur" == -* ]]; then
[293] Fix | Delete
COMPREPLY=( $(compgen -W "$opListLong $opListShort" -- $cur) )
[294] Fix | Delete
return 0
[295] Fix | Delete
fi
[296] Fix | Delete
[297] Fix | Delete
}
[298] Fix | Delete
[299] Fix | Delete
complete -F _shellscan shellscan.py
[300] Fix | Delete
[301] Fix | Delete
[302] Fix | Delete
###############################################################################
[303] Fix | Delete
## disk_cleanup.py
[304] Fix | Delete
[305] Fix | Delete
_disk_cleanup()
[306] Fix | Delete
{
[307] Fix | Delete
[308] Fix | Delete
local cur prev words cword
[309] Fix | Delete
words="$COMP_WORDS"
[310] Fix | Delete
cur="${COMP_WORDS[COMP_CWORD]}"
[311] Fix | Delete
prev="${COMP_WORDS[COMP_CWORD-1]}"
[312] Fix | Delete
cword=$COMP_CWORD
[313] Fix | Delete
[314] Fix | Delete
opModes="delete note"
[315] Fix | Delete
delOptsLong="--help --core --zip --backup --softaculous --temp"
[316] Fix | Delete
delOptsShort="-h -c -z -b -s -t -a"
[317] Fix | Delete
noteOptsLong="--help --wordpress"
[318] Fix | Delete
noteOptsShort="-h -w"
[319] Fix | Delete
[320] Fix | Delete
# auto-complete operation modes
[321] Fix | Delete
if [[ $cword == 1 ]]; then
[322] Fix | Delete
COMPREPLY=( $(compgen -W "$opModes" -- $cur) )
[323] Fix | Delete
return 0
[324] Fix | Delete
fi
[325] Fix | Delete
[326] Fix | Delete
# auto-complete options for each op mode
[327] Fix | Delete
case "$prev" in
[328] Fix | Delete
delete)
[329] Fix | Delete
COMPREPLY=( $(compgen -W "$delOptsLong $delOptsShort" -- $cur) )
[330] Fix | Delete
return 0
[331] Fix | Delete
;;
[332] Fix | Delete
note)
[333] Fix | Delete
COMPREPLY=( $(compgen -W "$noteOptsLong $noteOptsShort" -- $cur) )
[334] Fix | Delete
return 0
[335] Fix | Delete
;;
[336] Fix | Delete
esac
[337] Fix | Delete
[338] Fix | Delete
}
[339] Fix | Delete
[340] Fix | Delete
complete -F _disk_cleanup disk_cleanup.py
[341] Fix | Delete
[342] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function