Facebook
From Crippled Mousedeer, 3 Years ago, written in JavaScript.
This paste is a reply to pringles_code_scrapper from Mandamin - view diff
Embed
Download Paste or View Raw
Hits: 146
  1. // ==UserScript==
  2. // @name         Pringles bot
  3. // @namespace    http://tampermonkey.net/
  4. // @version      1.1
  5. // @description  Skrypt automatyzujący rejestrację i zdobywanie kodów do Xbox game pass w promocji pringles.
  6. // @updateURL      http://srv18949.microhost.com.pl/scripts/pringles-bot.user.js
  7. // @downloadURL    http://srv18949.microhost.com.pl/scripts/pringles-bot.user.js
  8. // @match        https://gaming.pringles.com/*
  9. // @grant        none
  10. // ==/UserScript==
  11. var wersjajezykowa="lv_LV"; //Kod wybranej wersji językowej na której ma działać skrypt (znajduje się w adresie strony). Zalecane "lv_LV" (Łotwa, brak puzzli i brak kodów z puszki).
  12. var registertimeout=120; //czas w sekundach po ilu ma być przeładowana strona rejestracji konta (np. w przypadku zamulających serwerów).
  13. var firstclicktimeout=1500; //UWAGA!!! Jeśli będziesz miał problem z wczytywaniem wersji niemieckiej (de_DE) mimo ustawienia innej, zwiększ tę wartość na 2000 lub 3000.
  14.  
  15. var gmail_name="pringlesgamepasscodes"; //mail KONIECZNIE na Gmailu (sam alias, bez części po znaku @), do niego będzie doklejany losowy ciąg znaków i na ten adres przyjdą kody do Game Passa. Przykład: dla adresu [email protected] wpisz tu tylko: jankowalski
  16. var password="TajneHaslo123!"; //hasło do tworzonych kont pringles - minimum 8 znaków, duża i mała litera, cyfra i znak specjalny.
  17.  
  18.  
  19. function fillform(){
  20.     var tempid=makeid(20);
  21. document.getElementById("KSTL-Registration-FirstName").value="auto";
  22. document.getElementById("KSTL-Registration-LastName").value="auto";
  23. document.getElementById("KSTL-Registration-City").value="auto";
  24. document.getElementById("KSTL-Registration-Password").value=password;
  25. document.getElementById("KSTL-Registration-PasswordConfirm").value=password;
  26. document.getElementById("KSTL-Registration-AddressLine1").value="auto";
  27. document.getElementById("KSTL-Registration-PostalCode").value="1";
  28. document.getElementById("KSTL-Registration-PhoneNumber2").value="1";
  29. document.getElementById("KSTL-Registration-UserNameConfirm").value=gmail_name+"+"+tempid+"@gmail.com";
  30. document.getElementById("KSTL-Registration-UserName").value=gmail_name+"+"+tempid+"@gmail.com";
  31. document.getElementById("KSTL-Registration-Country-0").click();
  32. document.getElementById("KSTL-Registration-TermsConditions1").click();
  33. document.getElementById("KSTL-Registration-PrivacyPolicy").click();
  34.  
  35. fireChangeEvents(document.getElementById("KSTL-Registration-FirstName"));
  36. fireChangeEvents(document.getElementById("KSTL-Registration-LastName"));
  37. fireChangeEvents(document.getElementById("KSTL-Registration-Password"));
  38. fireChangeEvents(document.getElementById("KSTL-Registration-PasswordConfirm"));
  39. fireChangeEvents(document.getElementById("KSTL-Registration-AddressLine1"));
  40. fireChangeEvents(document.getElementById("KSTL-Registration-PostalCode"));
  41. fireChangeEvents(document.getElementById("KSTL-Registration-PhoneNumber2"));
  42. fireChangeEvents(document.getElementById("KSTL-Registration-City"));
  43. fireChangeEvents(document.getElementById("KSTL-Registration-UserName"));
  44. fireChangeEvents(document.getElementById("KSTL-Registration-UserNameConfirm"));
  45. }
  46.  
  47. function makeid(length) {
  48.    var result           = '';
  49.    var characters       = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
  50.    var charactersLength = characters.length;
  51.    for ( var i = 0; i < length; i++ ) {
  52.       result += characters.charAt(Math.floor(Math.random() * charactersLength));
  53.    }
  54.    return result;
  55. }
  56.  
  57. function fireChangeEvents(element){
  58.     var changeEvent = null;
  59.     changeEvent = document.createEvent ("HTMLEvents");
  60.     changeEvent.initEvent ("input", true, true);
  61.     element.dispatchEvent (changeEvent);
  62.     console.debug('input event dispatched for element: '+element.id);
  63.     changeEvent = document.createEvent ("HTMLEvents");
  64.     changeEvent.initEvent ("keyup", true, true);
  65.     element.dispatchEvent (changeEvent);
  66.     console.debug('keyup event dispatched for element: '+element.id);
  67.     changeEvent = document.createEvent ("HTMLEvents");
  68.     changeEvent.initEvent ("change", true, true);
  69.     element.dispatchEvent (changeEvent);
  70.     console.debug('change event dispatched for element: '+element.id);
  71. }
  72.  
  73. function deleteAllCookies() {
  74.     var cookies = document.cookie.split(";");
  75.  
  76.     for (var i = 0; i < cookies.length; i++) {
  77.         var cookie = cookies[i];
  78.         var eqPos = cookie.indexOf("=");
  79.         var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
  80.         document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
  81.     }
  82. }
  83.  
  84. function auto(){
  85.     if (window.location.pathname=="/"+wersjajezykowa+"/Home"){
  86.         if (document.getElementsByClassName("spinnerObj")[0]==null){
  87.             setTimeout(function(){ document.getElementsByClassName("backtohome")[0].click(); }, firstclicktimeout);
  88.         }
  89.     } else if (window.location.pathname=="/"+wersjajezykowa+"/entercode"){
  90.         if (document.getElementsByClassName("ng-binding")[9].outerHTML.startsWith('<span data-ng-bind-html="main.resources.CoreKelloggs_BatchcodeSectionCta" class="ng-binding">'))
  91.             document.getElementsByClassName("ng-binding")[9].click();
  92.     } else if (window.location.pathname=="/"+wersjajezykowa+"/Login"){
  93.         if (document.getElementsByClassName("ng-binding")[10].outerHTML.startsWith('<span class="btn-copy ng-binding" data-ng-bind-html="main.resources.CoreKelloggs_RegisterNowButton">'))
  94.             document.getElementsByClassName("ng-binding")[10].click();
  95.     } else if (window.location.pathname.startsWith("/"+wersjajezykowa+"/ThankYou")){
  96.         sessionStorage.clear();
  97.         deleteAllCookies();
  98.         window.location.href="https://gaming.pringles.com/"+wersjajezykowa+"/Home";
  99.     } else if (window.location.pathname.startsWith("/"+wersjajezykowa+"/Puzzle")){
  100. //układanie puzzli
  101.     } else if (window.location.pathname.startsWith("/"+wersjajezykowa+"/Error")){
  102.         sessionStorage.clear();
  103.         window.location.href="https://gaming.pringles.com/"+wersjajezykowa+"/Home";
  104.     } else if (window.location.pathname=="/"+wersjajezykowa+"/Register"){
  105.         if (window.localStorage.getItem('registertimeout')==null){
  106.             window.localStorage.setItem('registertimeout', '0');
  107.         } else {
  108.             if (document.getElementsByClassName("ai-white-spin")[0]!=null){
  109.                 if (document.getElementsByClassName("ai-white-spin")[0].getAnimations()[0]!=null){
  110.                     var tempregistertimeout=Number(window.localStorage.getItem('registertimeout'))
  111.                     if (tempregistertimeout>registertimeout){
  112.                         sessionStorage.clear();
  113.                         window.localStorage.setItem('registertimeout', 0);
  114.                         window.location.href="https://gaming.pringles.com/"+wersjajezykowa+"/Home";
  115.                     } else {
  116.                         tempregistertimeout++;
  117.                         window.localStorage.setItem('registertimeout', tempregistertimeout);
  118.                     }
  119.                 }
  120.             } else {
  121.                 window.localStorage.setItem('registertimeout', 0);
  122.             }
  123.         }
  124.         if (document.getElementsByClassName("KSTL-Registration-AccountNotCreated").length==1){
  125.             sessionStorage.clear();
  126.             window.localStorage.setItem('registertimeout', 0);
  127.             window.location.href="https://gaming.pringles.com/"+wersjajezykowa+"/Home";
  128.         }
  129.         if ((document.getElementById("KSTL-Registration-UserName").value=="")&&(document.getElementById("KSTL-Registration-FirstName").value=="")){
  130.             fillform();
  131.             //window.scrollTo(0,document.body.scrollHeight);
  132.             window.scrollBy(0,1400);
  133.         }
  134.     } else {
  135.             sessionStorage.clear();
  136.             window.localStorage.setItem('registertimeout', 0);
  137.             window.location.href="https://gaming.pringles.com/"+wersjajezykowa+"/Home";
  138.         }
  139. }
  140.  
  141. (function() {
  142.     'use strict';
  143. window.onkeyup = function(e) {
  144.     var key = e.keyCode ? e.keyCode : e.which;
  145.     if (key == 192){
  146.         deleteAllCookies();
  147.         sessionStorage.clear();
  148.         window.location.href="https://gaming.pringles.com/"+wersjajezykowa+"/Home";
  149.     } else if (key == 17) {
  150.         if ((window.location.href=="https://gaming.pringles.com/"+wersjajezykowa+"/Login")&&(document.getElementById("KSTL-Registration-UserName").value!="")){
  151.             document.getElementById("KSTL-Registration-Password").value=password;
  152.             fireChangeEvents(document.getElementById("KSTL-Registration-Password"));
  153.         }
  154.         else if (window.location.href=="https://gaming.pringles.com/"+wersjajezykowa+"/Register") {
  155.             if ((document.getElementById("KSTL-Registration-UserName").value!="")&&(document.getElementById("KSTL-Registration-FirstName").value=="")){
  156.                 fillform();
  157.         }
  158.     }
  159.     }
  160. }
  161.  
  162. setInterval(auto, 1000);
  163.  
  164. })();