By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,251 Members | 1,648 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,251 IT Pros & Developers. It's quick & easy.

saving the output of obfuscated javascript

P: n/a
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 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a

kpmas...@gmail.com 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.

Oct 5 '06 #2

P: n/a
"web.dev" <we********@gmail.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
>
kpmas...@gmail.com 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.wri te('<pre>'+document.docume
ntElement.outerHTML.replace(/</g, '&lt;')+'</pre>')
Oct 5 '06 #3

P: n/a

kp******@gmail.com 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 6 '06 #4

P: n/a
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:
kp******@gmail.com 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 '06 #5

P: n/a
On 2006-10-12, kp******@gmail.com <kp******@gmail.comwrote:
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 '06 #6

P: n/a
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, kp******@gmail.com <kp******@gmail.comwrote:
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 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.