mitbbs_helper

Skip login captcha.

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

You will need to install an extension such as Tampermonkey to install this 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!)

Advertisement:

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!)

Advertisement:

// ==UserScript==
// @name         mitbbs_helper
// @namespace    https://www.mitbbs.com/
// @version      1.0
// @description  Skip login captcha.
// @author       fantasist
// @match        *://www.mitbbs.com/*mitbbs_login*.php
// @grant        none
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';

    var btn = document.createElement("button");
    btn.innerText="免Captcha登陆";
    btn.onclick = () => {
        var jsondata;

        var id = document.getElementsByName("id")[0].value;
        var pass = document.getElementsByName("passwd")[0].value;

        var payload = 'msg={"reqType":"0601","username":"' + id + '","password":"' + pass + '","kickmulti":"yes"}';

        var xhr = new XMLHttpRequest();
        xhr.open("POST", "/iphone_new/service_new.php", true);
        xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        xhr.send(payload);
        xhr.onreadystatechange = function () {
            if (xhr.readyState === 4 && xhr.status === 200) {
                // in case we reply back from server
                jsondata = JSON.parse(xhr.responseText);
                document.cookie = "UTMPKEY=" + jsondata.data[0].UTMPKEY + ";domain=.mitbbs.com;path=/";
                document.cookie = "UTMPNUM=" + jsondata.data[0].UTMPNUM + ";domain=.mitbbs.com;path=/";
                document.cookie = "UTMPUSERID=" + jsondata.data[0].UTMPUSERID + ";domain=.mitbbs.com;path=/"; // necessary for website, not POST
                window.location = 'https://www.mitbbs.com/newindex/kjjy.php';
            }
        }
    }

    document.getElementsByName("forget")[0].parentNode.appendChild(btn);
})();