MozillaZine

Suggestion (maybe an enhancement for Digger?)

Talk about add-ons and extension development.
shoestring

User avatar
 
Posts: 156
Joined: November 5th, 2002, 3:40 pm
Location: Geekhaven, MA, USA

Post Posted February 20th, 2003, 11:41 pm

I'd like to see an extension that will take a URL that contains hex-encoded punctuation - see example:

http%3A%2F%2Fcommon%2Eziffdavisinternet%2Ecom%2Fdownload%2F0%2F1221%2Fdisplset%2Ezip

and replace the codes with the actual characters, i.e. %3A -> : %2F -> / %2E -> . and so forth. Clearly, this should include all hex codes, not just punctuation ...

This should be a simple matter for someone who is familiar with programming extensions, no?

A further development could be to de-obfuscate any obfuscated URL (though I suppose so many techniques can be used that it would be hard to cover them all).
Bill Phillips
Sexagenarian Boy Genius
Geekhaven, Massachusetts

alanjstr
Moderator

User avatar
 
Posts: 9100
Joined: November 5th, 2002, 4:43 pm
Location: Anywhere but here

Post Posted February 21st, 2003, 6:21 am

an escaped URL is not escaped for obfuscation, usually. It can be converted via unescape(). The problem is that some items such as backslashes need to be escape()'d.
Former UMO Admin, Former MozillaZine General Mod
I am rarely on mozillaZine, so please do not send me a private message.
My Old Firefox config files

shoestring

User avatar
 
Posts: 156
Joined: November 5th, 2002, 3:40 pm
Location: Geekhaven, MA, USA

Post Posted February 21st, 2003, 9:09 pm

alanjstr wrote:an escaped URL is not escaped for obfuscation, usually. It can be converted via unescape(). The problem is that some items such as backslashes need to be escape()'d.


Evidently "decodeURI()" is preferred over "unescape()". If I weren't having a miserable headache I'd try to dope out how to write this extension myself, but I figure there are those who could just do it off the cuff ...

BTW, I know that obfuscation is not the primary use of encoding URI/URLs ... but it certainly can be and is used that way.
Bill Phillips
Sexagenarian Boy Genius
Geekhaven, Massachusetts

alanjstr
Moderator

User avatar
 
Posts: 9100
Joined: November 5th, 2002, 4:43 pm
Location: Anywhere but here

Post Posted February 21st, 2003, 9:44 pm

unescape() is the javascript call itself, not an API.
Former UMO Admin, Former MozillaZine General Mod
I am rarely on mozillaZine, so please do not send me a private message.
My Old Firefox config files

clav
 
Posts: 1974
Joined: November 5th, 2002, 3:25 am
Location: Lancaster, UK

Post Posted February 22nd, 2003, 5:24 am

shoestring wrote:I'd like to see an extension that will take a URL that contains hex-encoded punctuation - see example:

http%3A%2F%2Fcommon%2Eziffdavisinternet%2Ecom%2Fdownload%2F0%2F1221%2Fdisplset%2Ezip

and replace the codes with the actual characters, i.e. %3A -> : %2F -> / %2E -> . and so forth. Clearly, this should include all hex codes, not just punctuation ...

so do you want the extension to read the url from the address bar, run decodeURI() on it, then write the result back and go to that address?

shoestring wrote:This should be a simple matter for someone who is familiar with programming extensions, no?

i expect that would be fairly trivial for me to add to Digger.

shoestring wrote:A further development could be to de-obfuscate any obfuscated URL (though I suppose so many techniques can be used that it would be hard to cover them all).

if you can give me a list of some standard ways of obfuscating urls i'll think about whether i could put this in digger.


alanjstr: if you look at the javascript 1.5 reference escape() and unescape() are deprecated in favour of encodeURI() and decodeURI()

alanjstr
Moderator

User avatar
 
Posts: 9100
Joined: November 5th, 2002, 4:43 pm
Location: Anywhere but here

Post Posted February 22nd, 2003, 9:39 am

clav wrote:alanjstr: if you look at the javascript 1.5 reference escape() and unescape() are deprecated in favour of encodeURI() and decodeURI()

I didn't even realize javascript had progressed past 1.2. Well, now I have a new JS reference. Of course you still have to be careful about IE support.
Former UMO Admin, Former MozillaZine General Mod
I am rarely on mozillaZine, so please do not send me a private message.
My Old Firefox config files

shoestring

User avatar
 
Posts: 156
Joined: November 5th, 2002, 3:40 pm
Location: Geekhaven, MA, USA

Post Posted February 22nd, 2003, 7:36 pm

clav wrote:
shoestring wrote:I'd like to see an extension that will take a URL that contains hex-encoded punctuation - see example:

http%3A%2F%2Fcommon%2Eziffdavisinternet%2Ecom%2Fdownload%2F0%2F1221%2Fdisplset%2Ezip

and replace the codes with the actual characters, i.e. %3A -> : %2F -> / %2E -> . and so forth. Clearly, this should include all hex codes, not just punctuation ...

so do you want the extension to read the url from the address bar, run decodeURI() on it, then write the result back and go to that address?

shoestring wrote:This should be a simple matter for someone who is familiar with programming extensions, no?

i expect that would be fairly trivial for me to add to Digger.

shoestring wrote:A further development could be to de-obfuscate any obfuscated URL (though I suppose so many techniques can be used that it would be hard to cover them all).

if you can give me a list of some standard ways of obfuscating urls i'll think about whether i could put this in digger.


Yes, read the URL from the address bar, decode it and write it back ... probably leaving the go to the address step manual, however.

I'll look into the general obfuscation question as soon as I get a chance.
Bill Phillips
Sexagenarian Boy Genius
Geekhaven, Massachusetts

shoestring

User avatar
 
Posts: 156
Joined: November 5th, 2002, 3:40 pm
Location: Geekhaven, MA, USA

Post Posted February 25th, 2003, 6:30 pm

shoestring wrote:
clav wrote:
shoestring wrote:I'd like to see an extension that will take a URL that contains hex-encoded punctuation - see example:

http%3A%2F%2Fcommon%2Eziffdavisinternet%2Ecom%2Fdownload%2F0%2F1221%2Fdisplset%2Ezip

and replace the codes with the actual characters, i.e. %3A -> : %2F -> / %2E -> . and so forth. Clearly, this should include all hex codes, not just punctuation ...

so do you want the extension to read the url from the address bar, run decodeURI() on it, then write the result back and go to that address?

shoestring wrote:This should be a simple matter for someone who is familiar with programming extensions, no?

i expect that would be fairly trivial for me to add to Digger.

shoestring wrote:A further development could be to de-obfuscate any obfuscated URL (though I suppose so many techniques can be used that it would be hard to cover them all).

if you can give me a list of some standard ways of obfuscating urls i'll think about whether i could put this in digger.


Yes, read the URL from the address bar, decode it and write it back ... probably leaving the go to the address step manual, however.

I'll look into the general obfuscation question as soon as I get a chance.

Well, for starters, a Google search on "obfuscated URL" found (among other things) this script:

http://javascript.internet.com/equivale ... ealer.html

which seems like a start ...

My apologies for quoting everything, but I got <B>very</B> confused as to where and what to cut :mrgreen:

Until I have a chance to figure out what other methods there are, this looks quite sufficient to me.
Bill Phillips
Sexagenarian Boy Genius
Geekhaven, Massachusetts

clav
 
Posts: 1974
Joined: November 5th, 2002, 3:25 am
Location: Lancaster, UK

Post Posted March 4th, 2003, 3:50 pm

okay, i've made a new version of Digger, available at http://clav.co.uk/digger0.5.1.1.xpi, which has a new item in the Digger menu, "Decode URI", beneath the "Clear location bar".

At the moment it just runs unescape() on the contents of the url bar and writes the result back (doesn't follow the link). I tried using decodeURI() but it seems to decode less character codes or something like that, not really sure why.

If you want the more advanced deobfuscation described in that link just say. I can easily rewrite that code so that it actually works properly in Phoenix.

shoestring

User avatar
 
Posts: 156
Joined: November 5th, 2002, 3:40 pm
Location: Geekhaven, MA, USA

Post Posted March 4th, 2003, 4:29 pm

clav wrote:okay, i've made a new version of Digger, available at http://clav.co.uk/digger0.5.1.1.xpi, which has a new item in the Digger menu, "Decode URI", beneath the "Clear location bar".


Great! Only problem is, it won't install ... I get an error message ("999") and it tells me to try again, but it fails repeatedly.

Is this version perhaps incompatible with the 0.5 milestone?

Thanks, in any case.
Bill Phillips
Sexagenarian Boy Genius
Geekhaven, Massachusetts

clav
 
Posts: 1974
Joined: November 5th, 2002, 3:25 am
Location: Lancaster, UK

Post Posted March 4th, 2003, 5:14 pm

shoestring wrote:Great! Only problem is, it won't install ... I get an error message ("999") and it tells me to try again, but it fails repeatedly.


should be fixed now. Error code 999 seems to mean that there is already an older version of the extension present. I've changed the install.js slightly so that it will just ignore this "error".

shoestring

User avatar
 
Posts: 156
Joined: November 5th, 2002, 3:40 pm
Location: Geekhaven, MA, USA

Post Posted March 4th, 2003, 5:50 pm

clav wrote:
shoestring wrote:Great! Only problem is, it won't install ... I get an error message ("999") and it tells me to try again, but it fails repeatedly.


should be fixed now. Error code 999 seems to mean that there is already an older version of the extension present. I've changed the install.js slightly so that it will just ignore this "error".


Install works fine now ... though it took me a few minutes to realize Digger's now a right click on the "Go" button!
Bill Phillips
Sexagenarian Boy Genius
Geekhaven, Massachusetts

Return to Extension Development


Who is online

Users browsing this forum: No registered users and 1 guest