Advertisement
Guest User

Untitled

a guest
Jul 13th, 2017
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //simulate button click
  2. function simulateClick(str) {
  3.     var buttons = document.getElementsByTagName('input');
  4.     for(var i = 0; i < buttons.length; i++)
  5.     {
  6.        if(buttons[i].type == 'submit' && buttons[i].value == str)
  7.        {
  8.            buttons[i].click();
  9.            break;
  10.        }
  11.     }
  12. }
  13.  
  14. //return submit button value to simulate the click
  15. function getInputValue() {
  16.     var buttons = document.getElementsByTagName('input');
  17.     var res = "";
  18.     for(var i = 0; i < buttons.length; i++)
  19.     {
  20.        if(buttons[i].type == 'submit' && buttons[i].value != "")
  21.        {
  22.            res = buttons[i].value;
  23.            break;
  24.        }
  25.     }
  26.     return res;
  27. }
  28.  
  29. //generate random string
  30. function randomStr(digits) {
  31.   var res = "";
  32.   var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
  33.  
  34.   for (var i = 0; i < digits; i++)
  35.     res += possible.charAt(Math.floor(Math.random() * possible.length));
  36.   return res;
  37. }
  38.  
  39. //generate random number in a specific range
  40. function getRandomInt(min, max) {
  41.     return Math.floor(Math.random() * (max - min + 1)) + min;
  42. }
  43.  
  44. //generate credentials
  45. function simulateInput(acc, pass) {
  46.     var rand = getRandomInt(1,5);       // generate random num to make a random e-mail
  47.     var post = "";
  48.    
  49.     if (rand == 1) post = "@gmail.com";
  50.     else if (rand == 2) post = "@yahoo.com";
  51.     else if (rand == 3) post = "@hotmail.com";
  52.     else if (rand == 4) post = "@outlook.com";
  53.     else post = "@mail.com";
  54.    
  55.     document.getElementsByName('reg_username')[0].value = acc;
  56.     document.getElementsByName('reg_email')[0].value = acc + post;
  57.     document.getElementsByName('reg_password')[0].value = pass;
  58.     document.getElementsByName('reg_password2')[0].value = pass;
  59. }
  60.  
  61. /* do not touch*/
  62. var counter;
  63. var regBtn = getInputValue();
  64. const length = 49;
  65. /* do not touch*/
  66.  
  67. var useRandGen = false;         // If true then chooses the length of the username and password randomly
  68. var fakeNum = 1000;                 // total fake accounts to create
  69.  
  70. startJob = function() {
  71.     for (counter = 0; counter < fakeNum; counter++)
  72.     {  
  73.         var temp;
  74.        
  75.         if (useRandGen) {
  76.             var newUser = randomStr(getRandomInt(10,49));   // generate random username with a random length of characters (10-49)
  77.             var newPass = randomStr(getRandomInt(10,49));   // generate random password with a random length of characters (10-49)
  78.             simulateInput(newUser, newPass);                                // simulate user input
  79.             simulateClick(regBtn);                                              // simulate button click
  80.         }
  81.         else {
  82.             var newUser = randomStr(length);                        // generate random username with a const length of 49 chars (MAX: 50)
  83.             var newPass = randomStr(length);                        // generate random password with a const length of 49 chars (MAX: 50)
  84.             simulateInput(newUser, newPass);                            // simulate user input
  85.             simulateClick(regBtn);                                          // simulate button click
  86.         }  
  87.     }
  88.     console.log('Task has been finished. Created: ' + fakeNum + ' fake accounts in total!');
  89. }
  90. startJob();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement