CAPTCHAs.IO OnlineBooking UserScript

This script is a UserScript to auto solve captchas in http://onlinebooking.sand.telangana.gov.in/Masters/Home.aspx the SSMMS or Sand Sale Management and Monitoring System website.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name        CAPTCHAs.IO OnlineBooking UserScript
// @namespace   https://app.captchas.io/ssmms/
// @include     https://onlinebooking.sand.telangana.gov.in/Masters/Home.aspx
// @include     *
// @connect     app.captchas.io
// @grant       GM_xmlhttpRequest
// @version     1.0.3
// @description This script is a UserScript to auto solve captchas in http://onlinebooking.sand.telangana.gov.in/Masters/Home.aspx the SSMMS or Sand Sale Management and Monitoring System website.
// ==/UserScript==

function getBase64(img) {
	var canvas = document.createElement('canvas');
	var ctx = canvas.getContext('2d');

	canvas.width = img.width
	canvas.height = img.height
	ctx.drawImage(img, 0, 0)

	return canvas.toDataURL();
}

function doAnswer(k, b) {
	var __data = new FormData();
	__data.append("key", k);
	__data.append("body", b);

	GM_xmlhttpRequest ({
		method: "POST",
		data: __data,
		url: 'https://app.captchas.io/ssmms/validator.php',
		onload: function(response) {
			var result = JSON.parse(response.responseText);

			if (result.status == 'OK') {
				document.querySelector('#txtEnterCode').value = result.answer;
			} else {
				console.log(response.responseText);
			}
		}
	});
};

(function() {
	'use strict';
	
	var key = '<YOUR_CAPTCHAs_IO_SSMMMS_KEY>';
	var base64 = getBase64(document.getElementById("imgCaptcha"));

	doAnswer(key, base64);
})();