-
Notifications
You must be signed in to change notification settings - Fork 2
/
script.js
33 lines (30 loc) · 1.11 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Meme SCRIPTFILE example (Ctl+j)
// username/password autofill
// set this file's permissions to 600!
function id(s) { return document.getElementById(s); }
function name(s) { return document.getElementsByName(s)[0]; }
function auth(ut, uh, u, pt, ph, p)
{
if (ut == 'id') id(uh).value = u; else name(uh).value = u;
if (pt == 'id') id(ph).value = p; else name(ph).value = p;
}
// enter login credentials below
// view the target site page source to find the relevant username/password form inputs
var credentials = [
// url regex id/name element value id/name element value
['google.com', 'id', 'Email', 'john.citizen', 'id', 'Passwd', 'qwerty' ], // look for <INPUT id="Email" ...> and <INPUT id="Passwd" ...>
['facebook.com', 'id', 'email', 'john.citizen@gmail.com', 'id', 'pass', 'asdfgh' ],
]
var found = false;
for (var i in credentials)
{
var row = credentials[i];
var re = new RegExp(row[0], 'i');
if (document.location.href.match(re))
{
auth(row[1], row[2], row[3], row[4], row[5], row[6]);
found = true;
break;
}
}
if (!found) alert('no match');