GeoCheckAutoCaptcha

fill in captcha automatically

// ==UserScript==
// @name            GeoCheckAutoCaptcha
// @name:de         GeoCheckAutoCaptcha
// @namespace       http://gctools.bplaced.net/
// @version         1.02
// @description     fill in captcha automatically
// @description:de  Automatisches Ausfüllen des GeoCheck Captchas
// @author          Hampf
// @match           http*://geocheck.org/geo_inputchkcoord.php*
// @match           http*://geotjek.dk/geo_inputchkcoord.php*
// @grant           none
// ==/UserScript==

(function() {
    'use strict';

    // retrieve mds hashed captcha from HTML source
    var md5check = document.body.innerHTML.match(/validateChkCoordsForm\(this,'\w+/g)[0].split("'")[1]

    var i=-1
    // loop all possibilities until md5 matches
    while(hex_md5(pad(++i,5))!==md5check && i<=99999); // eslint-disable-line
    document.getElementsByName("usercaptcha")[0].value = pad(i,5)

})();

function pad(n, width, z) {
    z = z || '0';
    n = n + '';
    return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n;
}