Advertisement
madalino

generate fake script

Sep 24th, 2022
981
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var backgroundColor = "#32313f";
  2. var borderColor = "#3e6147";
  3. var headerColor = "#202825";
  4. var titleColor = "#ffffdf";
  5.  
  6. var countApiKey = "mintAlertScript";
  7. var countNameSpace="madalinoTribalWarsScripts"
  8.  
  9. var headerWood="#001a33"
  10. var headerWoodEven="#002e5a"
  11. var headerStone="#3b3b00"
  12. var headerStoneEven="#626200"
  13. var headerIron="#1e003b"
  14. var headerIronEven="#3c0076"
  15.  
  16. var defaultTheme= '[["theme1",["#E0E0E0","#000000","#C5979D","#2B193D","#2C365E","#484D6D","#4B8F8C","35"]],["currentTheme","theme1"],["theme2",["#E0E0E0","#000000","#F76F8E","#113537","#37505C","#445552","#294D4A","35"]],["theme3",["#E0E0E0","#000000","#ACFCD9","#190933","#665687","#7C77B9","#623B5A","35"]],["theme4",["#E0E0E0","#000000","#181F1C","#60712F","#274029","#315C2B","#214F4B","35"]],["theme5",["#E0E0E0","#000000","#9AD1D4","#007EA7","#003249","#1F5673","#1C448E","35"]],["theme6",["#E0E0E0","#000000","#EA8C55","#81171B","#540804","#710627","#9E1946","35"]],["theme7",["#E0E0E0","#000000","#754043","#37423D","#171614","#3A2618","#523A34","35"]],["theme8",["#E0E0E0","#000000","#9E0031","#8E0045","#44001A","#600047","#770058","35"]],["theme9",["#E0E0E0","#000000","#C1BDB3","#5F5B6B","#323031","#3D3B3C","#575366","35"]],["theme10",["#E0E0E0","#000000","#E6BCCD","#29274C","#012A36","#14453D","#7E52A0","35"]]]'
  17. var localStorageThemeName = "mintAlertScript"
  18.  
  19. var textColor="#ffffff"
  20. var backgroundInput="#000000"
  21.  
  22. var borderColor = "#C5979D";//#026440
  23. var backgroundContainer="#2B193D"
  24. var backgroundHeader="#2C365E"
  25. var backgroundMainTable="#484D6D"
  26. var backgroundInnerTable="#4B8F8C"
  27.  
  28. var widthInterface=50;//percentage
  29. var headerColorDarken=-50 //percentage( how much the header should be darker) if it's with -(darker) + (lighter)
  30. var headerColorAlternateTable=-30;
  31. var headerColorAlternateHover=30;
  32.  
  33. var backgroundAlternateTableEven=backgroundContainer;
  34. var backgroundAlternateTableOdd=getColorDarker(backgroundContainer,headerColorAlternateTable);
  35.  
  36.  
  37.  
  38. var idInterval=0
  39.  
  40. async function main(){
  41.     initializationTheme()
  42.     await $.getScript("https://dl.dropboxusercontent.com/s/i5c0so9hwsizogm/styleCSSGlobal.js?dl=0");
  43.     createMainInterface()
  44.     changeTheme()
  45.     // hitCountApi()
  46.  
  47.  
  48.    
  49.  
  50.  
  51. }
  52. main()
  53.  
  54. function getColorDarker(hexInput, percent) {
  55.     let hex = hexInput;
  56.  
  57.     // strip the leading # if it's there
  58.     hex = hex.replace(/^\s*#|\s*$/g, "");
  59.  
  60.     // convert 3 char codes --> 6, e.g. `E0F` --> `EE00FF`
  61.     if (hex.length === 3) {
  62.         hex = hex.replace(/(.)/g, "$1$1");
  63.     }
  64.  
  65.     let r = parseInt(hex.substr(0, 2), 16);
  66.     let g = parseInt(hex.substr(2, 2), 16);
  67.     let b = parseInt(hex.substr(4, 2), 16);
  68.  
  69.     const calculatedPercent = (100 + percent) / 100;
  70.  
  71.     r = Math.round(Math.min(255, Math.max(0, r * calculatedPercent)));
  72.     g = Math.round(Math.min(255, Math.max(0, g * calculatedPercent)));
  73.     b = Math.round(Math.min(255, Math.max(0, b * calculatedPercent)));
  74.  
  75.     return `#${("00"+r.toString(16)).slice(-2).toUpperCase()}${("00"+g.toString(16)).slice(-2).toUpperCase()}${("00"+b.toString(16)).slice(-2).toUpperCase()}`
  76. }
  77.  
  78. function createMainInterface(){
  79.    
  80.     let html=`
  81.    
  82.     <div id="div_container" class="scriptContainer">
  83.         <div class="scriptHeader">
  84.             <div style=" margin-top:10px;"><h2>Generate fake script</h2></div>
  85.             <div style="position:absolute;top:10px;right: 10px;"><a href="#" onclick="$('#div_container').remove()"><img src="https://img.icons8.com/emoji/24/000000/cross-mark-button-emoji.png"/></a></div>
  86.             <div style="position:absolute;top:8px;right: 35px;" id="div_minimize"><a href="#"><img src="https://img.icons8.com/plasticine/28/000000/minimize-window.png"/></a></div>
  87.             <div style="position:absolute;top:10px;right: 60px;" id="div_theme"><a href="#" onclick="$('#theme_settings').toggle()"><img src="https://img.icons8.com/material-sharp/24/fa314a/change-theme.png"/></a></div>
  88.         </div>
  89.         <div id="theme_settings"></div>
  90.  
  91.         <div id="div_body">
  92.             <table id="settings_table" class="scriptTable">
  93.                 <tr>
  94.                     <td style="width:30%">admin id</td>
  95.                     <td><input type="text"  id="input_admin_id" class="scriptInput" placeholder="name" value="${game_data.player.id}"></td>
  96.                 </tr>
  97.                 <tr>
  98.                     <td>world number</td>
  99.                     <td><input type="text"  id="input_number_world" class="scriptInput" placeholder="name" value="${game_data.world.match(/\d+/)[0]}"></td>
  100.                 </tr>
  101.                 <tr>
  102.                     <td>database name</td>
  103.                     <td><input type="text"  id="input_database_name" class="scriptInput" placeholder="anything is good" value="PleaseWork"></td>
  104.                 </tr>
  105.                 <tr>
  106.                     <td>link script</td>
  107.                     <td><textarea id="input_link_script" cols="40" rows="10" placeholder="press start"></textarea></td>
  108.                    
  109.                 </tr>
  110.                 <tr>
  111.                     <td colspan="2"><input class="btn evt-confirm-btn btn-confirm-yes" type="button" id="btn_start" onclick="generateScript()" value="Start"></td>
  112.                 </tr>
  113.             </table>
  114.         </div>
  115.         <div class="scriptFooter">
  116.             <div style=" margin-top:5px;"><h5>made by Costache</h5></div>
  117.         </div>
  118.     </div>`
  119.  
  120.  
  121.  
  122.  
  123.    
  124.     ////////////////////////////////////////add and remove window from page///////////////////////////////////////////
  125.     $("#div_container").remove()
  126.     $("#contentContainer").eq(0).prepend(html);
  127.     $("#mobileContent").eq(0).prepend(html);
  128.  
  129.  
  130.     $("#div_container").css("position","fixed");
  131.     $("#div_container").draggable();
  132.    
  133.  
  134.     $("#div_minimize").on("click",()=>{
  135.         let currentWidthPercentage=Math.ceil($('#div_container').width() / $('body').width() * 100);
  136.         if(currentWidthPercentage >=widthInterface ){
  137.             $('#div_container').css({'width' : '10%'});
  138.             $('#div_body').hide();
  139.         }
  140.         else{
  141.             $('#div_container').css({'width' : `${widthInterface}%`});
  142.             $('#div_body').show();
  143.         }
  144.     })
  145.  
  146.    
  147. }
  148.  
  149. function changeTheme(){
  150.     let html= `
  151.     <h3 style="color:${textColor};padding-left:10px;padding-top:5px">after theme is selected run the script again<h3>
  152.     <table class="scriptTable" >
  153.        
  154.         <tr>
  155.             <td>
  156.                 <select  id="select_theme">
  157.                     <option value="theme1">theme1</option>
  158.                     <option value="theme2">theme2</option>
  159.                     <option value="theme3">theme3</option>
  160.                     <option value="theme4">theme4</option>
  161.                     <option value="theme5">theme5</option>
  162.                     <option value="theme6">theme6</option>
  163.                     <option value="theme7">theme7</option>
  164.                     <option value="theme8">theme8</option>
  165.                     <option value="theme9">theme9</option>
  166.                     <option value="theme10">theme10</option>
  167.                 </select>
  168.             </td>
  169.             <td>value</td>
  170.             <td >color hex</td>
  171.         </tr>
  172.         <tr>
  173.             <td>textColor</td>
  174.             <td style="background-color:${textColor}" class="td_background"></td>
  175.             <td><input type="text" class="scriptInput input_theme" value="${textColor}"></td>
  176.         </tr>
  177.         <tr>
  178.             <td>backgroundInput</td>
  179.             <td style="background-color:${backgroundInput}" class="td_background"></td>
  180.             <td><input type="text" class="scriptInput input_theme" value="${backgroundInput}"></td>
  181.         </tr>
  182.         <tr>
  183.             <td>borderColor</td>
  184.             <td style="background-color:${borderColor}" class="td_background"></td>
  185.             <td><input type="text" class="scriptInput input_theme" value="${borderColor}"></td>
  186.         </tr>
  187.         <tr>
  188.             <td>backgroundContainer</td>
  189.             <td style="background-color:${backgroundContainer}" class="td_background"></td>
  190.             <td><input type="text" class="scriptInput input_theme" value="${backgroundContainer}"></td>
  191.         </tr>
  192.         <tr>
  193.             <td>backgroundHeader</td>
  194.             <td style="background-color:${backgroundHeader}" class="td_background"></td>
  195.             <td><input type="text" class="scriptInput input_theme" value="${backgroundHeader}"></td>
  196.         </tr>
  197.         <tr>
  198.             <td>backgroundMainTable</td>
  199.             <td style="background-color:${backgroundMainTable}" class="td_background"></td>
  200.             <td><input type="text" class="scriptInput input_theme" value="${backgroundMainTable}"></td>
  201.         </tr>
  202.         <tr>
  203.             <td>backgroundInnerTable</td>
  204.             <td style="background-color:${backgroundInnerTable}" class="td_background"></td>
  205.             <td><input type="text" class="scriptInput input_theme" value="${backgroundInnerTable}"></td>
  206.         </tr>
  207.         <tr>
  208.             <td>widthInterface</td>
  209.             <td><input type="range" min="25" max="100" class="slider input_theme" id="input_slider_width" value="${widthInterface}"></td>
  210.             <td id="td_width">${widthInterface}%</td>
  211.         </tr>
  212.         <tr >
  213.             <td><input class="btn evt-confirm-btn btn-confirm-yes" type="button" id="btn_save_theme" value="Save"></td>
  214.             <td><input class="btn evt-confirm-btn btn-confirm-yes" type="button" id="btn_reset_theme" value="Default themes"></td>
  215.             <td></td>
  216.         </tr>
  217.  
  218.     </table>
  219.     `
  220.     $("#theme_settings").append(html)
  221.     $("#theme_settings").hide()
  222.  
  223.     let selectedTheme = ""
  224.     let colours =[]
  225.     let mapTheme = new Map()
  226.  
  227.     $("#select_theme").on("change",()=>{
  228.         if(localStorage.getItem(localStorageThemeName) != undefined){
  229.             selectedTheme = $('#select_theme').find(":selected").text();
  230.             colours = Array.from($(".input_theme")).map(elem=>elem.value.toUpperCase().trim())
  231.             mapTheme = new Map(JSON.parse(localStorage.getItem(localStorageThemeName)))
  232.             console.log(selectedTheme)
  233.             console.log(mapTheme)
  234.             colours = mapTheme.get(selectedTheme)
  235.             console.log(colours)
  236.             Array.from($(".input_theme")).forEach((elem,index)=>{
  237.                 elem.value = colours[index]
  238.             })
  239.             Array.from($(".td_background")).forEach((elem,index)=>{
  240.                 elem.style.background = colours[index]
  241.             })
  242.  
  243.             mapTheme.set("currentTheme",selectedTheme)
  244.             localStorage.setItem(localStorageThemeName, JSON.stringify(Array.from(mapTheme.entries())))
  245.         }
  246.     })
  247.  
  248.     $("#btn_save_theme").on("click",()=>{
  249.         colours = Array.from($(".input_theme")).map(elem=>elem.value.toUpperCase().trim())
  250.         selectedTheme = $('#select_theme').find(":selected").text();
  251.  
  252.         for(let i=0;i<colours.length-1;i++){
  253.             if(colours[i].match(/#[0-9 A-F]{6}/) == null ){
  254.                 UI.ErrorMessage("wrong colour: "+colours[i])  
  255.                 throw new Error("wrong colour")
  256.             }
  257.         }
  258.  
  259.         if(localStorage.getItem(localStorageThemeName) != undefined)
  260.             mapTheme = new Map(JSON.parse(localStorage.getItem(localStorageThemeName)))
  261.  
  262.  
  263.         mapTheme.set(selectedTheme,colours)
  264.         mapTheme.set("currentTheme",selectedTheme)
  265.  
  266.         localStorage.setItem(localStorageThemeName, JSON.stringify(Array.from(mapTheme.entries())))
  267.         console.log("saved colours for: "+selectedTheme)
  268.         UI.SuccessMessage(`saved colours for: ${selectedTheme} \n run the script again`,1000)
  269.  
  270.  
  271.     })
  272.  
  273.     $("#btn_reset_theme").on("click",()=>{
  274.         localStorage.setItem(localStorageThemeName, defaultTheme)
  275.         UI.SuccessMessage("run the script again",1000)
  276.  
  277.     })
  278.     $("#input_slider_width").on("input",()=>{
  279.         $("#td_width").text($("#input_slider_width").val()+"%")
  280.     })
  281.  
  282.  
  283.     if(localStorage.getItem(localStorageThemeName) != undefined){
  284.         mapTheme = new Map(JSON.parse(localStorage.getItem(localStorageThemeName)))
  285.         let currentTheme=mapTheme.get("currentTheme")
  286.         document.querySelector('#select_theme').value=currentTheme
  287.     }
  288.  
  289.    
  290. }
  291.  
  292. function initializationTheme(){
  293.     if(localStorage.getItem(localStorageThemeName) != undefined){
  294.         let mapTheme = new Map(JSON.parse(localStorage.getItem(localStorageThemeName)))
  295.         let currentTheme=mapTheme.get("currentTheme")
  296.         let colours=mapTheme.get(currentTheme)
  297.  
  298.         textColor=colours[0]
  299.         backgroundInput=colours[1]
  300.  
  301.         borderColor = colours[2]
  302.         backgroundContainer=colours[3]
  303.         backgroundHeader=colours[4]
  304.         backgroundMainTable=colours[5]
  305.         backgroundInnerTable=colours[6]
  306.         widthInterface=colours[7]
  307.  
  308.         backgroundAlternateTableEven=backgroundContainer;
  309.         backgroundAlternateTableOdd=getColorDarker(backgroundContainer,headerColorAlternateTable);      
  310.         console.log("textColor: "+textColor)
  311.         console.log("backgroundContainer: "+backgroundContainer)
  312.        
  313.     }
  314.     else{
  315.         localStorage.setItem(localStorageThemeName, defaultTheme)
  316.  
  317.         let mapTheme = new Map(JSON.parse(localStorage.getItem(localStorageThemeName)))
  318.         let currentTheme=mapTheme.get("currentTheme")
  319.         let colours=mapTheme.get(currentTheme)
  320.  
  321.         textColor=colours[0]
  322.         backgroundInput=colours[1]
  323.  
  324.         borderColor = colours[2]
  325.         backgroundContainer=colours[3]
  326.         backgroundHeader=colours[4]
  327.         backgroundMainTable=colours[5]
  328.         backgroundInnerTable=colours[6]
  329.         widthInterface=colours[7]
  330.  
  331.         backgroundAlternateTableEven=backgroundContainer;
  332.         backgroundAlternateTableOdd=getColorDarker(backgroundContainer,headerColorAlternateTable);  
  333.     }
  334.  
  335. }
  336.  
  337.  
  338.  
  339. async function generateScript(){  
  340.     UI.SuccessMessage("generating database...\n wait couple of seconds")
  341.     await insertCryptoLibrary();
  342.  
  343.     let nameAdmin = document.getElementById("input_admin_id").value;
  344.     let dropboxToken="voeQxDKEfdAAAAAAAAAAAWmeVbsqR6fFyKdfA2gXF05UhEt-ztkJqkFZY6PkMTzk"
  345.     let databaseName=document.getElementById("input_database_name").value
  346.     let numberWorld=document.getElementById("input_number_world").value
  347.     databaseName= databaseName + `_${numberWorld}_${nameAdmin}`
  348.    
  349.     let plainText=`
  350.         dropboxToken="${dropboxToken}";
  351.         databaseName="${databaseName}";
  352.         runWorld=${numberWorld};
  353.         adminBoss="${nameAdmin}";
  354.         console.log("decrypt data")
  355.     `
  356.     let key = CryptoJS.AES.encrypt(plainText, "automateThisAnnoyingPart").toString()
  357.     console.log(key)
  358.  
  359.     let outputfakeScript=`javascript:var encryptedData='${key}';
  360.     $.getScript('https://dl.dropboxusercontent.com/s/2q29vaqbibe6tph/fakeScriptMain.js?dl=0');void(0);`
  361.  
  362.  
  363.  
  364.     let filname_ally = `${databaseName}/ally.txt`
  365.     let filname_admin = `${databaseName}/admin.txt`
  366.  
  367.     let filename_fakes1 = `${databaseName}/fakes1.txt`
  368.     let filename_fakes2 = `${databaseName}/fakes2.txt`
  369.     let filename_fakes3 = `${databaseName}/fakes3.txt`
  370.     let filename_fakes4 = `${databaseName}/fakes4.txt`
  371.     let filename_fakes5 = `${databaseName}/fakes5.txt`
  372.     let filename_fakes6 = `${databaseName}/fakes6.txt`
  373.     let filename_fakes7 = `${databaseName}/fakes7.txt`
  374.     let filename_fakes8 = `${databaseName}/fakes8.txt`
  375.     let filename_fakes9 = `${databaseName}/fakes9.txt`
  376.     let filename_fakes10 = `${databaseName}/fakes10.txt`
  377.    
  378.     try {  
  379.         console.log("whatffff")
  380.         await readFileDropbox(filname_ally, dropboxToken)
  381.         await readFileDropbox(filname_admin, dropboxToken)
  382.  
  383.         await readFileDropbox(filename_fakes1, dropboxToken)
  384.         await readFileDropbox(filename_fakes2, dropboxToken)
  385.         await readFileDropbox(filename_fakes3, dropboxToken)
  386.         await readFileDropbox(filename_fakes4, dropboxToken)
  387.         await readFileDropbox(filename_fakes5, dropboxToken)
  388.         await readFileDropbox(filename_fakes6, dropboxToken)
  389.         await readFileDropbox(filename_fakes7, dropboxToken)
  390.         await readFileDropbox(filename_fakes8, dropboxToken)
  391.         await readFileDropbox(filename_fakes9, dropboxToken)
  392.         await readFileDropbox(filename_fakes10, dropboxToken)
  393.         UI.ErrorMessage("database already exists")
  394.         console.log("files already exists")
  395.     } catch (error) {
  396.         await uploadFile("[]", filname_ally, dropboxToken)
  397.         await uploadFile("[]", filname_admin, dropboxToken)
  398.  
  399.         await uploadFile("[]", filename_fakes1, dropboxToken)
  400.         await uploadFile("[]", filename_fakes2, dropboxToken)
  401.         await uploadFile("[]", filename_fakes3, dropboxToken)
  402.         await uploadFile("[]", filename_fakes4, dropboxToken)
  403.         await uploadFile("[]", filename_fakes5, dropboxToken)
  404.         await uploadFile("[]", filename_fakes6, dropboxToken)
  405.         await uploadFile("[]", filename_fakes7, dropboxToken)
  406.         await uploadFile("[]", filename_fakes8, dropboxToken)
  407.         await uploadFile("[]", filename_fakes9, dropboxToken)
  408.         await uploadFile("[]", filename_fakes10, dropboxToken)
  409.         console.log("files created")
  410.  
  411.     }
  412.     document.getElementById("input_link_script").value=outputfakeScript
  413.  
  414. }
  415.  
  416.  
  417.  
  418.  
  419.  
  420. function insertCryptoLibrary(){
  421.     return new Promise((resolve,reject)=>{
  422.  
  423.  
  424.         let start=new Date().getTime()
  425.         let script = document.createElement('script');
  426.         script.type="text/javascript"
  427.         script.src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/aes.js"
  428.         script.onload = function () {
  429.             let stop=new Date().getTime()
  430.             console.log(`insert crypto-js library in ${stop-start} ms`)
  431.             resolve("done")
  432.         };
  433.         document.head.appendChild(script);
  434.     })
  435. }
  436.  
  437. function uploadFile(data, filename, dropboxToken) {
  438.     return new Promise((resolve, reject) => {
  439.         var file = new Blob([data], { type: "plain/text" });
  440.         var nr_start1 = new Date().getTime();
  441.         file.name = filename;
  442.  
  443.         //stop refreshing the page
  444.         $(document).bind("keydown", disableF5);
  445.         window.onbeforeunload = function(e) {
  446.             console.log("is uploading");
  447.             return "are you sure?";
  448.         };
  449.  
  450.         var xhr = new XMLHttpRequest();
  451.         xhr.upload.onprogress = function(evt) {
  452.             console.log(evt)
  453.             var percentComplete = parseInt(100.0 * evt.loaded / evt.total);
  454.             console.log(percentComplete)
  455.             UI.SuccessMessage("progress upload: " + percentComplete + "%")
  456.         };
  457.  
  458.         xhr.onload = function() {
  459.             if (xhr.status === 200) {
  460.                 var fileInfo = JSON.parse(xhr.response);
  461.                 // Upload succeeded. Do something here with the file info.
  462.                 UI.SuccessMessage("upload succes")
  463.                 var nr_stop1 = new Date().getTime();
  464.                 console.log("time upload: " + (nr_stop1 - nr_start1))
  465.  
  466.                 //enable refresh page
  467.                 window.onbeforeunload = function(e) {
  468.                     console.log("done");
  469.                 };
  470.                 $(document).unbind("keydown", disableF5);
  471.                 resolve("succes")
  472.  
  473.             } else {
  474.                 var errorMessage = xhr.response || 'Unable to upload file';
  475.                 // Upload failed. Do something here with the error.
  476.                 UI.SuccessMessage("upload failed")
  477.                 reject(errorMessage)
  478.             }
  479.         };
  480.  
  481.         xhr.open('POST', 'https://content.dropboxapi.com/2/files/upload', false);
  482.         xhr.setRequestHeader('Authorization', 'Bearer ' + dropboxToken);
  483.         xhr.setRequestHeader('Content-Type', 'application/octet-stream');
  484.         xhr.setRequestHeader('Dropbox-API-Arg', JSON.stringify({
  485.             path: '/' + file.name,
  486.             mode: 'add',
  487.             autorename: true,
  488.             mode: 'overwrite',
  489.             mute: false
  490.         }));
  491.  
  492.         xhr.send(file)
  493.     })
  494. }
  495. function readFileDropbox(filename,dropboxToken) {
  496.     return new Promise((resolve, reject) => {
  497.         $.ajax({
  498.             url: "https://content.dropboxapi.com/2/files/download",
  499.             method: 'POST',
  500.             dataType: "text",
  501.             headers: {
  502.                 'Authorization': 'Bearer ' + dropboxToken,
  503.                 'Dropbox-API-Arg': JSON.stringify({ path: "/" + filename })
  504.             },
  505.  
  506.             success: (data) => {
  507.                 resolve(data)
  508.             },
  509.             error: (err) => {
  510.                 console.log(err)
  511.                 reject(err)
  512.             }
  513.         })
  514.     })
  515. }
  516. function disableF5(e) { if ((e.which || e.keyCode) == 116 || (e.which || e.keyCode) == 82) e.preventDefault(); };
  517.  
  518.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement