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

Grypen's filter set suddenly broke flash videos
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic       All -> FavForums -> Grypen - Proxomitron [del.icio.us!] [digg it!] [reddit!]
View previous topic :: View next topic  
Author Message
ProxFox

Proxomitron Host
Proxomitron Host


Joined: Nov 11, 2003
Posts: 940
Location: USA

PostPosted: Fri Feb 15, 2008 6:35 pm    Post subject:
Reply with quote

my comment would be, "cool, i find it annoying to have a 'quick bypass' and a 'save as' button"...

my preference indeed is to have one to toggle on, another to toggle off...


i wouldn't mind having your current version, when you feel it's ready for posting Very Happy

Back to top
View users profile Send private message
z12

Captain
Captain


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

PostPosted: Fri Feb 15, 2008 9:20 pm    Post subject:
Reply with quote

ProxFox, your in luck. Smile

Take this filter out for a test drive.

Code:

[Patterns]
Name = "Toggle:  Object {4.d.3} 20080215 [z12]"
Active = TRUE
URL = "($TYPE(htm)|$TYPE(js)|$TYPE(vbs))(^$TST(keyword=*.flash.*))"
Limit = 4096
Match = "("
        "("
        "$NEST(<object(\s|"),"+</object >)|"
        "<object(^[a-z])(*/ object >&&(^*<object)*)|"
        "<embed(^[a-z])*>(^ [a-z0-9])( </embed >)+"
        ")\0(^ </object >)(^ </textarea>)"
        "&&"
        "(^*(type=$AV(image/*)))"
        "*)"
        "$SET(flash=$GET(flash)$DTM(t))"
        "(($TST(script=*))$SET(1=\\")$SET(2=\\)|$SET(1=")$SET(2=))"
Replace = "<span class=\1flash$GET(flash)\1 style=\1display:none\1>"
          "<textarea style=\1display:none\1>\0<\2/textarea>"
          "<br>"
          "<\2/span>"
          "<span class=\1flash$GET(flash)\1 style=\1display:inline\1>"
          "<a title=\1Play Media\1 onclick=\1PrxObjToggle(this);return false;\1 onmouseover=\1PrxTitleObj(this)\1>"
          "<img src=\1http://local.ptron/Grypen_HTML/imgs/player_play.png\1 border=0><\2/a>"
          "<\2/span>"


For the image toggle to work right, the js wants the images to be named

"player_play"
"player_stop"

which is what Grypen's Filter set calls them. Given that, as long as the
images are somewhere in local.ptron, the js doesn't care.

Here's the js:

Code:

// ====================================
// toggle object - z12
// modified for Grypen's fiter set
// ====================================


function PrxObjToggle(n) {
   
    var player_Node = n.parentNode.previousSibling;
   
    if (player_Node && player_Node.firstChild.nodeName == "TEXTAREA"){
        var fnHTML = player_Node.firstChild.value;       // this is the html inside the textarea node
        player_Node.removeChild(player_Node.firstChild); // delete the textarea node
        fnHTML += player_Node.innerHTML;                 // get the remaining proxo html
        player_Node.innerHTML = fnHTML;                  // replace the hidden span's inner html
    }
   
    var a_toggle = n;
    var img = a_toggle.firstChild.src.split(/\/player_[^.]+/i);
   
    if (player_Node.style.display != "inline"){
        player_Node.style.display = 'inline';
        a_toggle.title = "Stop Media";
        a_toggle.firstChild.src = img[0] + '/player_stop' + img[1];
    }
    else {
        player_Node.style.display = 'none';
        a_toggle.title = "Play Media";
        a_toggle.firstChild.src = img[0] + '/player_play' + img[1];
    }
   
    return false;

}

function PrxTitleObj(n) {
   
    n.onmouseover = null;
   
    var button_Node = n.parentNode;
    var player_Node = button_Node.previousSibling;
   
    var mt = '';
    var fn = 'file name not found';
    var ot = player_Node.firstChild.value; // the html inside the textarea node
   
    // look for the file name in the object or embed tag
    mt = ot.match(/<(?:object|embed)(?:[^>]+)(?:\s+(?:src|data|code)\s*=\s*["']*([^\s"'>]+)["']*)/i);
    if (mt && mt[1]) {
        fn = mt[1];
    } else {
        // look for the file name in the parameter tag. hmm... might only need to match "movie" for flash.
        mt = ot.match(/<param(?:\s?(?:\s+value\s*=\s*["']*([^\s"'>]+)["']*)|(?:\s+name\s*=\s*["']*(?:movie|src|FileName|code|url)["']*)){2}\s*\/?>/i);
        if (mt && mt[1]) {
            fn = mt[1];
        }
    }
   
    var a_toggle = button_Node.childNodes[0];
    a_toggle.onmouseover = null;
    a_toggle.href = fn;
   
}




If you want the toggle button always on top:

1. reverse the spans in the replacment text.
The <br> should always close the first span.

2. In the js, change the player_node variable
in both functions to this:
Code:

    var player_Node = button_Node.nextSibling;



z12

Back to top
View users profile Send private message
ProxFox

Proxomitron Host
Proxomitron Host


Joined: Nov 11, 2003
Posts: 940
Location: USA

PostPosted: Fri Feb 15, 2008 10:19 pm    Post subject:
Reply with quote

works like a charm, many thanks...

i'll report back if i stumble upon anything it misses or whatnot...

Back to top
View users profile Send private message
z12

Captain
Captain


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

PostPosted: Sat Feb 16, 2008 1:20 am    Post subject:
Reply with quote

Alright, thanks

z12

Back to top
View users profile Send private message
Grypen

Major
Major


Joined: Aug 23, 2004
Posts: 913
Location: Japan

PostPosted: Mon Feb 18, 2008 12:13 pm    Post subject:
Reply with quote

I'll keep an eye on how it goes for you ProxFox and if you have no issues I'll take it for a test drive when I have some time.

Cheers all!

Paul


_________________
Get my current Proxomitron filters and Firefox CSS files here or here.
Back to top
View users profile Send private message Visit posters website
GuyScharf

Cadet
Cadet


Joined: Nov 14, 2007
Posts: 4
Location: USA

PostPosted: Wed Mar 05, 2008 4:11 am    Post subject:
Reply with quote

I have the same problems and would like to try the suggested code. However, I have not modified Proxomitron's files before and am uncertain exactly where to place this code. Does the piece beginning with [Patterns] go at the beginning of that same-named section in default.cfg, or does it replace something, or does it go somewhere else? Where are the functions to be placed?

Thanks.

Guy

Back to top
View users profile Send private message
z12

Captain
Captain


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

PostPosted: Thu Mar 06, 2008 11:17 am    Post subject:
Reply with quote

GuyScharf wrote:

Where are the functions to be placed?


Copy the JavaScript code.

With widows Explorer, browse to where Proxomitron is installed.
Open the "html" folder, then open the "Grypen_HTML" folder.
Select the "PrxFunctions.js" file, right click then "Edit".
Scroll down to here:
Code:

// ====================================
// Toggle Function | Required for various filters - Sidki3003, JD5000
// ====================================


Paste the js on a blank line above this.
Save the file then close it.

Note: You may have to force the browser to reload the modified script file.
Shift+Reload (or refresh) should do it. Worst case, clear the browser cache.


GuyScharf wrote:

Does the piece beginning with [Patterns] go at the beginning of that same-named section in default.cfg, or does it replace something, or does it go somewhere else?


Copy the web filter "pattern" code.
Open Proxomitron, click the "Web page" filters button.
Scroll down to this:
Code:

========== APPLETS & OBJECTS ==========

Select the first filter in this section.
Right click, then "Import filters from clipboard".

If all went well, the new filter will appear (in red).

Uncheck the other "Toggle:" filters in this section.
Click the "Apply" button.

Go surfing.

If your satisfied that all is working well, save the config.

HTH
z12

Back to top
View users profile Send private message
z12

Captain
Captain


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

PostPosted: Thu Mar 06, 2008 12:43 pm    Post subject:
Reply with quote

While checking out a flash mentioned here:
CastleCops Link/p1062626-Blocking_ads_in_flash_video.html#1062626

I noticed the file name wasn't found.

To fix this, change the this js:

Code:

    // look for the file name in the object or embed tag
    mt = ot.match(/<(?:object|embed)(?:[^>]+)(?:\s+(?:src|data|code)\s*=\s*["']*([^\s"'>]+)["']*)/i);


to this:
Code:

    // look for the file name in the object or embed tag
    mt = ot.match(/<(?:object|embed)(?:[^>]*)(?:\s+(?:src|data|code)\s*=\s*["']*([^\s"'>]+)["']*)/i);


in a nut shell:
Code:

(?:[^>]+) changes to (?:[^>]*)


a change of one character.

z12

Back to top
View users profile Send private message
ProxFox

Proxomitron Host
Proxomitron Host


Joined: Nov 11, 2003
Posts: 940
Location: USA

PostPosted: Thu Mar 06, 2008 1:40 pm    Post subject:
Reply with quote

good catch... thanks for the update...

Back to top
View users profile Send private message
z12

Captain
Captain


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

PostPosted: Thu Mar 06, 2008 2:56 pm    Post subject:
Reply with quote

I've made a couple of minor tweaks to the replacement code for XHTML compatibility.

The br and img tags were changed:

Code:

[Patterns]
Name = "Toggle:  Object {4.d.3.1} 20080306 [z12]"
Active = TRUE
URL = "($TYPE(htm)|$TYPE(js)|$TYPE(vbs))(^$TST(keyword=*.flash.*))"
Limit = 4096
Match = "("
        "("
        "$NEST(<object(\s|"),"+</object >)|"
        "<object(^[a-z])(*/ object >&&(^*<object)*)|"
        "<embed(^[a-z])*>(^ [a-z0-9])( </embed >)+"
        ")\0(^ </object >)(^ </textarea>)"
        "&&"
        "(^*(type=$AV(image/*)))"
        "*)"
        "$SET(flash=$GET(flash)$DTM(t))"
        "(($TST(script=*))$SET(1=\\")$SET(2=\\)|$SET(1=")$SET(2=))"
Replace = "<span class=\1flash$GET(flash)\1 style=\1display:none\1>"
          "<textarea style=\1display:none\1>\0<\2/textarea>"
          "<br />"
          "<\2/span>"
          "<span class=\1flash$GET(flash)\1 style=\1display:inline\1>"
          "<a title=\1Play Media\1 onclick=\1PrxObjToggle(this);return false;\1 onmouseover=\1PrxTitleObj(this)\1>"
          "<img alt=\1Toggle Media\1 src=\1http://local.ptron/Grypen_HTML/imgs/player_play.png\1 style=\1border-style:none\1 /><\2/a>"
          "<\2/span>"

If you don't filter XHTML, no big deal.

As a side note, a few days ago I came across a site that had an issue. After toggling the player on, the "Stop Player" button wasn't visible.

I didn't have time to really look into it, but with the dom inspector, I was able to verify the image was there and display it.

When the "Stop Player" image was visible, the flash became partially obscured.

I made a mental note of the site (mistake), but now I can't remember what site it was.

Anyway, it's something to watch for.

z12

Back to top
View users profile Send private message
ProxFox

Proxomitron Host
Proxomitron Host


Joined: Nov 11, 2003
Posts: 940
Location: USA

PostPosted: Thu Mar 06, 2008 3:54 pm    Post subject:
Reply with quote

er, i'm not sure if i'm filtering XHTML or not, but will certainly keep an eye open for any stop-player anomalies...

Back to top
View users profile Send private message
z12

Captain
Captain


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

PostPosted: Thu Mar 06, 2008 5:33 pm    Post subject:
Reply with quote

ProxFox wrote:

er, i'm not sure if i'm filtering XHTML or not,


If you go here with Firefox, http://www.w3.org/ they serve up:
Code:

Content-Type: application/xhtml+xml; charset=utf-8;

Which by default, proxo won't filter.

I use a header filter to force filtering, $FILTER(true).

Another approach, and probably saner, is to use a header filter to change the Content-Type to "text/html".

Xhtml is not very common. I don't think IE does XHTML.

At any rate, the code changes work fine with html also.

z12

Back to top
View users profile Send private message
Scoop

Sergeant
Sergeant


Joined: Jun 03, 2003
Posts: 148


PostPosted: Sun Mar 09, 2008 10:20 pm    Post subject:
Reply with quote

Great work guys however I have tried installing these filters a couple of time now with some success. They install correctly but I find it slows down browsing for some reason. Also having to click the view button every time you want to view a clip can be rather annoying, would be great if it was like the old days where you went to site and the video or clip would load up without the prompt. If there is a bypass any chance of including it in the filter?? For instance when on you tube you view a clip then click for next clip you have to push blue button and again for next clip. Hope this makes sense guys.


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

Cadet
Cadet


Joined: Nov 14, 2007
Posts: 4
Location: USA

PostPosted: Mon Mar 10, 2008 12:06 am    Post subject:
Reply with quote

I installed the changes and it seems to fix most of the problems. However, videos on CNN are completely broken, much like they were before the Dec release. If I open a page that contains a video, I get a message that there was a timeout loading the video, and there is no blue button. If I go to the page containing all videos (top right link on home page), then nothing loads.

Since I use Firefox, I am now testing AdBlock Plus as an alternative to Proxo. As expected, it's a bit of a tradeoff but I'm probably doing better with ABP rather than Proxo.

Guy

Back to top
View users profile Send private message
z12

Captain
Captain


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

PostPosted: Mon Mar 10, 2008 11:17 am    Post subject:
Reply with quote

GuyScharf wrote:

If I open a page that contains a video, I get a message that there was a timeout loading the video, and there is no blue button.


I see the button, it's on the bottom left of the page.
However, the timeout is still an issue.

Scoop wrote:

Also having to click the view button every time you want to view a clip can be rather annoying, would be great if it was like the old days where you went to site and the video or clip would load up without the prompt. If there is a bypass any chance of including it in the filter?? For instance when on you tube you view a clip then click for next clip you have to push blue button and again for next clip.


Since both sites mentioned are flash sites, perhaps the best solution is to exclude the filter from matching.

Currently, you can do so by using:
Code:

keyword=*.flash.*


for youtube, exclude s.ytimg.com
for cnn, exclude i.cdn.turner.com

The only other way I can think of to "fix" these sites would be to default to "toggled on".
This way, the source file, whatever it is, would always be downloaded and executed.
Thats probably doable, but not with this filter.

In the end, I guess it's just another trade-off.

The cnn page also has a problem with one of the Stop buttons becoming hidden.
Putting the toggle button on top fixed this.

z12

Back to top
View users profile Send private message
Display posts from previous:   
Post new topic   Reply to topic       All -> FavForums -> Grypen - Proxomitron All times are GMT
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
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