Skip to content

Instantly share code, notes, and snippets.

@Altech
Created October 30, 2012 19:47
Show Gist options
  • Save Altech/3982554 to your computer and use it in GitHub Desktop.
Save Altech/3982554 to your computer and use it in GitHub Desktop.
This script fills the matrix authentication of portal.titech.ac.jp. You can use this as a bookmarklet.
var matrix = {
A: ['I','U','U','A','I','Y','F'],
B: ['Z','N','C','C','U','O','G'],
C: ['V','A','K','I','V','R','B'],
D: ['N','S','R','U','H','A','I'],
E: ['N','M','R','T','E','A','P'],
F: ['E','B','O','P','L','K','P'],
G: ['X','L','O','M','O','I','D'],
H: ['A','E','L','O','H','A','E'],
I: ['Y','I','X','T','J','F','G'],
J: ['O','N','J','X','W','E','G']
};// Sample
var f = document.forms[0];
var es = [f.elements['message3'],f.elements['message4'],f.elements['message5']];
function get(node){ return node.parentNode.parentNode.childNodes[1].textContent; };
var cs = [get(es[0]),get(es[1]),get(es[2])];
function get_m(s){
var cn = s.split(",");
return matrix[cn[0][1]][parseInt(cn[1][0])-1];
};
var ms = [get_m(cs[0]),get_m(cs[1]),get_m(cs[2])];
es[0].value = ms[0];es[1].value = ms[1];es[2].value = ms[2];undefined;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment