ray-jay

Recaptch v3 to send webhook

Nov 28th, 2021
987
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         Recaptch v3 to send webhook
  3. // @description  Refacture recaptch v3
  4. // @namespace    http://tampermonkey.net/
  5. // @version      0.1
  6. // @author       Rayjay
  7. // @match        https://www.nike.com.br/atendimento*
  8. // @grant       none
  9. // ==/UserScript==
  10. /* globals jQuery, $, waitForKeyElements */
  11.  
  12.  
  13.  
  14.  
  15. //---- send data func ----//
  16. async function sendData(a1,a2,a3,a4,a5,extLogger,stopHndl){
  17.   const start = new Date();
  18.   let delCount = 0;
  19.   let failCount = 0;
  20.   const msToHMS = s => `${s / 3.6e6 | 0}h ${(s % 3.6e6) / 6e4 | 0}m ${(s % 6e4) / 1000 | 0}s`;
  21.   console.log("Sending data...")
  22.   console.log(a1,a2,a3,a4,a5)
  23.   const log = {
  24.       warn() { extLogger ? extLogger('warn', arguments) : console.warn.apply(console, arguments); },
  25.       error() { extLogger ? extLogger('error', arguments) : console.error.apply(console, arguments); },
  26.       success() { extLogger ? extLogger('success', arguments) : console.info.apply(console, arguments); },
  27.   };
  28.  
  29.   const end = () => {
  30.       log.error(`Ended at ${new Date().toLocaleString()}! Total time: ${msToHMS(Date.now() - start.getTime())}`);
  31.       log.warn(`Foi enviado ${delCount} tokens, ${failCount} failharam.\n`);
  32.  
  33.  
  34.   }
  35.  
  36.  
  37.  
  38.   async function sendy() {
  39.     grecaptcha.execute(a4, {action: a3}).then(
  40.         function(e) {
  41.             log.warn("Token Gerado = "+e);
  42.             url = a2+e
  43.             const URL_TO_FETCH = url;
  44.             fetch(URL_TO_FETCH, {
  45.                 method: 'get', // opcional
  46.                 mode: 'no-cors'
  47.             }).then(function(response) {
  48.               delCount++;
  49.               return log.success("Token enviado com sucesso");
  50.             }).catch(function(err) {
  51.               failCount++;
  52.                return log.error("Erro na conexão");});
  53.                     }
  54.         )
  55.       }
  56.  
  57.  
  58.  
  59.   function getCookie(name) {
  60.     const value = `; ${document.cookie}`;
  61.     const parts = value.split(`; ${name}=`);
  62.     if (parts.length === 2) return parts.pop().split(';').shift();
  63.   }
  64.  
  65.  
  66.  
  67.   log.success(`\nStarted at ${start.toLocaleString()}`);
  68.  
  69.   function delay(message){
  70.       return new Promise((resolve) => setTimeout(function(){
  71.         console.log(message);
  72.         resolve();
  73.       }, a1))
  74.   }
  75.  
  76.     (async () => {
  77.       var ii = true
  78.         while (ii){
  79.             console.log("Start")
  80.             console.log(stopHndl())
  81.             await delay("No")
  82.             await sendy()
  83.             if (stopHndl && stopHndl() === false) return ii = false , end(log.error('Stopped by you!'));
  84.             //if (stopHndl && stopHndl() === false)
  85.  
  86.         }
  87.     })();
  88.  
  89.  
  90.   return await sendy();
  91. }
  92.  
  93. //---- User interface ----//
  94.  
  95. function initUI() {
  96.     const insertCss = (css) => {
  97.         const style = document.createElement('style');
  98.         style.appendChild(document.createTextNode(css));
  99.         document.head.appendChild(style);
  100.         return style;
  101.     }
  102.     const createElm = (html) => {
  103.         const temp = document.createElement('div');
  104.         temp.innerHTML = html;
  105.         return temp.removeChild(temp.firstElementChild);
  106.     }
  107.     insertCss(`
  108.             #undiscord {    font-family: ui-monospace;color:#fff;z-index:99;margin-left: auto;margin-right: auto;left: 0;right: 0;}
  109.             #undiscord{position:fixed;top:0px;text-align: center;background-color:var(--dark);width: 600px;padding:1rem;border-radius:0.5rem}
  110.             #undiscord .header{border-radius: 10px;padding:12px 16px;background-color:#f1f1f1;}
  111.             #undiscord p,#undiscord .btn{color:#fff;border:0;border-radius:4px;font-size:14px}
  112.             #undiscord input{width: 70%}
  113.             #undiscord #inputuser{display: grid;background: #7289da94;margin: 0.5rem;}
  114.             #undiscord .logarea{overflow:auto;font-size:.75rem;font-family:Consolas,Liberation Mono,Menlo,Courier,monospace;flex-grow:1;padding:10px;max-height:400px}
  115.         `);
  116.  
  117.     popover = createElm(`
  118.     <div id="undiscord">
  119.       <div class="header">
  120.       <img src="https://www.google.com/recaptcha/about/images/timeline-reCAPTCHA-enterprise@2x.png" width="50" height="60">
  121.  
  122.           <h4>Google recaptcha v3 To my webhook</h4>
  123.       </div><br>
  124.  
  125.         <div id="inputuser">
  126.         <p>Envio automatico<br>
  127.         <input id="autoScroll" type="checkbox" checked>    </p>
  128.         <p>Delay in miliseconds :<br>
  129.             <input id="searchDelay" type="number" value="1000" min="1000" step="1000"></p>
  130.  
  131.         <p>Url do seur Webhook:<br>
  132.         <input id="hasLink" type="text" placeholder="mywebhook.com.br/hook" value="https://datack.herokuapp.com/save?token="/>
  133.         </p>
  134.         <p>Action:<br>
  135.         <input id="hasFile" type="text" placeholder="Action used on recapt v3" value="add_to_cart"/></p>
  136.         <p>SITE_KEY(Unico por site):<br>
  137.         <input id="hasFile2" type="text" placeholder="RECAPTCHA_V3_SITE_KEY" value="6LdQqOcUAAAAAF1f-lhcaIPo9e50FAjmZdbQaQjU"/></p>
  138.         <p>Run:<br>
  139.         <input  type="text" placeholder="comand" value="2+2"/></p>
  140.         <button id="rayray">run comand</buttom>
  141.         </div>
  142.  
  143.  
  144.  
  145.     <button id="testebutton">Send test</button>
  146.     <button id="start" style="background:#43b581;width:80px;">Start</button>
  147.     <button id="stop" style="background:#f04747;width:80px;" disabled>Stop</button>
  148.     <br>
  149.     <pre class="logarea">
  150.  
  151.     </pre>
  152.     </div>
  153.     `);
  154.  
  155.     document.body.appendChild(popover);
  156.  
  157.     const $ = s => popover.querySelector(s);
  158.     const logArea = $('pre');
  159.     const startBtn = $('button#start');
  160.     const testb = $('button#testebutton');
  161.     const rayray2 = $('button#rayray')
  162.     const stopBtn = $('button#stop');
  163.     const autoScroll = $('#autoScroll');
  164.      rayray2.onclick = async e => {console.log('legal'),console.log(eval('2+2'))}
  165.  
  166.     startBtn.onclick = async e => {
  167.       const a1 = $('input#searchDelay').value.trim();
  168.       const a2 = $('input#hasLink').value.trim();
  169.       const a3 = $('input#hasFile').value.trim();
  170.       const a4 = $('input#hasFile2').value.trim();
  171.       const a5 = $('input#autoScroll').checked;
  172.       const stopHndl = () => !(stop === true);
  173.       stop = stopBtn.disabled = !(startBtn.disabled = true);
  174.       const logger = (type = '', args) => {
  175.           const style = { '': '', info: 'color:#00b0f4;', verb: 'color:#72767d;', warn: 'color:#faa61a;', error: 'color:#f04747;', success: 'color:#43b581;' }[type];
  176.           logArea.insertAdjacentHTML('beforeend', `<div style="${style}">${Array.from(args).map(o => typeof o === 'object' ? JSON.stringify(o, o instanceof Error && Object.getOwnPropertyNames(o)) : o).join('\t')}</div>`);
  177.           if (autoScroll.checked) logArea.querySelector('div:last-child').scrollIntoView(false);
  178.       };
  179.  
  180.  
  181.  
  182.  
  183.       if (a5) {
  184.         sendData(a1,a2,a3,a4,a5,logger,stopHndl);
  185.       }
  186.  
  187.  
  188.  
  189.       //await sendData(a1,a2,a3,a4,a5,logger);
  190.       //stop = stopBtn.disabled = !(startBtn.disabled = false);
  191.     }
  192.  
  193.     testb.onclick = async e => {
  194.         console.log("TESTING...sending")
  195.         console.clear()
  196.  
  197.         const local = JSON.parse(localStorage.joinResult)
  198.         const a1 = $('input#searchDelay').value.trim();
  199.         const a2 = $('input#hasLink').value.trim();
  200.         const a3 = $('input#hasFile').value.trim();
  201.         const a4 = $('input#hasFile2').value.trim();
  202.         const a5 = $('input#autoScroll').checked;
  203.         const stopHndl = () => !(stop === true);
  204.         stop = stopBtn.disabled = !(startBtn.disabled = true);
  205.         const logger = (type = '', args) => {
  206.             const style = { '': '', info: 'color:#00b0f4;', verb: 'color:#72767d;', warn: 'color:#faa61a;', error: 'color:#f04747;', success: 'color:#43b581;' }[type];
  207.             logArea.insertAdjacentHTML('beforeend', `<div style="${style}">${Array.from(args).map(o => typeof o === 'object' ? JSON.stringify(o, o instanceof Error && Object.getOwnPropertyNames(o)) : o).join('\t')}</div>`);
  208.             if (autoScroll.checked) logArea.querySelector('div:last-child').scrollIntoView(false);
  209.         };
  210.         console.log(a1,a2,a3,a4,a5)
  211.         console.log(stop);
  212.         console.log("_gerecaptcha ?? : "+localStorage._grecaptcha)
  213.         console.log(local.clientId)
  214.         console.log(local.access_token)
  215.         console.log(local.user_id)
  216.         console.log("Logado? "+local.joinModel.emailSignup)
  217.         console.log("Informacoes de usuario")
  218.         console.log(local.user.screenname)
  219.         console.log(local.user.username)
  220.         console.log(local.user.nuId)
  221.         await sendData(a1,a2,a3,a4,a5,logger);
  222.         }
  223.  
  224.         stopBtn.onclick = e => stop = stopBtn.disabled = !(startBtn.disabled = false);
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231. }
  232.  
  233. initUI();
  234.  
RAW Paste Data