forked from luk1337/vapor-report
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreport.js
160 lines (134 loc) · 4.7 KB
/
report.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
var vapor = require('vapor');
var steamID = require("steamid");
var steamTotp = require('steam-totp');
var csgo = require('csgo');
var fs = require('fs');
var protos = require("./protos/protos.js");
if (!process.argv[3]) {
console.log("Usage: node report.js [config file] [id]");
process.exit();
}
// Create our config object
var config = JSON.parse(fs.readFileSync(process.argv[2]));
config.state = "Online";
// Create bot instance
var bot = vapor();
// Initialize bot with our config
bot.init(config);
// Enable plugins we use
bot.use(vapor.plugins.consoleLogger);
bot.use(vapor.plugins.fs);
// Add our custom 2FA-steamguard plugin
if (config["shared_secret"] && config["shared_secret"].length == 28) {
bot.use({
name: '2FA-steamguard',
plugin: function(VaporAPI) {
VaporAPI.registerHandler({
emitter: 'vapor',
event: 'steamGuard'
}, function(callback) {
callback(steamTotp.generateAuthCode(config["shared_secret"]));
});
}
});
} else {
bot.use(vapor.plugins.stdinSteamGuard);
}
// Proto stuff
var ClientHello = 4006;
var ClientWelcome = 4004;
var clientTimeout = null;
var helloMsgInterval = null;
function stop(msg) {
if (msg)
console.log(msg);
clearTimeout(clientTimeout);
clearInterval(helloMsgInterval);
bot.disconnect();
}
function decodeMatchId(code) {
if (code == null) {
return 8;
}
if (typeof code === 'number') {
return code;
}
if (code.startsWith("steam://")) {
code = code.substring(61);
}
return new csgo.SharecodeDecoder(code).decode().matchId;
}
// Create custom plugin
bot.use({
name: 'vapor-report',
plugin: function(VaporAPI) {
var Steam = VaporAPI.getSteam();
var client = VaporAPI.getClient();
var steamUser = VaporAPI.getHandler('steamUser');
var steamGameCoordinator = new Steam.SteamGameCoordinator(client, 730);
var clientMessage = { games_played: [ { game_id: 730 } ] };
VaporAPI.registerHandler({
emitter: 'vapor',
event: 'ready'
}, function() {
steamUser.gamesPlayed(clientMessage);
helloMsgInterval = setInterval(function() {
if (!client.connected)
return;
if (steamGameCoordinator._client._connection == undefined)
stop("[INFO] Disconnected: Someone is playing on this account right now");
steamGameCoordinator.send({
msg: ClientHello,
proto: { }
}, new protos.CMsgClientHello({}).toBuffer());
}, 2000);
clientTimeout = setTimeout(function() {
stop("[INFO] Timed out after 15 seconds");
}, 15000);
});
VaporAPI.registerHandler({
emitter: 'vapor',
event: 'disconnected'
}, function(error) {
clearTimeout(clientTimeout);
clearInterval(helloMsgInterval);
});
steamGameCoordinator.on('message', function(header, buffer, callback) {
switch (header.msg) {
case ClientWelcome:
clearInterval(helloMsgInterval);
console.log("[INFO] Trying to report the user!");
steamGameCoordinator.send({
msg: protos.ECsgoGCMsg.k_EMsgGCCStrike15_v2_ClientReportPlayer,
proto: { }
}, new protos.CMsgGCCStrike15_v2_ClientReportPlayer({
accountId: new steamID(process.argv[3]).accountid,
matchId: decodeMatchId(process.argv[4]),
rptAimbot: 2,
rptWallhack: 3,
rptSpeedhack: 4,
rptTeamharm: 5,
rptTextabuse: 6,
rptVoiceabuse: 7
}).toBuffer());
break;
case protos.ECsgoGCMsg.k_EMsgGCCStrike15_v2_MatchmakingGC2ClientHello:
console.log("[INFO] MM Client Hello sent!");
break;
case protos.ECsgoGCMsg.k_EMsgGCCStrike15_v2_ClientReportResponse:
stop("[INFO] Report with confirmation ID: " + protos.CMsgGCCStrike15_v2_ClientReportResponse.decode(buffer).confirmationId.toString() + " sent!");
break;
default:
console.log(header);
break;
}
});
}
});
// Start the bot
bot.connect();
// Handle SIGINT (Ctrl+C) gracefully
process.on('SIGINT', function() {
stop();
setTimeout(process.exit, 1000, 0);
});