Javascript Mission 6: go go away .js

This mission is also as simple as the earlier were. When you will open the source code you will find two functions there namely check and checkpassw.

RawrRawr = "moo";
function check(x)
{
    "+RawrRawr+" == "hack_this_site"
    if (x == ""+RawrRawr+"")
    {
        alert("Rawr! win!");
        window.location = "about:blank";
    } else {
        alert("Rawr, nope, try again!");
    }
}

function checkpassw(moo)
{
   RawrRawr = moo;
   checkpass(RawrRawr);
}

But when you will further check out the source code, you will see that the function you are calling from button tag this time is different, then the one’s given above. It is now checkpass.

<button onclick=”javascript:checkpass(document.getElementById(‘pass’).value)”>Check Password</button>

One more thing about javascripts, you really don’t need to write¬† them in your source code. You can write then in a separate javascript file and link them using a <script> tag. See¬† above the functions, you will find it.

<script type=”text/javascript” src=”http://hackthissite.org/missions/javascript/6/checkpass“></script>

When you open this file you will find the following code.

dairycow="moo";
moo = "pwns";
rawr = "moo";

function checkpass(pass)
{
    if(pass == rawr+" "+moo)
    {
        alert("How did you do that??? Good job!");
        window.location = "../../../missions/javascript
/6/?lvl_password="+pass;
    } else {
        alert("Nope, try again");
    }
}

If you remember what you learnt in mission 4, you can now just concatinate the strings and move on. If not, keep reading.

Answer: The password is moo pwns.

Good luck!!!

Leave a Reply