saving the output of obfuscated javascript

K

kpmassey

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.
 
W

web.dev

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.
 
M

McKirahan

web.dev said:
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>')
 
R

RobG

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" ... >
 
K

kpmassey

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.
 
G

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?

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!).
 
K

kpmassey

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.



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!).
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top