-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathreset.js
75 lines (60 loc) · 1.79 KB
/
reset.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
// ============================================================
//
// Reset bot.
// Created on Thu Jun 14 22:00:00 2018
// Author: Prasun Roy (https://github.com/prasunroy)
// GitHub: https://github.com/prasunroy/steam-bot
//
// ============================================================
// strict mode
'use strict';
// initialize
var SteamCommunity = require('steamcommunity');
var SteamTOTP = require('steam-totp');
var fs = require('fs');
var config = require('./config');
// create steam community object
var community = new SteamCommunity();
// steam login
console.log('\nconnecting to steam.....');
community.login({
accountName: config.accountName,
password: config.password,
twoFactorCode: SteamTOTP.getAuthCode(config.shared_secret)
},
function(error, sessionID, cookies, steamguard, oAuthToken) {
// login error
if(error)
{
// Steam guard mobile authenticator is already disabled.
if(error.message === 'SteamGuard')
{
console.log('\nSteam Guard status.....: Steam Guard Mobile Authenticator already disabled');
console.log('\nfinished');
process.exit();
}
console.log('connection error\n');
console.log(error);
process.exit();
}
// login successful
console.log('connected');
// disable steam guard mobile authenticator
community.disableTwoFactor(config.revocation_code, function(error) {
// disable error
if(error)
{
console.log('\nprocess terminated\n');
console.log(error);
process.exit();
}
// disable successful
console.log('\nSteam Guard status.....: Steam Guard Mobile Authenticator disabled');
// clean configurations
fs.writeFile('config.json', JSON.stringify({}, null, ' '), function(error) {
return;
});
console.log('\nfinished');
process.exit();
});
});