[ubuntu-uk] Automating find and replace
Colin Law
clanlaw at gmail.com
Wed Sep 17 06:15:48 UTC 2014
On 16 September 2014 21:08, Gareth France <gareth.france at gmail.com> wrote:
> Not ubuntu related but I'm hoping someone may have the answer I need. Today
> I discovered my webspace has been hacked and several sites now contain
> additional code at the start of every single PHP file. Looking at my backups
> I can see it has been there for a while so restoring from a very old backup
> could cause me issues.
>
> Is there some way I could do a recursive find and delete on that code? It is
> a very long single line including slashes, hashes, exclaimation marks etc so
> using sed would be difficult as the examples I have seen show /thing to
> change/thing to change to/.
Not helpful for solving the immediate problem I know, but for the
future the issue would be easy to solve if you kept a master copy of
your source in a version control system such as git. Then if the site
becomes compromised you can just replace it with the correct code.
Git is trivially easy to setup and start using.
Colin
More information about the ubuntu-uk
mailing list