#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2011
    Posts
    108
    Rep Power
    51

    Site hacked - Tool to batch replace text


    Hi guys,

    Recently all of my sites on a specific host had been hacked (some weird obfuscated injection in some files). I'm guessing a server problem, since every domain was affected.

    Anyway, the text is the same in every file, so I was thinking, is there a program that can open all website files in batch, look for the injections and remove them? The text has a start and end tag, so should be easy to find.

    There's a lot of files and websites involved, and the backups are insufficient. Doing it by hand would be a big task and is of course subject to human mistake, haha.
    Post to Facebook using a Nokia 3310
  2. #2
  3. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,316
    Rep Power
    7170
    Pretty much all IDEs have a "find and replace in files" feature, so do most text editors that are programming oriented.

    If you're on a linux server it is probably possible to do it via the command line too.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2011
    Posts
    108
    Rep Power
    51
    Thanks, didnt even think of that. I'm using Notepad++ and it allows use of regular expressions.

    What would be the correct regex to get the text between the following tags?

    Code:
    <? #bf760a#
    
    #/bf760a# ?>
    Post to Facebook using a Nokia 3310

IMN logo majestic logo threadwatch logo seochat tools logo