SHARE
TWEET

Untitled

a guest May 31st, 2017 2,098 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var SteamUser = require('steam-user');
  2. var SteamStore = require('steamstore');
  3. var SteamTotp = require('steam-totp');
  4. var readlineSync = require('readline-sync');
  5. var fs = require('fs');
  6.  
  7. var client = new SteamUser();
  8. var user = new SteamUser();
  9. var store = new SteamStore();
  10.  
  11. var username, password;
  12.  
  13. const settings = require('./settings.json');
  14.  
  15. var cookieArray = {};
  16. var count = 0;
  17. var botNum = settings.botNumberStart;
  18. var done = 1;
  19.  
  20. console.log('---- Welcome to Steam Bot Creator ' + JSON.parse(fs.readFileSync('package.json', 'utf8')).version + ' for NodeJS ----');
  21.  
  22. // client.logOn();
  23.  
  24. client.on('loggedOn', function(details) {
  25.   console.log('>> Successfully logged onto Steam anonmyously.');
  26.   console.log('>> Beginning process of account creation:');
  27.  
  28.   console.log('Starting the timer. 1st account should be creating in 5 seconds');
  29.   createAccount();
  30. });
  31.  
  32. setInterval(start, 5 * 1000);
  33.  
  34. user.on('loggedOn', function(details) {
  35.   console.log('>> Logged onto new account.');
  36.   user.webLogOn();
  37.   verifyEmail();
  38. });
  39.  
  40. user.on('webSession', function(sessionID, cookies) {
  41.   console.log("Session started");
  42.   cookieArray = cookies;
  43. });
  44.  
  45. function start()
  46. {
  47.     if (count > settings.botNumberStart)
  48.     {
  49.       console.log('Count has been reached. No more accounts will be created');
  50.       process.exit(1);
  51.     }
  52.     else
  53.     {
  54.         if (done == 1)
  55.         {
  56.             done = 0;
  57.             botNum = botNum + 1;
  58.             console.log('Started creating new account');
  59.             client.logOn();
  60.             count++;
  61.         }
  62.         else
  63.         {
  64.         }
  65.     }
  66. }
  67.  
  68. function createAccount() {
  69.   username = settings.username + '' + botNum;
  70.   password = settings.password + '' + botNum;
  71.   var email = settings.email;
  72.   client.createAccount(username, password, email, function (result) {
  73.     if (result == SteamUser.Steam.EResult.OK) {
  74.       console.log('>> Account created successfully. Username = ' + username);
  75.       initClient();
  76.     } else if (result == SteamUser.Steam.EResult.DuplicateName) {
  77.       console.log('>> There is already an account with the username ' + username + '. Please reload the application.');
  78.       process.exit(1);
  79.     } else if (result == SteamUser.Steam.EResult.IllegalPassword) {
  80.       console.log('>> Problem with password (Atleast 8 chars, too common, etc). Please reload the application.');
  81.       process.exit(1);
  82.     } else {
  83.       console.log('Error while creating the account. Error code: ' + result);
  84.       process.exit(1);
  85.     }
  86.   });
  87. }
  88.  
  89. function initClient() {
  90.   client.logOff();
  91.   client = null;
  92.   user.logOn({
  93.     'accountName': username,
  94.     'password': password
  95.   });
  96. }
  97.  
  98. function verifyEmail() {
  99.   console.log('>> Please complete verification by email sent by Steam.');
  100.   user.requestValidationEmail(function(result) {
  101.     if (result == SteamUser.Steam.EResult.OK) {
  102.       var ignore = readlineSync.question('Enter done when verified: ');
  103.       user.webLogOn();
  104.       addPhoneNumber();
  105.     } else {
  106.       console.log('>> Error while sending verification email. Closing application.');
  107.       process.exit(1);
  108.     }
  109.   });
  110. }
  111.  
  112. function addPhoneNumber() {
  113.   console.log('>> Beginning phone verification...');
  114.   if (typeof cookieArray == 'undefined' || cookieArray.length < 3) {
  115.     console.log('>> ERROR! Unable to receive cookies from Steam. Waiting 5 seconds to retry.');
  116.     setTimeout(function() {
  117.         addPhoneNumber();
  118.     }, 5000);
  119.   } else {
  120.     store.setCookies(cookieArray);
  121.   }
  122.   console.log('>> WARNING: Phone number must have a leading plus and country code!');
  123.   console.log('>> Example: +18885550123');
  124.   var phone = settings.phone;
  125.   store.addPhoneNumber(phone, function(err) {
  126.     if (err) {
  127.       console.log('>> Error with processing phone number: ' + err.message);
  128.       console.log('>> Exiting application.');
  129.       process.exit(1);
  130.     } else {
  131.       console.log('>> Sent confirmation to phone.');
  132.       verifyPhone();
  133.     }
  134.   });
  135. }
  136.  
  137. function verifyPhone() {
  138.   console.log('>> Enter SMS verification code sent to phone.');
  139.   var code = readlineSync.question('Code: ');
  140.   store.verifyPhoneNumber(code, function(err) {
  141.     if (err) {
  142.       console.log(err);
  143.       console.log('>> Error while confirming code: ' + err.message);
  144.       console.log('>> Exiting application.');
  145.       process.exit(1);
  146.     } else {
  147.       console.log('>> Verified phone number successfully.');
  148.       console.log('2fa enabling process beginning...');
  149.       enableTwoFactor();
  150.     }
  151.   });
  152. }
  153.  
  154. function enableTwoFactor() {
  155.   user.enableTwoFactor(function(response) {
  156.     var status = response.status;
  157.     if (!(status == SteamUser.Steam.EResult.OK)) {
  158.       console.log('>> Error while enabling 2fa. Error code: ' + status);
  159.       process.exit(1);
  160.     } else {
  161.       console.log('>> Successfully requested 2fa enabling.');
  162.       console.log('>> Saving valuable data to ' + username + '.2fa');
  163.       fs.writeFile(user.steamID + '.maFile', JSON.stringify(response));
  164.       finalizeTwoFactor(response);
  165.     }
  166.   });
  167. }
  168.  
  169. function finalizeTwoFactor(response) {
  170.   console.log('>> Verifying 2fa activiation.');
  171.   var code = readlineSync.question('Code sent by SMS: ');
  172.   user.finalizeTwoFactor(response.shared_secret, code, function (err) {
  173.     if (err) {
  174.       console.log('>> Error while verifying 2fa. Error: ' + err.message);
  175.       process.exit(1);
  176.     } else {
  177.       console.log('>> Successfully verified 2fa authentication.');
  178.       console.log('>> Run test_login.js if you wish to test your login. (Do not remove .2fa file from this directory)');
  179.       done = 1;
  180.     }
  181.   });
  182.   user.logOff();
  183. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top