saving the output of obfuscated javascript

Discussion in 'Javascript' started by kpmassey@gmail.com, Oct 5, 2006.

  1. Guest

    I am trying to use wget to retrieve web pages like this:

    http://www.michigan-football.com/s/2006/cascades.htm

    Visit it and view source to see the obfuscated javascript.

    Is there any tool to run this javascript outside my web-browser, and
    save the page's text to a file? I've tried spidermonkey, but it just
    exits waying window is not defined.

    Any ideas?

    Thanks.
     
    , Oct 5, 2006
    #1
    1. Advertising

  2. web.dev Guest

    wrote:
    > I am trying to use wget to retrieve web pages like this:
    >
    > http://www.michigan-football.com/s/2006/cascades.htm
    >
    > Visit it and view source to see the obfuscated javascript.
    >
    > Is there any tool to run this javascript outside my web-browser, and
    > save the page's text to a file? I've tried spidermonkey, but it just
    > exits waying window is not defined.


    Haven't seen a tool that does so, however you can see what the output
    is. Tested in IE, type the following in the URL, javascript:
    alert(document.body.innerHTML);

    That should give you a nice big alert showing you the modified page
    results.
     
    web.dev, Oct 5, 2006
    #2
    1. Advertising

  3. McKirahan Guest

    "web.dev" <> wrote in message
    news:...
    >
    > wrote:
    > > I am trying to use wget to retrieve web pages like this:
    > >
    > > http://www.michigan-football.com/s/2006/cascades.htm
    > >
    > > Visit it and view source to see the obfuscated javascript.
    > >
    > > Is there any tool to run this javascript outside my web-browser, and
    > > save the page's text to a file? I've tried spidermonkey, but it just
    > > exits waying window is not defined.

    >
    > Haven't seen a tool that does so, however you can see what the output
    > is. Tested in IE, type the following in the URL, javascript:
    > alert(document.body.innerHTML);
    >
    > That should give you a nice big alert showing you the modified page
    > results.



    Another technique to view the source is to type following in
    your browser's address bar (as one line):

    javascript:window.open('about:blank').document.write('<pre>'+document.docume
    ntElement.outerHTML.replace(/</g, '&lt;')+'</pre>')
     
    McKirahan, Oct 6, 2006
    #3
  4. RobG Guest

    wrote:
    > I am trying to use wget to retrieve web pages like this:
    >
    > http://www.michigan-football.com/s/2006/cascades.htm
    >
    > Visit it and view source to see the obfuscated javascript.
    >
    > Is there any tool to run this javascript outside my web-browser, and
    > save the page's text to a file? I've tried spidermonkey, but it just
    > exits waying window is not defined.


    Use Firefox and View Source Chart:

    <URL: https://addons.mozilla.org/firefox/655/ >

    Incidentally, the page has some errors that appear to be the result of
    copying erroneous HTML:

    <th aligh="left" ... >


    --
    Rob
     
    RobG, Oct 6, 2006
    #4
  5. Guest

    Thanks for the ideas. They work, but I was really hoping there was
    some way to run a standalone program to interpret the javascript. I
    believe spidermonkey

    http://www.mozilla.org/js/spidermonkey/

    will do it, but I can not get it to interpret web pages because things
    like document and window are undefined. Is there a standard wrapper
    environment code that could define those things to simulate a web
    browser environment, so that document.write would work?

    Thanks.

    RobG wrote:
    > wrote:
    > > I am trying to use wget to retrieve web pages like this:
    > >
    > > http://www.michigan-football.com/s/2006/cascades.htm
    > >
    > > Visit it and view source to see the obfuscated javascript.
    > >
    > > Is there any tool to run this javascript outside my web-browser, and
    > > save the page's text to a file? I've tried spidermonkey, but it just
    > > exits waying window is not defined.

    >
    > Use Firefox and View Source Chart:
    >
    > <URL: https://addons.mozilla.org/firefox/655/ >
    >
    > Incidentally, the page has some errors that appear to be the result of
    > copying erroneous HTML:
    >
    > <th aligh="left" ... >
    >
    >
    > --
    > Rob
     
    , Oct 12, 2006
    #5
  6. Spamless Guest

    On 2006-10-12, <> wrote:
    > Thanks for the ideas. They work, but I was really hoping there was
    > some way to run a standalone program to interpret the javascript. I
    > believe spidermonkey
    >
    > http://www.mozilla.org/js/spidermonkey/
    >
    > will do it, but I can not get it to interpret web pages because things
    > like document and window are undefined. Is there a standard wrapper
    > environment code that could define those things to simulate a web
    > browser environment, so that document.write would work?


    I usually do it interactively in vim.

    I make changes in the code (for example, changing document.write()
    to print() or perhaps
    document = new Object()
    document.write = print
    or quicker
    document = {write:print}
    and other things (if I want to see the result of an eval, I change
    eval(decrypt(string)) to print(decrypt(string))) and put in things,
    such as, if there is a
    myurl=window.location
    I change to
    myurl="HE IS USING THE WINDOW_LOCATION")

    Then I take the sections I want and use

    [range]!js

    to pipe it through spidermonkey (it works as a filter so the original
    code disappears, but one can make a copy and always use "u" to
    undo the change).


    Also, "seashell" is an interpreter which has a document object with
    write method which is just print
    (the same as 'document={write:print}')


    Using a good text editor which allows you to pipe data to other
    programmes provides a decent interactive session. I suppose emacs
    would do as well as vim (here come the emac users!).
     
    Spamless, Oct 12, 2006
    #6
  7. Guest

    Thanks!! You really helped - js works perfectly now. I just added

    document = {write:print}
    window = {write:print}

    to the top of the file before running it through.




    Spamless wrote:
    > On 2006-10-12, <> wrote:
    > > Thanks for the ideas. They work, but I was really hoping there was
    > > some way to run a standalone program to interpret the javascript. I
    > > believe spidermonkey
    > >
    > > http://www.mozilla.org/js/spidermonkey/
    > >
    > > will do it, but I can not get it to interpret web pages because things
    > > like document and window are undefined. Is there a standard wrapper
    > > environment code that could define those things to simulate a web
    > > browser environment, so that document.write would work?

    >
    > I usually do it interactively in vim.
    >
    > I make changes in the code (for example, changing document.write()
    > to print() or perhaps
    > document = new Object()
    > document.write = print
    > or quicker
    > document = {write:print}
    > and other things (if I want to see the result of an eval, I change
    > eval(decrypt(string)) to print(decrypt(string))) and put in things,
    > such as, if there is a
    > myurl=window.location
    > I change to
    > myurl="HE IS USING THE WINDOW_LOCATION")
    >
    > Then I take the sections I want and use
    >
    > [range]!js
    >
    > to pipe it through spidermonkey (it works as a filter so the original
    > code disappears, but one can make a copy and always use "u" to
    > undo the change).
    >
    >
    > Also, "seashell" is an interpreter which has a document object with
    > write method which is just print
    > (the same as 'document={write:print}')
    >
    >
    > Using a good text editor which allows you to pipe data to other
    > programmes provides a decent interactive session. I suppose emacs
    > would do as well as vim (here come the emac users!).
     
    , Oct 12, 2006
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    683
  2. chris kramer
    Replies:
    5
    Views:
    562
    chris kramer
    Apr 9, 2004
  3. fix

    Obfuscated xsl

    fix, Nov 27, 2003, in forum: XML
    Replies:
    4
    Views:
    584
    Patrick TJ McPhee
    Nov 28, 2003
  4. Thomas Garai

    obfuscated c/c++

    Thomas Garai, Jun 22, 2004, in forum: C++
    Replies:
    5
    Views:
    478
    Prateek R Karandikar
    Jun 22, 2004
  5. Gremenbulin
    Replies:
    5
    Views:
    98
    Evertjan.
    Oct 22, 2007
Loading...

Share This Page