Showing posts with label spam. Show all posts
Showing posts with label spam. Show all posts

Sunday, September 25, 2016

remove php spammer script from hosting

First enable logging

i.e. simple edit your php.ini

mail.add_x_header = On
mail.log = /var/log/phpmail.log

/root/remove_mailers.sh script (add it to cron)

#!/bin/bash
date=$(date)
logfile="${0%%.*}.log"
logfile="/var/log/${logfile##*/}"

echo $date >> $logfile
    for i in $(grep "eval()'d code" /var/log/phpmail.log | grep -oP '(?<=\[).*?(?=\()'| sort | uniq)
    do
        #echo "Spam script found: $i"
        #echo "removing..."
        echo $i >> $logfile
        rm -f $i
    done

:> /var/log/phpmail.log


ggg