Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var SteamUser = require('steam-user');
- var SteamStore = require('steamstore');
- var SteamTotp = require('steam-totp');
- var readlineSync = require('readline-sync');
- var fs = require('fs');
- var client = new SteamUser();
- var user = new SteamUser();
- var store = new SteamStore();
- var username, password;
- const settings = require('./settings.json');
- var cookieArray = {};
- var count = 0;
- var botNum = settings.botNumberStart;
- var done = 1;
- console.log('---- Welcome to Steam Bot Creator ' + JSON.parse(fs.readFileSync('package.json', 'utf8')).version + ' for NodeJS ----');
- // client.logOn();
- client.on('loggedOn', function(details) {
- console.log('>> Successfully logged onto Steam anonmyously.');
- console.log('>> Beginning process of account creation:');
- console.log('Starting the timer. 1st account should be creating in 5 seconds');
- createAccount();
- });
- setInterval(start, 5 * 1000);
- user.on('loggedOn', function(details) {
- console.log('>> Logged onto new account.');
- user.webLogOn();
- verifyEmail();
- });
- user.on('webSession', function(sessionID, cookies) {
- console.log("Session started");
- cookieArray = cookies;
- });
- function start()
- {
- if (count > settings.botNumberStart)
- {
- console.log('Count has been reached. No more accounts will be created');
- process.exit(1);
- }
- else
- {
- if (done == 1)
- {
- done = 0;
- botNum = botNum + 1;
- console.log('Started creating new account');
- client.logOn();
- count++;
- }
- else
- {
- }
- }
- }
- function createAccount() {
- username = settings.username + '' + botNum;
- password = settings.password + '' + botNum;
- var email = settings.email;
- client.createAccount(username, password, email, function (result) {
- if (result == SteamUser.Steam.EResult.OK) {
- console.log('>> Account created successfully. Username = ' + username);
- initClient();
- } else if (result == SteamUser.Steam.EResult.DuplicateName) {
- console.log('>> There is already an account with the username ' + username + '. Please reload the application.');
- process.exit(1);
- } else if (result == SteamUser.Steam.EResult.IllegalPassword) {
- console.log('>> Problem with password (Atleast 8 chars, too common, etc). Please reload the application.');
- process.exit(1);
- } else {
- console.log('Error while creating the account. Error code: ' + result);
- process.exit(1);
- }
- });
- }
- function initClient() {
- client.logOff();
- client = null;
- user.logOn({
- 'accountName': username,
- 'password': password
- });
- }
- function verifyEmail() {
- console.log('>> Please complete verification by email sent by Steam.');
- user.requestValidationEmail(function(result) {
- if (result == SteamUser.Steam.EResult.OK) {
- var ignore = readlineSync.question('Enter done when verified: ');
- user.webLogOn();
- addPhoneNumber();
- } else {
- console.log('>> Error while sending verification email. Closing application.');
- process.exit(1);
- }
- });
- }
- function addPhoneNumber() {
- console.log('>> Beginning phone verification...');
- if (typeof cookieArray == 'undefined' || cookieArray.length < 3) {
- console.log('>> ERROR! Unable to receive cookies from Steam. Waiting 5 seconds to retry.');
- setTimeout(function() {
- addPhoneNumber();
- }, 5000);
- } else {
- store.setCookies(cookieArray);
- }
- console.log('>> WARNING: Phone number must have a leading plus and country code!');
- console.log('>> Example: +18885550123');
- var phone = settings.phone;
- store.addPhoneNumber(phone, function(err) {
- if (err) {
- console.log('>> Error with processing phone number: ' + err.message);
- console.log('>> Exiting application.');
- process.exit(1);
- } else {
- console.log('>> Sent confirmation to phone.');
- verifyPhone();
- }
- });
- }
- function verifyPhone() {
- console.log('>> Enter SMS verification code sent to phone.');
- var code = readlineSync.question('Code: ');
- store.verifyPhoneNumber(code, function(err) {
- if (err) {
- console.log(err);
- console.log('>> Error while confirming code: ' + err.message);
- console.log('>> Exiting application.');
- process.exit(1);
- } else {
- console.log('>> Verified phone number successfully.');
- console.log('2fa enabling process beginning...');
- enableTwoFactor();
- }
- });
- }
- function enableTwoFactor() {
- user.enableTwoFactor(function(response) {
- var status = response.status;
- if (!(status == SteamUser.Steam.EResult.OK)) {
- console.log('>> Error while enabling 2fa. Error code: ' + status);
- process.exit(1);
- } else {
- console.log('>> Successfully requested 2fa enabling.');
- console.log('>> Saving valuable data to ' + username + '.2fa');
- fs.writeFile(user.steamID + '.maFile', JSON.stringify(response));
- finalizeTwoFactor(response);
- }
- });
- }
- function finalizeTwoFactor(response) {
- console.log('>> Verifying 2fa activiation.');
- var code = readlineSync.question('Code sent by SMS: ');
- user.finalizeTwoFactor(response.shared_secret, code, function (err) {
- if (err) {
- console.log('>> Error while verifying 2fa. Error: ' + err.message);
- process.exit(1);
- } else {
- console.log('>> Successfully verified 2fa authentication.');
- console.log('>> Run test_login.js if you wish to test your login. (Do not remove .2fa file from this directory)');
- done = 1;
- }
- });
- user.logOff();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement