// ==UserScript== // @name FreeMobile TinyAuth // @namespace freemobile // @description Retour à l'ancien mode d'identification sur FreeMobile. // @include https://mobile.free.fr/* // @updateURL http://ilatumi.org/126488.meta.js // @version 1.8 // @run-at document-start // ==/UserScript== var debug = false; var imgs = []; var convert_color = function convert_color(image_data){ for (var x = 0; x < image_data.width; x++){ for (var y = 0; y < image_data.height; y++){ var i = x*4+y*4*image_data.width; var luma = Math.floor(image_data.data[i] * 299/1000 + image_data.data[i+1] * 587/1000 + image_data.data[i+2] * 114/1000); image_data.data[i] = luma; image_data.data[i+1] = luma; image_data.data[i+2] = luma; image_data.data[i+3] = 255; if (image_data.data[i] > 200 || image_data.data[i+3] == 0) { image_data.data[i] = 255; image_data.data[i+1] = 255; image_data.data[i+2] = 255; image_data.data[i+3] = 0; } } } }; var get_number = function(image_data) { convert_color(image_data); var idx = 34; var test = 0; for (var i = 0; i < 10; i++) { if (image_data.data[(idx+i*10)*4+3] > 0) { break; } } if (i == 10) { // 0 return 0; } var idx = 6; for (var i = 0; i < 15; i++) { if (image_data.data[(idx+i*10)*4+3] == 0) { break; } } if (i == 15) { // 1 3 4 8 9 idx = 103; // 4 if (image_data.data[idx*4+3] > 0 && image_data.data[(idx+2)*4+3] > 0) { return 4; } idx = 34; // 1 if (image_data.data[idx*4+3] > 0) { return 1; } idx = 102; // 9 if (image_data.data[idx*4+3] == 0 && image_data.data[(idx+1)*4+3] == 0) { return 9; } idx = 92; // 3 if (image_data.data[idx*4+3] == 0) { return 3; } return 8; } if (image_data.data[72*4+3] > 0 && image_data.data[92*4+3] == 0) { // 5 return 5; } if (image_data.data[88*4+3] > 0) { // 6 return 6; } if (image_data.data[42*4+3] > 0) { return 2; } return 7; }; var decode = function () { var canvas, ctx, imageData; var debugCanvas, debugCtx; var number, numbers = [-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]; // start debug if (debug) { var debugCanvas = document.createElement("canvas"); debugCanvas.setAttribute("width", 10*10); debugCanvas.setAttribute("height", 16); document.body.appendChild(debugCanvas); var debugCtx = debugCanvas.getContext('2d'); } // end debug canvas = document.createElement("canvas"); canvas.setAttribute("width", 10); canvas.setAttribute("height", 16); ctx = canvas.getContext('2d'); for (var i = 0; i < 10; i++) { var img = imgs[i]; ctx.fillStyle = "rgb(255,255,255)"; ctx.fillRect(0,0,10,16); ctx.drawImage(img, 14, 12, 10, 16, 0, 0, 10, 16); imageData = ctx.getImageData(0, 0, canvas.width, canvas.height); number = get_number(imageData); // start debug if (debug) { console.log(number); ctx.putImageData(imageData, 0, 0); debugCtx.drawImage(canvas, 0, 0, 10, 16, 10*i, 0, 10, 16); } // end debug if (number < 0 || number > 9 || numbers[number] != -1) { throw new Error("Décodage échoué."); } numbers[number] = i; } return numbers; }; var form; var hiddePanel = function () { var els = form.querySelectorAll("*"); for (var j = 1; j < els.length; j++) { if (form == els[j].parentNode || els[j].tagName == "SPAN") { els[j].oldDisplay = els[j].style.display; els[j].style.display = "none"; } } var submit = document.querySelectorAll("form input[type=submit]")[0]; if (submit) { submit.parentNode.style.display = 'block'; } }; var displayPanel = function () { var els = form.querySelectorAll("*"); for (var j = 1; j < els.length; j++) { if (form == els[j].parentNode || els[j].tagName == "SPAN") { els[j].style.display = "block"; } } }; var start = function () { if (!document.getElementById("ident_pos")) { return; } for (var i = 0; i < 10; i++) { var img = document.createElement("img"); img.setAttribute("src", "chiffre.php?pos="+i); imgs.push(img); } var forms = document.getElementsByTagName("form"); if (forms.length > 0) { for (var k = 0; k < forms.length; k++) { var submit = forms[k].querySelectorAll("form input[type=submit]")[0]; if (forms[k].style.display != "none" && submit && submit.style.display != "none") { form = forms[k]; } } } form.setAttribute("autocomplete", "on"); var identPos = document.getElementById("ident_pos"); var newInput = document.createElement("input"); newInput.setAttribute("type", "text"); newInput.setAttribute("id", "ident_login"); newInput.setAttribute("autocomplete", "on"); newInput.setAttribute("name", "ident_login"); identPos.parentNode.appendChild(newInput); hiddePanel(); form.addEventListener("submit", function (e) { // start debug //~ e.preventDefault(); // end debug var numbers; try { numbers = decode(); } catch(e) { displayPanel(); var span = document.createElement("span"); span.innerHTML = 'Détection automatique impossible : <a href="http://userscripts.org/scripts/show/126488">surveillez les mises à jour</a>.'; span.style.fontWeight = "bold"; document.getElementById("ident_blocd").insertBefore(span, document.getElementById("ident_div_ident")); newInput.parentNode.removeChild(newInput); return; } var ident = ""; var n, id = newInput.value.split(""); for (var j = 0; j < id.length; j++) { n = parseInt(id[j]); if (n >= 0 && n <= 9) { ident += numbers[n]; } } document.getElementById("ident_pos").value = ident; }, true); }; document.addEventListener("DOMContentLoaded", start, false);
Mozilla add on,User script,Grease Monkey Script, greasemonkey userscripts, updater userscripts mafia wars userscripts mafia wars autoplayer userscripts mafia wars wall userscripts scripts userscripts travian greasemonkey greasemonkey download greasemonkey facebook greasemonkey tutorial greasemonkey youtube greasemonkey travian greasemonkey chrome greasemonkey mafia wars greasemonkey mafia wars autoplayer
Friday, March 2, 2012
FreeMobile TinyAuth
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment