Discussions » Development

How to getelement and getAttribute

§
Posted: 2017-03-18
Edited: 2017-03-18

How to getelement and getAttribute

How to getelement and getAttribute

document.getElementsByTagName('iframe')[0].contentWindow.document.getElementById('recaptcha-anchor').getAttribute("aria-checked");

This work on https://www.google.com/recaptcha/api2/demo for get recaptcha solve is true or false "aria-checked" but when use this script in any web it's can't get getAttribute "Error: Permission denied to access property "document"

Try on this web : http://www.uploadbank.com/nntcw86mit17

var dllink = null;
var domain = (window.location != window.parent.location) ? document.referrer.toString() : document.location.toString();
var domain = domain.replace("http://","").replace("https://","").replace("http://www.","").replace("https://www.","").replace("www.","").split("/")[0];
// var domain = domain.substr(0, domain.lastIndexOf("."))
var urlloc = null;
var result = null;
var listho = 'uploadbank.com|filecyber.com|userscdn.com|datasbit.com|fileflares.com|xeupload.com|userscdn.com|heroupload.com|uploadify.net|sonifiles.com|google.com';

if(domain.match(listho)) {
    if(location.href.indexOf('frame')>-1){
        console.log('[RC] SOLVE CHECK');
        var solveCheck = setInterval(function() {
            var solveStatus = document.getElementsByTagName('iframe')[0].contentWindow.document.getElementById('recaptcha-anchor').getAttribute("aria-checked");
            if(solveStatus = null) {
                console.log('[RC] SOLVE STATUS : NULL');
                console.log('[RC] TRY WORK : ');
            }
            if(solveStatus = 'false') {
                console.log('[RC] SOLVE STATUS : ' + (solveStatus));
                console.log('[RC] TRY WORK : ');
            }
            if(solveStatus = 'true') {
                GM_setClipboard('[RC] COMPLETE');
                clearInterval(solveCheck);
            }
        }, 4000);
    }
}
wOxxOmMod
§
Posted: 2017-03-18

This is a cross-origin iframe so you simply can't access it from another site.

Make your script run inside the iframe's urls, then use messaging:

top.postMessage(.........) - from iframe's script to the parent script document.getElementsByTagName('iframe')[0].contentWindow.postMessage(......) - from main script to the iframe's script

Documentation: https://developer.mozilla.org/docs/Web/API/Window/postMessage

§
Posted: 2017-03-18

This is a cross-origin iframe so you simply can't access it from another site.

Make your script run inside the iframe's urls, then use messaging:

top.postMessage(.........) - from iframe's script to the parent script

document.getElementsByTagName('iframe')[0].contentWindow.postMessage(......) - from main script to the iframe's script

Documentation: https://developer.mozilla.org/docs/Web/API/Window/postMessage

Thanks but i don't known how to do that I want to known .getAttribute("aria-checked") it true or false , But thanks for help

§
Posted: 2017-03-18
Edited: 2017-03-18

I get this in console how i can set false or true to "solveStatus " and no "undefined"

[RC] SOLVE STATUS : false [RC] SOLVE STATUS : undefined [RC] SOLVE STATUS : false

// ==UserScript==
// @name            reCAPTCHA Helper input
// @version         0.4001
// @description     This automatically clicks on any recaptcha on the webpage and submits it directly after you solved it "https://github.com/eligrey/FileSaver.js/"
// @author          Royalgamer06 & Tackyou
// @include         *
// @grant           GM_xmlhttpRequest
// @grant           GM_setClipboard
// @namespace       https://greasyfork.org/scripts/18449-recaptcha-form-autosubmit/
// @require         https://raw.githubusercontent.com/eligrey/FileSaver.js/master/FileSaver.js
// @require         http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @downloadURL     
// @updateURL       
// ==/UserScript==

var dllink = null;
var domain = (window.location != window.parent.location) ? document.referrer.toString() : document.location.toString();
var domain = domain.replace("http://","").replace("https://","").replace("http://www.","").replace("https://www.","").replace("www.","").split("/")[0];
// var domain = domain.substr(0, domain.lastIndexOf("."))
var urlloc = null;
var result = null;
var listho = 'uploadbank.com|filecyber.com|userscdn.com|datasbit.com|fileflares.com|xeupload.com|userscdn.com|heroupload.com|uploadify.net|sonifiles.com|google.com';



// if(domain.indexOf('miped.ru') == -1 && domain.indexOf('indiegala') == -1 && domain.indexOf('gleam.io') == 1) {   // You can exclude domains here (advanced)
if(domain.match(listho)) {
    if(location.href.indexOf('google.com/recaptcha') > -1) {
        var check = setInterval(function() {
            if(document.querySelectorAll('.recaptcha-checkbox-checkmark').length > 0) {
                //  document.querySelector('.recaptcha-checkbox-checkmark').click();
                document.querySelector('.rc-anchor.rc-anchor-normal.rc-anchor-light').scrollIntoView(false);
                //  clearInterval(check);
                //  return;
            }
        }, 4000);
        var checkaudio = setInterval(function() {
            if(document.querySelectorAll('.rc-button.goog-inline-block.rc-button-audio').length > 0) {
                document.querySelector('.rc-button.goog-inline-block.rc-button-audio').click();
                clearInterval(checkaudio);
                return;
            }
        }, 6000);
        var recolour = setInterval(function() {
            if(document.querySelectorAll('.recaptcha-checkbox-border').length > 0 ) {
                console.log('[RC] REPLACE CHECK MARK BOX COLOUR');
                document.querySelector('.recaptcha-checkbox-border').style.backgroundColor = '#FF12FF';
                clearInterval(recolour);
                return;
            }  
        }, 100);
        var solveCheck = setInterval(function() {
            var solveStatus = $("#recaptcha-anchor").attr('aria-checked')
            console.log('[RC] SOLVE STATUS : ' + (solveStatus));
            //  if(solveStatus = 'false' && solveStatus != 'undefined') {
            //      console.log('[RC] SOLVE STATUS : false');
            //      console.log('[RC] TRY WORK : ');
            //  }else{
            //      console.log('[RC] SOLVE STATUS : true');
            //      GM_setClipboard('[RC] COMPLETE');
            //      clearInterval(solveCheck);
            //  }
        }, 2000);
    }
}

Post reply

Sign in to post a reply.