running javascript in zennoposter

Morgan

Пользователь
Регистрация
30.11.2015
Сообщения
118
Благодарностей
12
Баллы
18
I got a javascript that solves captchas using 2captcha. There is first a function defined, than i call it to send GET request.

It works fine in chrome console, but in zenno it just ticks of positive end without doing any work.

Код:
var apiKey = "API";
var googleKey = ___grecaptcha_cfg.clients[0].aa.l.sitekey;
var pageUrl = ___grecaptcha_cfg.clients[0].$a.baseURI;

function httpGet(theUrl){
    var xmlHttp = new XMLHttpRequest();
    xmlHttp.open( "GET", theUrl, false );
    xmlHttp.send( null );
    return xmlHttp.responseText;
}


function sendCaptcha(){
    var keyCaptchaParams = "https://2captcha.com/in.php?key=" + apiKey + "&method=userrecaptcha" + "&googlekey=" + googleKey + "&pageurl=" + pageUrl + "&header_acao=1&json=1";
    var captchaId = JSON.parse(httpGet(keyCaptchaParams)).request;
    var keyCaptchaResponse = "https://2captcha.com/res.php?key=" + apiKey + "&action=get&header_acao=1&json=1&id=" + captchaId;
   
    var intId = setInterval(function(){
        var captchaAnswer = JSON.parse(httpGet(keyCaptchaResponse));
        console.log(captchaAnswer);
        if ( captchaAnswer.status === 1 ) {
            clearInterval(intId);
            var answer = captchaAnswer.request;
            document.getElementById('g-recaptcha-response').innerHTML=answer;
//            onSuccess(answer);
            document.getElementById('captcha-submit').click();
        }
        else if ( captchaAnswer.request === "ERROR_CAPTCHA_UNSOLVABLE" ) {
            clearInterval(intId);
            console.log("Captcha is unsolvable");
        }
    },5000);
   
}
 

Morgan

Пользователь
Регистрация
30.11.2015
Сообщения
118
Благодарностей
12
Баллы
18
Does zennoposter not have functionality to to work with JS in the way im trying to accomplish? In JS teste the following code results in errors, while using it in browser console is problemfree
 
Последнее редактирование:

VladZen

Administrator
Команда форума
Регистрация
05.11.2014
Сообщения
22 190
Благодарностей
5 831
Баллы
113
Does zennoposter not have functionality to to work with JS in the way im trying to accomplish? In JS teste the following code results in errors, while using it in browser console is problemfree
What error do you get in JS tester?
And why do you use JS code when zennoposter has special blocks to send captchas to 2captcha and other services?
 

Morgan

Пользователь
Регистрация
30.11.2015
Сообщения
118
Благодарностей
12
Баллы
18
In that case this is a feature added after my updating service expired.

I get tons of errors and the JS does nothing at all. I want to accomplish this by JS for the following reasons:

1: the targeted site reports malformed captcha respons.
2: reduce the blocks used getting a more tidy template.

Now I found the correct way to post the response without using JS, but it is more troublesome.
i10^cimgpsh_orig.png
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)