Skip to content

Instantly share code, notes, and snippets.

@christiangenco
Created November 3, 2014 04:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christiangenco/528608bc5874bc4bcc0e to your computer and use it in GitHub Desktop.
Save christiangenco/528608bc5874bc4bcc0e to your computer and use it in GitHub Desktop.
Changes the password for all of your students to the 4 numbers in their student ID
// log in to https://istation.com, navigate to your classroom (https://secure.istation.com/Classroom/Index/CLASSROOM_ID),
// then cut and paste the following into your URL bar and hit enter.
javascript:function changePassword(a){var b=document.createElement("IFRAME");b.setAttribute("src",a),b.style.width="100%",b.style.height="100%",b.style.position="fixed",b.style.top=0,b.onload=function(){console.log("loaded");var a=$(this);if(a.contents().find("h3.lead").length)a.remove(),urls.length>0&&changePassword(urls.pop());else{var b=a.contents().find("#Username").val(),c=b.match(/\d+/)[0];a.contents().find("#Password").val(c),a.contents().find("form[action*='/Student/Edit/']").submit()}},document.body.appendChild(b)}window.urls=$(".entity-list .ctxt-menu-target a").map(function(a,b){return"https://secure.istation.com"+$(b).attr("href").replace("Index","Edit")}).toArray(),changePassword(urls.pop());
// the un-minified source code for the above, if you'd like to make changes
window.urls = $(".entity-list .ctxt-menu-target a").map(function(i,a){
return "https://secure.istation.com" + $(a).attr('href').replace('Index', 'Edit');
}).toArray();
function changePassword(url){
var iframe = document.createElement("IFRAME");
iframe.setAttribute("src", url);
iframe.style.width = "100%";
iframe.style.height = "100%";
iframe.style.position="fixed";
iframe.style.top=0;
iframe.onload = function(){
console.log('loaded');
var $iframe = $(this);
if($iframe.contents().find('h3.lead').length){
// submitted form; we're done
$iframe.remove();
// do the next one
if(urls.length > 0) changePassword(urls.pop());
}else{
var username = $iframe.contents().find("#Username").val();
var password = username.match(/\d+/)[0];
$iframe.contents().find("#Password").val(password);
$iframe.contents().find("form[action*='/Student/Edit/']").submit();
}
}
document.body.appendChild(iframe);
}
changePassword(urls.pop());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment