[WHM/cPanel] Fetch for recurrent path/files

An example of script to fetch for a text or file in all the cPanel accounts:

# Case of use for example: Looking for a plugin or a theme in each account with a specific path, useful in case of malwares or to estimate its impact, can be improved by looking in subfolders, subdomains and addon domains

keyword="elementor-pro"
path="public_html/wp-content/plugins"
declare -i i=0; # int

for f in /home/*; do
    if [ -d "$f/$path" ]; then
        ls "$f/$path" | grep -i "$keyword" && echo "== $f ==" && i=$i+1
    fi
done

echo "$i results found in total"

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *