File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes HackthisSite Javascripted password Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "HackthisSite Javascripted password" Watch "HackthisSite Javascripted password" New topic
Author

HackthisSite Javascripted password

Rob Hope
Ranch Hand

Joined: Mar 31, 2012
Posts: 42
I am trying to pass a level on a hack game but struggling on this level.

It seems to be using Macromedia javascript functions to randomise some strings using a loop but my math/logic isnt up to it.
Can anyoe figure out what the password should be or if my understanding of the problem is completely off?

Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Clean up the code

Rob Hope
Ranch Hand

Joined: Mar 31, 2012
Posts: 42
Sorry - are you saying the solution is just to cleanup the code and then it will work?

Rob Crowther
author
Ranch Hand

Joined: Nov 06, 2012
Posts: 297
    
    5

What do you mean, you didn't mention before that the code wasn't working?

He's not trying to fix the code, he's trying to help you understand the code, which is what you asked for, no?


Read my books: Hello! HTML5 & CSS3 | HTML5 in Action | Read my blog
Rob Hope
Ranch Hand

Joined: Mar 31, 2012
Posts: 42
Rob Crowther wrote:

He's not trying to fix the code, he's trying to help you understand the code, which is what you asked for, no?


Nope - I wasn't that greedy!
I just asked for someone to spoonfeed me the answer
*if they want to teach me how the code actually works too that would be very cool.

I understand that the function MM_buildUp holds the string variables of nice + blue + input

But don't understand how the other functions work to create the password...
Rob Crowther
author
Ranch Hand

Joined: Nov 06, 2012
Posts: 297
    
    5

Hit F12 (or in Firefox Ctrl+Shift+K) and look for the JavaScript debugger. you can then set a break point and step through the code examining the values of the variables at every step. Here's a nice tutorial with screenshots. You'll understand things a lot more quickly if you can see for yourself how it works rather than us trying to tell you.
Rob Hope
Ranch Hand

Joined: Mar 31, 2012
Posts: 42
In Java script are these symbols you cleaned up used for comments? <!-- & //-->

I am now sure how to use firebug to set breakpoints and edit in the javascript on the fly to examine the generated values using console.log
Rob Crowther
author
Ranch Hand

Joined: Nov 06, 2012
Posts: 297
    
    5

Rob Hope wrote:In Java script are these symbols you cleaned up used for comments? <!-- & //-->


They are used to stop browsers with no support for JavaScript getting confused by characters that are invalid in HTML that appear in the script. Unless you need to support Netscape Navigator 1.0 or Internet Explorer 2.0 there's no need for them these days.

Rob Hope wrote:I am now sure how to use firebug to set breakpoints and edit in the javascript on the fly to examine the generated values using console.log


Good. Unless that is a typo?
Rob Hope
Ranch Hand

Joined: Mar 31, 2012
Posts: 42
Sorry yes it was a typo

Ive managed to set a watch in firebug on the variables but am only returning null values currently

console.log (MM_changeProp)

any ideas?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61768
    
  67

You might want to try using Chrome or Safari. I find the WebKit Dev Tools more feature-rich and easier to use than Firebug.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rob Crowther
author
Ranch Hand

Joined: Nov 06, 2012
Posts: 297
    
    5

Have you read the article I linked to? Where have you set your break points?
 
 
subject: HackthisSite Javascripted password