Skip to content

Instantly share code, notes, and snippets.

@gaol
Created October 28, 2022 04:56
Show Gist options
  • Save gaol/b81d3afb6a92bcadb0ac7b10a3cd0075 to your computer and use it in GitHub Desktop.
Save gaol/b81d3afb6a92bcadb0ac7b10a3cd0075 to your computer and use it in GitHub Desktop.
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