Paskal's Tech Blog

Online rant about tech
SSH command to find and delete all files that contain a string 150 150 paskal

SSH command to find and delete all files that contain a string

SSH command to find and delete all files that contain a string:

find * -name '*.php' -exec grep -l "return base64_decode(" {} \; | xargs rm
find * -name '.htaccess' -exec grep -l "suspected" {} \; | xargs rm
find . -type f -exec grep -l "lock360*" {} \; -delete

Use any of these 3 commands as above in SSH.

NDSW infection in javascript files 150 150 paskal

NDSW infection in javascript files

Simply run command as below in SSH:

 

find . -iname *.js -exec sed -i 's/if(ndsw===undefined).\+$//' {} \;