#! /bin/bash
# Afrihost - Change cpanel user pass incase it's been compromised

# cpanel check
if ! [ -f "/usr/local/cpanel/cpanel" ]; then
       exit
fi

USAGE="/usr/local/afribin/configs/cpanel_userlockout lock/unlock cpuser/domain"

if ! [ "$1" ] ; then 
        echo "Need a dodge string to find in mails, like a sender address or one uniq word"
        exit 1
fi

if ! [ "$2" ] ; then
        echo "Need the domain to go find that mail on and clean"
        exit 1
fi

pSENDER="$1"
PCPDOM="$2"

PCPDOMUSER=$(grep -w "$PCPDOM" /etc/trueuserdomains | awk '{print $NF}')

grep -irl "$pSENDER" /home/"$PCPDOMUSER"/mail   | grep -v index      
