├── .gitignore ├── LICENSE ├── README.md ├── accounts.example.txt ├── app.js ├── helpers └── protos.js ├── package.json ├── protos └── .gitkeep └── updater.js /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io/api/intellj,node 2 | 3 | #!! ERROR: intellj is undefined. Use list command to see defined gitignore types !!# 4 | 5 | ### Node ### 6 | # Logs 7 | logs 8 | *.log 9 | npm-debug.log* 10 | 11 | # Runtime data 12 | pids 13 | *.pid 14 | *.seed 15 | *.pid.lock 16 | 17 | # Directory for instrumented libs generated by jscoverage/JSCover 18 | lib-cov 19 | 20 | # Coverage directory used by tools like istanbul 21 | coverage 22 | 23 | # nyc test coverage 24 | .nyc_output 25 | 26 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 27 | .grunt 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (http://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules 37 | jspm_packages 38 | 39 | # Optional npm cache directory 40 | .npm 41 | 42 | # Optional eslint cache 43 | .eslintcache 44 | 45 | # Optional REPL history 46 | .node_repl_history 47 | 48 | ### Intellij ### 49 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm 50 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 51 | 52 | # User-specific stuff: 53 | .idea/workspace.xml 54 | .idea/tasks.xml 55 | .idea/dictionaries 56 | .idea/vcs.xml 57 | .idea/jsLibraryMappings.xml 58 | 59 | # Sensitive or high-churn files: 60 | .idea/dataSources.ids 61 | .idea/dataSources.xml 62 | .idea/dataSources.local.xml 63 | .idea/sqlDataSources.xml 64 | .idea/dynamic.xml 65 | .idea/uiDesigner.xml 66 | 67 | # Gradle: 68 | .idea/gradle.xml 69 | .idea/libraries 70 | 71 | # Mongo Explorer plugin: 72 | .idea/mongoSettings.xml 73 | 74 | ## File-based project format: 75 | *.iws 76 | 77 | ## Plugin-specific files: 78 | 79 | # IntelliJ 80 | /out/ 81 | 82 | # mpeltonen/sbt-idea plugin 83 | .idea_modules/ 84 | 85 | # JIRA plugin 86 | atlassian-ide-plugin.xml 87 | 88 | # Crashlytics plugin (for Android Studio and IntelliJ) 89 | com_crashlytics_export_strings.xml 90 | crashlytics.properties 91 | crashlytics-build.properties 92 | fabric.properties 93 | 94 | ### Intellij Patch ### 95 | # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 96 | 97 | # *.iml 98 | # modules.xml 99 | # .idea/misc.xml 100 | # *.ipr 101 | 102 | .idea 103 | 104 | # Custom 105 | *.proto 106 | accounts.txt 107 | sentry/* -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Dan Kyung 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # node-csgorc 2 | A simple bot created to report and commend CS:GO players. Includes full Steam Guard authentication support. 3 | 4 | # Usage 5 | 1. Create `accounts.txt` and fill with CS:GO accounts. `username:password` format. 6 | 2. Install necessary npm packages by running: `npm install` 7 | 3. Update protobufs by running: `npm run update` 8 | 3. Start with `npm start`. You will be asked to enter Steam Guard codes (if needed) & target Steam ID. 9 | 10 | # Thanks... 11 | - [node-steam](https://github.com/seishun/node-steam) 12 | - [node-csgo](https://github.com/joshuaferrara/node-csgo) 13 | -------------------------------------------------------------------------------- /accounts.example.txt: -------------------------------------------------------------------------------- 1 | username:password -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Steam = require('steam'); 4 | const Protos = require('./helpers/protos.js'); 5 | const SteamId = require('steamid'); 6 | const fs = require('fs'); 7 | const crypto = require('crypto'); 8 | const readline = require('readline-sync'); 9 | 10 | const accounts = fs.readFileSync('./accounts.txt', 'utf8').split('\n'); 11 | const steamId = new SteamId(readline.question('SteamID64: ')); 12 | const opt = readline.keyInSelect(['Report', 'Commend']); 13 | 14 | let matchId; 15 | if (opt === 0) 16 | matchId = readline.question('Match ID: '); 17 | 18 | if (steamId.isValid() && opt >= 0) { 19 | accounts.forEach(account => { 20 | if (!account) { 21 | return; 22 | } 23 | 24 | const client = new Steam.SteamClient(); 25 | const user = new Steam.SteamUser(client); 26 | const gc = new Steam.SteamGameCoordinator(client, 730); 27 | const friends = new Steam.SteamFriends(client); 28 | 29 | const param = account.split(':'); 30 | let login = { 31 | account_name: param[0], 32 | password: param[1].replace(/[\n\t\r]/g, '') 33 | }; 34 | 35 | let keepAlive; 36 | fs.access(`./sentry/${param[0]}`, fs.F_OK, err => { 37 | if (!err) { 38 | console.info(`[${param[0]}] Sentryfile found!`); 39 | login.sha_sentryfile = fs.readFileSync(`./sentry/${param[0]}`); 40 | } 41 | }); 42 | 43 | console.info(`[${param[0]}] Logging in...`); 44 | 45 | client.connect(); 46 | client.on('connected', () => { 47 | user.logOn(login); 48 | }); 49 | 50 | client.on('logOnResponse', res => { 51 | const eresult = res.eresult; 52 | 53 | if (eresult === Steam.EResult.OK) { 54 | console.info(`[${param[0]}] Logged in!`); 55 | 56 | friends.setPersonaState(Steam.EPersonaState.Offline); 57 | user.gamesPlayed({ 58 | games_played: [{ 59 | game_id: 730 60 | }] 61 | }); 62 | 63 | keepAlive = setInterval(() => { 64 | gc.send({ 65 | msg: 4006, 66 | proto: {} 67 | }, new Protos.CMsgClientHello({}).toBuffer()); 68 | }, 2000); 69 | } else if (eresult === Steam.EResult.AccountLoginDeniedNeedTwoFactor) { 70 | login.two_factor_code = readline.question(`[${param[0]}] Mobile auth code: `); 71 | client.disconnect(); 72 | client.connect(); 73 | } else if (eresult === Steam.EResult.AccountLogonDenied) { 74 | login.auth_code = readline.question(`[${param[0]}] Steam Guard code: `); 75 | client.disconnect(); 76 | client.connect(); 77 | } else { 78 | console.error(res); 79 | } 80 | }); 81 | 82 | user.on('updateMachineAuth', (data, next) => { 83 | function SHA1(bytes) { 84 | let shasum = crypto.createHash('sha1'); 85 | shasum.end(bytes); 86 | return shasum.read(); 87 | } 88 | 89 | if (!fs.existsSync('./sentry')) { 90 | fs.mkdirSync('./sentry'); 91 | } 92 | 93 | fs.writeFileSync(`./sentry/${param[0]}`, SHA1(data.bytes)); 94 | next({sha_file: SHA1(data.bytes)}); 95 | }); 96 | 97 | client.on('error', err => { 98 | console.error(`[${param[0]}] ${err}`); 99 | client.disconnect(); 100 | }); 101 | 102 | gc.on('message', (header, buffer) => { 103 | switch (header.msg) { 104 | case 4004: 105 | clearInterval(keepAlive); 106 | if (opt === 0) { 107 | report(gc, steamId, matchId, param[0]); 108 | } else if (opt === 1) { 109 | commend(gc, steamId, param[0]); 110 | } else { 111 | console.error('idk'); 112 | } 113 | break; 114 | case Protos.ECsgoGCMsg.k_EMsgGCCStrike15_v2_MatchmakingGC2ClientHello: 115 | break; 116 | case Protos.ECsgoGCMsg.k_EMsgGCCStrike15_v2_ClientReportResponse: 117 | const confirm = Protos.CMsgGCCStrike15_v2_ClientReportResponse.decode(buffer).confirmationId; 118 | if (confirm) { 119 | console.info(`[${param[0]}] Report confirmation ID: ${confirm.toString()}`); 120 | } else { 121 | console.info(`[${param[0]}] Commended.`) 122 | } 123 | client.disconnect(); 124 | break; 125 | default: 126 | console.info(header); 127 | break; 128 | } 129 | }); 130 | }); 131 | } else { 132 | console.error('Invalid input. Killing...'); 133 | } 134 | 135 | function report(gc, sid, matchid, user) { 136 | console.info(`[${user}] Reporting...`); 137 | 138 | let accountId = sid.accountid; 139 | if (matchid === null) 140 | matchid = 8; 141 | 142 | gc.send({ 143 | msg: Protos.ECsgoGCMsg.k_EMsgGCCStrike15_v2_ClientReportPlayer, 144 | proto: {} 145 | }, new Protos.CMsgGCCStrike15_v2_ClientReportPlayer({ 146 | accountId: accountId, 147 | matchId: matchid, 148 | rptAimbot: 2, 149 | rptWallhack: 3, 150 | rptSpeedhack: 4, 151 | rptTeamharm: 5, 152 | rptTextabuse: 6, 153 | rptVoiceabuse: 7 154 | }).toBuffer()); 155 | } 156 | 157 | function commend(gc, sid, user) { 158 | console.info(`[${user}] Commending...`); 159 | 160 | let accountId = sid.accountid; 161 | gc.send({ 162 | msg: Protos.ECsgoGCMsg.k_EMsgGCCStrike15_v2_ClientCommendPlayer, 163 | proto: {} 164 | }, new Protos.CMsgGCCStrike15_v2_ClientCommendPlayer({ 165 | accountId: accountId, 166 | matchId: 8, 167 | tokens: 10, 168 | commendation: new Protos.PlayerCommendationInfo({ 169 | cmdFriendly: 1, 170 | cmdTeaching: 2, 171 | cmdLeader: 4 172 | }) 173 | }).toBuffer()); 174 | } 175 | -------------------------------------------------------------------------------- /helpers/protos.js: -------------------------------------------------------------------------------- 1 | var Protobuf = require('protobufjs'); 2 | 3 | Protobuf.convertFieldsToCamelCase = true; 4 | 5 | var builder = Protobuf.newBuilder(); 6 | Protobuf.loadProtoFile(__dirname + '/../protos/base_gcmessages.proto', builder); 7 | Protobuf.loadProtoFile(__dirname + '/../protos/cstrike15_gcmessages.proto', builder); 8 | Protobuf.loadProtoFile(__dirname + '/../protos/gcsdk_gcmessages.proto', builder); 9 | 10 | module.exports = builder.build(); -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "report", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "app.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "start": "node app.js", 9 | "update": "node ./updater.js" 10 | }, 11 | "author": "", 12 | "license": "ISC", 13 | "dependencies": { 14 | "protobufjs": "^5.0.1", 15 | "readline-sync": "^1.4.4", 16 | "steam": "^1.4.0", 17 | "steamid": "^1.1.0" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /protos/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dank/node-csgorc/3f48cfc14f829caa124d6b9a74a4c843216b84f7/protos/.gitkeep -------------------------------------------------------------------------------- /updater.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | var https = require('https'); 3 | 4 | var baseUrl = 'https://raw.githubusercontent.com/SteamRE/SteamKit/master/Resources/Protobufs/csgo/'; 5 | var protos = [ 6 | 'base_gcmessages.proto', 7 | 'steammessages.proto', 8 | 'cstrike15_gcmessages.proto', 9 | 'gcsdk_gcmessages.proto', 10 | 'engine_gcmessages.proto' 11 | ]; 12 | 13 | fs.readdir('./protos', function(err, filenames) { 14 | if (err) { 15 | return err; 16 | } 17 | 18 | filenames.forEach(function(filename) { 19 | if (filename != 'protos.js' && filename != 'updater.js') { 20 | fs.unlinkSync('./protos/' + filename); 21 | } 22 | }); 23 | 24 | protos.forEach(function(proto) { 25 | var file = fs.createWriteStream('./protos/' + proto); 26 | https.get(baseUrl + proto, function(response) { 27 | response.pipe(file); 28 | }); 29 | }); 30 | }); --------------------------------------------------------------------------------