Tales of the Parodyverse >> View Post
Post By
Manga Shoggoth

Member Since: Fri Jan 02, 2004
Posts: 391
In Reply To
HH

Subj: May be easy enough...
Posted: Fri Dec 18, 2015 at 07:56:00 pm EST (Viewed 410 times)
Reply Subj: And so to the next problem...
Posted: Fri Dec 18, 2015 at 06:52:44 pm EST (Viewed 2 times)

Previous Post

My website has been hacked at some point, and around 220 pages have been modified with a long block of advertising links.

It must have been some time ago, since even my "clean" backup copies of the site are infected.

It's been quite a clever little spambot, randomly scambling the order it placed about 150 links on each page to make it harder for bulk deletion. The links are, for some reason, in black font on my black backgrounds, at the very bottom of pages. For example: http://www.chillwater.org.uk/HH/dull%20thud.htm

What I need to do to eliminate it without hand-editing every file is to use Notepad++ or some such program. Specifically, I need a regular expression or macro that works through batch files and finds the text:

[div style="position:absolute;filter:alpha (the square bracket is actually a left arrow)

It then needs to delete that and all text after it in the whole file, replacing it with:

[/div] [/body]

Any ideas?





Looking at the example page, it looks like the offending crap is simply the last line in the file.

So, all you need to do is replace:

[div style="position:absolute;filter:alpha -> to end of line

with:

[/div] [/body] [/HTML]


In Notepad++, search and replace can use regular expressions (You need to enable it in the dialogue), and the pattern you want is:

{div style="position:absolute;filter:alpha[[:print:]]*$

(Where the brace character at the start of the line is an angle bracket, and the square brackets are really square brackets - [[:print:]]*$ is "match any number of printable characters up to the end of the line)








As is always the case with my writing, please feel free to comment. I welcome both positive and negative criticism of my work, although I cannot promise to enjoy the negative.