Created
October 28, 2022 04:56
-
-
Save gaol/b81d3afb6a92bcadb0ac7b10a3cd0075 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
check_password = Module.cwrap("login", "number", ["string"]); | |
function check_nums_on(pass, idx, len) { | |
for (var i = 0; i < 10; i ++) { | |
pass[idx] = i; | |
if (idx + 1 < len) { | |
check_nums_on(pass, idx + 1, len); | |
} else { | |
var pass_to_verify = "RH_CTF{" + pass.join("") + "}"; | |
console.log("the last bit, checking the password: " + pass_to_verify); | |
result = check_password(pass_to_verify); | |
if (result != 0) { | |
console.log("Found the password:: " + password.join("")); | |
return; | |
} | |
} | |
} | |
} | |
function checknums(len) { | |
password = Array(len) | |
check_nums_on(password, 0, len) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment