-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
174 lines (157 loc) · 5.07 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
const SteamCommunity = require('steamcommunity');
const SteamUser = require('steam-user')
const SteamTotp = require('steam-totp');
const Colors = require('colors');
const path = require('path');
var Async = require('async');
var fs = require('fs');
const ReadLine = require('readline');
var request = require('request')
const reader = require("readline-sync");
var community = new SteamCommunity; // Instance for the commenting
var user1 = new SteamUser; // Instance for bots
var user = new SteamUser; // Instance for the main account
var i=0; var j=0;
var text = fs.readFileSync('./bots.txt').toString('utf-8');
var bot = text.split('\n');
var bot1 = text.split('\n');
var text2 = fs.readFileSync('./comments.txt').toString('utf-8');
var comments = text2.split('\n')
config = require(path.resolve('config.json'));
let configRaw = fs.readFileSync('./config.json').toString();
const steamid = config.steamid;
const betweenComments = config.betweenComments;
const amount = config.amount;
console.log('%s is SteamID'.gray, steamid);
var coocs;
var success = 0; var failed = 0;
let rl = ReadLine.createInterface({
input: process.stdin,
output: process.stdout
});
// Input Username, password, steam guard code:
rl.question('Username: ', (accountName) => {
rl.question('Password: ', (password) => {
rl.question('GuardCode: ', (guard) => {
doLogin(accountName, password, guard);
});
});
});
// Login to the main account:
function doLogin(accountName, password, authCode, captcha) {
user.logOn({
accountName: accountName,
password: password,
twoFactorCode: authCode,
captcha: captcha
})
}
// Callback when loggen in to the main account
user.on("loggedOn", function() {
(async() => {
console.log('Main account: \n%s - succesfully logged in\n----------------------'.cyan, user.steamID);
await new Promise(r => setTimeout(r, 2000));
bot_login()
})();
})
// Add to friend from the main account
function add1(steamid) {
user.addFriend(steamid, function(err, personaName) {
if (err) {
if (err = 'DublicateName') {
(async() => {
console.log('[%s] Already in the friend list'.green, steamid);
await new Promise(r => setTimeout(r, 5000));
add2(user.steamID);
})();
}
else console.log('Cant add to friend %s, error: %s'.red, steamid, err);
}
else {
(async() => {
console.log('[%s] Request sent'.green, steamid);
await new Promise(r => setTimeout(r, 5000));
add2(user.steamID);
})();
}
})
}
// Accept friend request on the bot account
function add2(steamid) {
user1.addFriend(steamid, function(err, personaName) {
if (err) {
if (err = 'DublicateName') {
(async() => {
console.log('[%s] Already in the friend list'.green, steamid);
await new Promise(r => setTimeout(r, 30000));
comm()
})();
}
else console.log('Cant add to friend %s, error: %s'.red, steamid, err);
}
else {
(async() => {
console.log('[%s] Accepted'.green, user1.steamID);
await new Promise(r => setTimeout(r, 30000));
comm()
})();
}
})
}
// When loggen in the bot acc lets add this fom the main acc (function add1)
user1.on("loggedOn", function() {
console.log('Bot № %s: \n[%s] Succesfully logged in'.cyan, i+1, user1.steamID);
add1(user1.steamID)
})
// When logged off the bot acc go to the next bot acc
user1.on("disconnected", function() {
(async() => {
console.log('[%s] Succesfully logged off\n--------------'.gray, user1.steamID);
await new Promise(r => setTimeout(r, 5000));
bot_login()
})();
})
// Login to the bot account using node-user
function bot_login() {
(async() => {
if (i < bot.length) {
user1.logOn({
"accountName": bot[i].split(":")[0],
"password": bot[i].split(":")[1],
"twoFactorCode": SteamTotp.generateAuthCode(bot[i].split(":")[2]),
});
}
else { console.log('The process is finished'); }
})();
}
// Comment using steam-community, then remove from friends, then log off
function comm() {
(async() => {
comm1();
function comm1() {
community.login({
"accountName": bot[j].split(":")[0],
"password": bot[j].split(":")[1],
"twoFactorCode": SteamTotp.generateAuthCode(bot[j].split(":")[2]),
},
function (err, sessionID, cookies, steamguard, oAuthToken) {
if (err) {
if (err.message == 'SteamGuardMobile') { comm1() }
else console.log('[%s] Unable to auth (Error: %s)'.red, community.steamID, err);
}
if (!err) {
var comment = comments[Math.floor(Math.random() * comments.length)];
community.postUserComment(user.steamID, comment, (error) => {
if (error) { console.log("error posting: %s",error); }
if (!error) { console.log('[%s] Successfully commented. Comment: %s'.green, community.steamID, comment); }
});
};
});
};
await new Promise(r => setTimeout(r, 2000));
user.removeFriend(user1.steamID);
i++; j++;
await new Promise(r => setTimeout(r, 2000));
user1.logOff()
})();
}