· 5 years ago · Aug 19, 2020, 08:40 PM
1// ==UserScript==
2// @name AntyCaptcha MENOGRAM
3// @namespace https://menogram-dwa.pl/
4// @version 1.05
5// @description Skrypt omijający captche w Margonem działa na starym oraz nowym interfejsie
6// @author kot
7// @match http://*.margonem.pl
8// @grant GM_xmlhttpRequest
9// @connect menogram-dwa.pl
10// ==/UserScript==
11
12// 1.05 +inne pytania
13// 1.04 +randomowy czas
14// 1.03 +wyświetlanie komunikatu o ilości użyć klucza
15// 1.02 +obsługa ni
16(e => {
17 const timeout = 5000; //Czas po którym zostanie rozwiązana zagadka
18 const additional_timeout = 5000; // Dodatkowy losowy czas z zakresu od 0 do X po którym zostanie rozwiązana zagadka
19 /* OBYDWA CZASY PODAJEMY W MILISEKUNDACH - 1 sekunda = 1000 milisekund*/
20 const key = "menogram-dwa.pl"; //Klucz API
21 const si = getCookie(`interface`) == `si`;
22 const post = (url, data) => {
23 const postData = [];
24 for (let i in data) postData.push(`${encodeURIComponent(i)}=${encodeURIComponent(data[i])}`);
25 return new Promise(r => {
26 GM_xmlhttpRequest({
27 method: `POST`,
28 url,
29 data: postData.join(`&`),
30 headers: {
31 "Content-Type": `application/x-www-form-urlencoded`
32 },
33 onload: function(d) {
34 r(JSON.parse(d.responseText));
35 }
36 });
37 });
38 },
39 sleep = (time) => { return new Promise(r => setTimeout(r, time)) },
40 pi = si ? parseInput : Engine.communication.parseJSON;
41 const main = async function(a) {
42 pi.apply(this, arguments);
43 if (a.captcha && a.captcha.content) {
44 const time = timeout + Math.floor(Math.random() * additional_timeout);
45 console.log(`Czekam ${Math.floor(time/10)/100}s`)
46 await sleep(time);
47 const start = Date.now();
48 const query = a.captcha.content.question.text;
49 console.log(`Rozwiązuje zagadkę...`);
50 const captcha = a.captcha.content.image.data;
51 const response = await post(`https://menogram-dwa.pl/api/resolver.php`, { captcha, key, query });
52 if (response.usesLeft) message(`Pozostało ${response.usesLeft} użyć`);
53 if (response.status == 1) {
54 console.log(`Zagadka została rozwiązana w ${Math.floor((Date.now()-start)/10)/100}s\nOdpowiedź: ${response.text}`);
55
56 document.querySelectorAll(si ? `.btn-wood` : `.captcha__buttons .button`).forEach(e => {
57 const text = e.querySelector(si ? `.gfont` : `.label`);
58 if ((text && text.attributes && text.attributes.name) || (text && !si)) {
59 const name = si ? text.attributes.name.value.toLowerCase() : text.innerText.toLowerCase();
60 if (name == response.text.toLowerCase()) e.click();
61 if (name == ("Potwierdzam").toLowerCase()) e.click();
62 }
63 });
64 if (!si) document.querySelector(`.captcha__confirm .button`).click();
65 } else {
66 console.warn(`Wystąpił błąd podczas rozwiązywania zagadki!\n${response.text}`);
67 alert(response.text);
68 }
69 }
70 }
71 si ? parseInput = main : Engine.communication.parseJSON = main;
72})();