Created
September 21, 2011 03:29
-
-
Save yuanchuan/1231163 to your computer and use it in GitHub Desktop.
login
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
var md5 = require('./md5.js').md5 | |
, exec = require('child_process').exec | |
, username = process.argv[2] || '' | |
, password = process.argv[3] || '' | |
, getUrl = function(u, p) { | |
var href = '"http://xxx.xxx/xxx.php'; | |
return href + '?uid=1&username=' + u + '&passwd=' + p + '&time=100192&flag=1"'; | |
} | |
, url = getUrl(username, md5(password)); | |
exec("wget -qO- " + url + " | awk 'END{print NR}'", | |
function(err, stdout) { | |
if (stdout != 210) { | |
exec('firefox ' + url, function(){}); | |
} else { | |
console.log('unmatch!'); | |
} | |
} | |
); | |
/* | |
./login username password | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment