Ray E. wrote:
> A gaming site that runs phpnuke got hacked. They were not up to patch
> on some of the modules.
>
> The hack inserted one line of code that opens an iframe linking to a
> pay-per-view ad service. The hacker gets $.05 for every page view.
>
> Anyway, the line was added to the bottom of every index.html and
> index.php file in every directory on the server. There are over 1800
> directories affected.
>
> Does anybody know where I can get a script that will browse every
> directory and remove every line of offending code? They do have ssh
> access to the server.
Something like this Perl one-liner
perl -pi.bak -e "s/<htm.*neof.*tml>//g;" someinputfile
....for one file. I leave it to you to write a little
bash script to iterate this over the files. Or seek
info on Perl regular expressions if the one here
doesn't do exactly what you want.
Or, you could write a perl script using the File::Find module
to iterate over the files in the tree. A perfect way to learn
a tiny bit of Perl and regular expressions.
>> Stay informed about: Need to remove line of code from 1800+ files