CastleCops, Internet Crime Fighters
Need help? Click here to register for free! Absolutely zero advertisements on this site!

Donation/Premium
spacer
block bottom
Security Central
spacer
· Home
· PIRT/Fried Phish
· MIRT
· SIRT
· Deutsch
· Wiki
· Newsletter
· O16/ActiveX
· CLSID List
· Contest2007
· Downloads
· Feedback (send)
· Forums
· HijackThis
· Hijacktrend
· LSPs
· My Downloads
· O18
· O20
· O21
· O22
· O23
· O9
· Premium
· Private Messages
· Proxomitron
· Reviews
· Search
· StartupList
· Stories Archive
· Submit News
· WsIRT
· Your Account
· Acceptable Use Policy
block bottom
spacer spacer

Anyone help with these ads please??

 
Post new topic   Reply to topic       All -> FavForums -> Proxomitron [del.icio.us!] [digg it!] [reddit!]
View previous topic :: View next topic  
Author Message
Scoop

Sergeant
Sergeant


Joined: Jun 03, 2003
Posts: 148


PostPosted: Tue May 27, 2008 8:06 pm    Post subject: Anyone help with these ads please??
Reply with quote

http://www.skyuser.co.uk/forum/sky-news-announcements/

Im a bit of a nob when it comes to filtering but thought I would give it a go to remove the large ads in the above site. However Im pulling my hair out now! Can someone please help and tell me how its done too!




Capture.JPG
 Description:
 Filesize:  104.17 KB
 Viewed:  45 Time(s)

Capture.JPG



_________________
Kind Regards
Scoop
Back to top
View users profile Send private message
z12

Captain
Captain


Joined: Jul 17, 2002
Posts: 385
Location: USA

PostPosted: Wed May 28, 2008 12:56 am    Post subject:
Reply with quote

Here's the code that my filter blocked for that big ad:

Code:

<Match: Remove Ad Containers 3.1.7.0.3 >
<div align="center">
<script type="text/javascript"><!--
google_ad_client = "pub-5535065998260700";
/* 300x250, created 21/03/08 */
google_ad_slot = "9132077434";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
&nbsp;

<script language=JavaScript src=http://www.skyuseradserver.co.uk/bm/abm.aspx?z=6></script>
</div>
</Match>
<?nako removed=div,script: ad ?>


Based on the above match, here's a site specific filter:
Code:

[Patterns]
Name = "SkyUser Forum Google Ad Killer"
Active = TRUE
URL = "www.skyuser.co.uk/forum/"
Limit = 512
Match = "$NEST(<div,</div >)"
        "&*$NEST(<script,*google_ad_slot*,</script >)"
Replace = "<? removed google ad ?>"


HTH

Back to top
View users profile Send private message
whenever

Lieutenant
Lieutenant


Joined: May 18, 2007
Posts: 163
Location: China

PostPosted: Thu May 29, 2008 4:01 am    Post subject:
Reply with quote

I am always confused with the usage of "&". Sad

The help file introduced the usage of it for situations where tag values may come in any order but I have seen many times it was used for situations where the text has to match 2 or more conditions, just like the code z12 posted.

In the code above, the part before "&" limited the match bounds and the part after "&" added aditional condition. Is this the usual routine?

The second part has to have a leading "*" to match the beginning that the first part matched but it doesn't have to have an ending "*" to match the ending part? Shocked

Is there anywhere a detailed discussion or tutorial on the usage of "&"?

Back to top
View users profile Send private message
z12

Captain
Captain


Joined: Jul 17, 2002
Posts: 385
Location: USA

PostPosted: Thu May 29, 2008 1:15 pm    Post subject:
Reply with quote

proxo basically tests the expression that follows the "&" to see if it's true or false.
A trailing "*" is not needed for the and expression test.
Whether or not you need an "*" after the "&", depends on what you are testing for.

In the filter above, the "&" expression could have been written like this:

Code:

&<div*$NEST(<script,*google_ad_slot*,</script >)



HTH
z12

Back to top
View users profile Send private message
whenever

Lieutenant
Lieutenant


Joined: May 18, 2007
Posts: 163
Location: China

PostPosted: Sat Jun 07, 2008 12:52 pm    Post subject:
Reply with quote

@z12, thanks for the explanation. So, is my below conclusion right?


  • The position of the sub-expressions doesn't matter
  • All the sub-expressions are to be tested from the same starting postion but don't need to be ended at the same position
  • The final matched text is determined by the sub-expression which matched the longest text

Back to top
View users profile Send private message
z12

Captain
Captain


Joined: Jul 17, 2002
Posts: 385
Location: USA

PostPosted: Mon Jun 09, 2008 3:29 am    Post subject:
Reply with quote

whenever

For the most part, I find the help file description of "&"
CastleCops Link/proxomitron-Matching%20Rules.html
to be confusing. That said, here's how I see it.

I visualize the AND function like this:

Code:

(
(matching expression)
&(and expression 1)
&(and expression 2)
)


The matching expression is of primary importance.
It determines the code block "and expressions" search for a match.
The "and expressions" are secondary True/False matching expressions.
&$TST() allows you check something other than the matching expression.

Here's a filter based on the code example in the help file:
Code:

[Patterns]
Name = "img to foo 1."
Active = FALSE
Limit = 256
Match = "<img (*src="picture" & *height=60 & *width=200)*>"
Replace = "<?foo ?>"


At first glance, it looks like it should only match a specific img tag.

But open the Test window and check this:
Code:

Test code:
<img src="foo" height=6 width=2>
<img width=2 height=6 src="bar">
<img src="picture" height=60 width=200>
hello

Result:
<?foo ?>
hello


Three tags were replaced. What went wrong?
The problem is the scope of the matching expression.
It starts with a "<img" and can expand up-to 256 Bytes.
Nothing constrains the match expression to one img tag.

Proxo didn't find all the attributes within the first img tag.
So the attribute search continued beyond the first img tag.
Eventually, all the attributes were found within the scope limit.
Ultimately, the match encompassed three img tags.

For this filter, a Bounds expression can constrain the match:

Code:

[Patterns]
Name = "img to foo 1a."
Active = FALSE
Bounds = "<img\s[^>]+>"
Limit = 256
Match = "*"
        "&*src="picture""
        "&*height=60"
        "&*width=200"
Replace = "<?foo ?>"


This produces the desired result.

"&&" can also be used to limit the scope of the matching expression:

Code:

[Patterns]
Name = "img to foo 1b."
Active = FALSE
Limit = 256
Match = "("
        "<img\s[^>]+>
      "&&*"
        "&*src="picture""
        "&*height=60"
        "&*width=200"
        ")"
Replace = "<?foo ?>"


The filter above is quite flexible.
You could add tag checks before and after the img match.
Even add a Bounds match that encompassed all the tags.
The img match would still work as expected.
If need be, the other tag checks could use the same technique.

Lastly, the ad filter I posted earlier is not so good.
It should be re-written using methods of filter 1(a|b).
This would insure the match was constrained to the div.

HTH
z12

Back to top
View users profile Send private message
whenever

Lieutenant
Lieutenant


Joined: May 18, 2007
Posts: 163
Location: China

PostPosted: Mon Jun 09, 2008 8:52 am    Post subject:
Reply with quote

@z12, thank you very much for the tutorial, it helps me a lot! Very Happy

btw, I changed the position of the "matching expression" and the "and expression" in your example filters and they still produced the desired results, so, my conclusion in my last post seems right. Very Happy

Back to top
View users profile Send private message
z12

Captain
Captain


Joined: Jul 17, 2002
Posts: 385
Location: USA

PostPosted: Mon Jun 09, 2008 11:28 am    Post subject:
Reply with quote

whenever wrote:

@z12, thank you very much for the tutorial, it helps me a lot!


Your welcome. Glad it helped some.

For the heck of it, here's a revised ad filter:
Code:

[Patterns]
Name = "SkyUser Forum Google Ad Killer"
Active = TRUE
URL = "www.skyuser.co.uk/forum/"
Bounds = "$NEST(<div,</div >)"
Limit = 512
Match = "*&*$NEST(<script,*google_ad_slot*,</script >)"
Replace = "<? removed google ad ?>"


z12

Back to top
View users profile Send private message
Display posts from previous:   
Post new topic   Reply to topic       All -> FavForums -> Proxomitron All times are GMT
Page 1 of 1

 
Quick Reply:
Username: 

Quote the last message
Attach signature (signatures can be changed in profile)
 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001 phpBB Group
spacer spacer