Solution
- Inspect Element on Javascript Level 5 and switch to the Console.
- Type :
Object.keys( window );
Here we have all the variables of this page :
["top", "window", "location", "external", "chrome", "document", "NREUM", "__nr_require", "$", "jQuery", "io", "html5", "Modernizr", "yepnope", "_gs", "timeSince", "timeString", "PopupCenter", "createCookie", "FavCounter", "loggedIn", "thecode", "_idl", "timer_start", "hljs", "socket", "favcounter", "counter_chat", "counter_notifications", "searchsuggest", "set", "a", "b", "c", "d", "p", "__commandLineAPI"]
- I found : a - b - c -d - p, so I thought that testing them wouldn’t be a bad idea :
alert(a) // Result to " hackthis.co.uk " alert(b) // 18 --> Tested 18 and still nothing so let's try the next one alert(c) // 104 --> Tested 104 and won't work alert(d) // "hats" and that worked ! :D
Here’s another way to pass the level :
Check the source code of the level with that url :
view-source:https://www.hackthis.co.uk/levels/javascript/5
Scroll down and search for those lines :
<script type='text/javascript' src='/files/js/min/main.js?1406192611'></script>
<script type='text/javascript' src='/files/js/min/extra_48d468a93b.js?1406320915'></script>
Now let’s take a look at the second .js
Scroll down to the end of page and look at :
a=window.location.host+"";b=a.length;c=4+((5*10)*2);d=String.fromCharCode(c,-(41-Math.floor(1806/13)),Math.sqrt(b-2)*29,(b*8)-29);p=prompt("Password:","");if(p==d){window.location="?pass="+p;}else{window.location="/levels/";
With that you’ll be able to finish the level ;)
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘\’‘ at line 1
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘\’‘ at line 1
Something is definetly wrong with either the page or my browser. I had to solve this by looking up hints and even then those dont work. For example alert(d) for me brings back the date and time. plus my source code had no link like the one above, I used control+f to try and search it but it doesnt exist. I have no idea what has happened, i aced all the other Javascript levels in a couple of minutes without any help.
Something is definetly wrong with either the page or my browser. I had to solve this by looking up hints and even then those dont work. For example alert(d) for me brings back the date and time. plus my source code had no link like the one above, I used control+f to try and search it but it doesnt exist. I have no idea what has happened, i aced all the other Javascript levels in a couple of minutes without any help.
Why are you copy/pasting someone else’s post, @Sparadrap**?
@dloser Too lazy ? lol
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘\’‘ at line 1
@Sparadrap : I don’t know what your browser is, and it shouldn’t be too relevant. However I’ll explain you my approach of this level.
Well, I disabled JS to get access to the page without having the prompt. Indeed, my browser didn’t want to allow me to access to the source code while the prompt was here, and if I closed it, I was redirected.
Now that I had access to the page, I just needed to find the JS code. Nothing in the main page, so I searched in the included scripts. “prompt” is a nice keyword to search.
I stumbled on this included JS script:
<script type='text/javascript' src='https://hackthis-10af.kxcdn.com/files/js/min/extra_48d468a93b.js?1429997775'></script>
I looked inside, searched for the word “prompt” and got two results. The first one is irrelevant, the second is the one I was looking for? I just needed to take a look at the code beside to find the password.
@Sparadrap**: So should I also just copy/paste my response to that original question? If you’re not even going to try to add something new to the discussion, why should we try to help you?
Also, there is no reason for those two one-line posts. Think first, then post. If needed, edit existing post.
I don’t know that someone has already said this, but not necessary to disable the javascript.
Just when the window appears just click on the “Cancel” and press ESC and then you will stay on the page and the JS not going to throw back.
And then you can view the source code…
Otherwise you can view the code without do anything with the pop-up window just press F12 or Ctrl+U and that it.
Most people are not stupid, just ignorant…
Bonsoir,
Je suis nouveau et je recherche des soces…
Qui veut bien en re un (1) ?
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘\’‘ at line 1
I followed the hard way.
After spending a lot of time I finally got the solution ..
When I researched your solutions I learned a lot about using the console.
Thank you very much..
Provider error ‘8000ffff’ Catastrophic failure
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘\’‘ at line 1
Provider error ‘8000ffff’ Catastrophic failure
I checked the two scripts at the end (main and extra) and ctrl F for the password. To find out the value of d, i tried to stop the prompt request and type d at the console. I showed some s*** date. It didn’t work. Then I copied and pasted the code on the console. Then it showed hats.
Javascript can make a web page present strange behaviors and be dynamic, so variables can change continuously.
It would be interesting to have a challenge, where we have to fight code with code.