sean finney on 29 May 2006 16:56:25 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] executing javascript?


hi eric,

On Mon, May 29, 2006 at 12:20:20PM -0400, Eric wrote:
> Does anyone know of a way to execute javascript outside of a browser?

never done it myself, but the libjavascript-perl package looks
promising, as does rhino and ngs-js (i know none of these programs,
just the output of "apt-cache search javascript").

> I have a bit of suspect javascript that I'd like to execute and see 
> what it is actually telling the browser.  The "view source" option
> shows me this:
> 
> <script>
> <!--
> document.write(unescape("%3Cstyle%20type%3D%22text/css%22.......
> //-->
> </script>
> 
> If I could get javascript to just run and redirect it's output to a 
> file then I could see what it's hiding in all the %nn's

i think some clever observation would narrow the scope of your
problem and not require a javascript engine:

- you may notice the ascii strings in there look like something that
  would be in an html document.  
- %NN, where NN is a hexadecimal byte, is a common way of escaping non
  alphanumeric characters.  for example, 0x3c is '<' ...
- a couple minute's hacking could get you a script to "decipher" the
  whole string.  for example,  
  	cat $file | sed -e 's/%\([0-9A-F][0-9A-F]\)/" . chr(0x\1) ."/g'
  will output something that with just a bit of massaging could be made
  into a perl script.  there are probably better ways too :)


	sean

Attachment: signature.asc
Description: Digital signature

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug