Advertisement
Guest User

Untitled

a guest
Jan 26th, 2019
2,001
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var Steam = require("steam"),
  2.     sleep = require('sleep');
  3.     util = require("util"),
  4.     fs = require("fs"),
  5.     csgo = require("csgo"),
  6.     bot = new Steam.SteamClient(),
  7.     steamUser = new Steam.SteamUser(bot),
  8.     steamFriends = new Steam.SteamFriends(bot),
  9.     steamGC = new Steam.SteamGameCoordinator(bot, 730),
  10.     CSGOCli = new csgo.CSGOClient(steamUser, steamGC, true),
  11.     crypto = require("crypto");
  12.  
  13. Steam.servers = JSON.parse(`[{"host":"155.133.242.9","port":27018},{"host":"185.25.180.15","port":27019},{"host":"185.25.180.15","port":27018},{"host":"185.25.180.14","port":27017},{"host":"185.25.180.15","port":27017},{"host":"155.133.242.9","port":27019},{"host":"155.133.242.9","port":27017},{"host":"185.25.180.14","port":27018},{"host":"185.25.180.14","port":27019},{"host":"155.133.242.8","port":27017},{"host":"155.133.242.8","port":27018},{"host":"155.133.242.8","port":27019},{"host":"162.254.197.40","port":27018},{"host":"155.133.248.50","port":27017},{"host":"155.133.248.51","port":27017},{"host":"162.254.196.68","port":27017},{"host":"162.254.197.41","port":27017},{"host":"162.254.196.67","port":27019},{"host":"155.133.248.53","port":27018},{"host":"155.133.248.52","port":27018},{"host":"162.254.196.67","port":27017},{"host":"162.254.196.67","port":27018},{"host":"162.254.196.83","port":27017},{"host":"162.254.196.84","port":27017},{"host":"155.133.248.52","port":27017},{"host":"162.254.196.68","port":27018},{"host":"162.254.197.40","port":27019},{"host":"155.133.248.51","port":27019},{"host":"155.133.248.52","port":27019},{"host":"155.133.248.53","port":27019},{"host":"155.133.248.50","port":27019},{"host":"155.133.248.53","port":27017},{"host":"162.254.196.68","port":27019},{"host":"162.254.197.42","port":27019},{"host":"162.254.196.84","port":27018},{"host":"155.133.248.50","port":27018},{"host":"162.254.196.83","port":27019},{"host":"162.254.197.42","port":27018},{"host":"162.254.197.41","port":27018},{"host":"162.254.196.84","port":27019},{"host":"162.254.196.83","port":27018},{"host":"162.254.197.40","port":27017},{"host":"162.254.197.41","port":27019},{"host":"155.133.248.51","port":27018},{"host":"162.254.197.42","port":27017},{"host":"146.66.152.11","port":27018},{"host":"146.66.152.11","port":27019},{"host":"146.66.152.11","port":27017},{"host":"146.66.152.10","port":27019},{"host":"146.66.152.10","port":27017},{"host":"146.66.152.10","port":27018},{"host":"208.78.164.10","port":27018},{"host":"208.78.164.9","port":27019},{"host":"208.78.164.13","port":27018},{"host":"208.78.164.9","port":27017},{"host":"208.78.164.12","port":27018},{"host":"208.78.164.10","port":27017},{"host":"155.133.229.251","port":27019},{"host":"155.133.229.251","port":27017},{"host":"208.78.164.14","port":27018},{"host":"208.78.164.12","port":27019},{"host":"208.78.164.13","port":27017},{"host":"208.78.164.9","port":27018},{"host":"208.78.164.14","port":27019},{"host":"208.78.164.11","port":27018},{"host":"208.78.164.10","port":27019},{"host":"155.133.229.250","port":27017},{"host":"208.78.164.12","port":27017},{"host":"208.78.164.11","port":27019},{"host":"155.133.229.250","port":27018},{"host":"155.133.229.251","port":27018},{"host":"208.78.164.11","port":27017},{"host":"155.133.229.250","port":27019},{"host":"208.78.164.13","port":27019},{"host":"208.78.164.14","port":27017},{"host":"162.254.193.7","port":27017},{"host":"162.254.193.47","port":27019},{"host":"162.254.193.7","port":27018},{"host":"162.254.193.46","port":27018},{"host":"162.254.193.6","port":27017}]`);
  14.  
  15. /* Decoding Share Codes */
  16. var scDecoder = new csgo.SharecodeDecoder("CSGO-U6MWi-hYFWJ-opPwD-JciHm-qOijD");
  17. //console.log("Sharecode CSGO-U6MWi-hYFWJ-opPwD-JciHm-qOijD decodes into: ");
  18. //console.log(scDecoder.decode());
  19.  
  20. function MakeSha(bytes) {
  21.     var hash = crypto.createHash('sha1');
  22.     hash.update(bytes);
  23.     return hash.digest();
  24. }
  25.  
  26. var onSteamLogOn = function onSteamLogOn(response){
  27.         // online gehen und namen setzen
  28.         steamFriends.setPersonaState(Steam.EPersonaState.Online);
  29.         steamFriends.setPersonaName("OnlineGamingUnited.de");
  30.         //util.log("Bot Current SteamID64: " + bot.steamID);
  31.         // util.log("Bot Account ID: " + CSGOCli.ToAccountID(bot.steamID));
  32.  
  33.         steamFriends.on('clanState', function(clanState) {
  34.             if (clanState.announcements.length) {
  35.                 console.log('Group with SteamID ' + clanState.steamid_clan + ' has posted ' + clanState.announcements[0].headline);
  36.             }
  37.         });
  38.  
  39.         steamFriends.on('message', function(source, message, type, chatter) {
  40.             console.log("Message from "+source+": "+message);
  41.             // respond to both chat room and private messages
  42.             if (message == '!help') {
  43.                 steamFriends.sendMessage(source, 'Gib einen der folgenden Befehle hier im Chat ein:', Steam.EChatEntryType.ChatMsg); // ChatMsg by default
  44.                 steamFriends.sendMessage(source, '!help: Zeigt dir diese Hilfe an.', Steam.EChatEntryType.ChatMsg); // ChatMsg by default
  45.                 steamFriends.sendMessage(source, '!play <game>: Start die Mitspielersuche für das Spiel <game>', Steam.EChatEntryType.ChatMsg); // ChatMsg by default
  46.                 steamFriends.sendMessage(source, '!games: Zeigt die Liste an verfügbaren Spielen', Steam.EChatEntryType.ChatMsg); // ChatMsg by default
  47.                 steamFriends.sendMessage(source, '!stfu: Muted den Bot für zwei Stunden (nochmal !stfu schreiben zum vorzeitigen entmuten)', Steam.EChatEntryType.ChatMsg); // ChatMsg by default
  48.             }
  49.         });
  50.  
  51.         if (response.eresult == Steam.EResult.OK) {
  52.             //util.log('#### Logged in into Steam! ####');
  53.         }
  54.         else
  55.         {
  56.             util.log('######### ERROR logging in into Steam ####, ', response);
  57.             process.exit();
  58.         }
  59.  
  60.         //steamFriends.addFriend("76561197960370859");
  61.  
  62.         // CS starten
  63.         CSGOCli.launch();
  64.  
  65.         steamUser.on("lobbyInvite", function(steamID, inviterID, lobbyID) {
  66.             util.log("LOBBY INVITE");
  67.             util.log("inviterID"+inviterID);
  68.             util.log("lobbyID"+lobbyID);
  69.             //util.log(steamID);
  70.         });
  71.  
  72.  
  73.         CSGOCli.on("ready", function() {
  74.  
  75.             steamUser.on("lobbyInvite", function(steamID, inviterID, lobbyID) {
  76.                 util.log("LOBBY INVITE");
  77.                 util.log("inviterID"+inviterID);
  78.                 util.log("lobbyID"+lobbyID);
  79.                 //util.log(steamID);
  80.             });
  81.             // GOOSE: 76561197961048988
  82.             // Eckel: 76561197992574513
  83.             // EFF: 76561197960370859
  84.             // bot.steamID
  85.  
  86.            /* CSGOCli.playerProfileRequest(CSGOCli.ToAccountID("76561197961048988"));
  87.             sleep.sleep(2);
  88.             CSGOCli.playerProfileRequest(CSGOCli.ToAccountID("76561197992574513"));
  89.             sleep.sleep(2);
  90.             CSGOCli.playerProfileRequest(CSGOCli.ToAccountID("76561197960370859"));
  91.             sleep.sleep(2);
  92.             CSGOCli.playerProfileRequest(CSGOCli.ToAccountID(bot.steamID));
  93.             sleep.sleep(2);*/
  94.  
  95.             CSGOCli.on("playerProfile", function(profile) {
  96.                 console.log("Player Rank: " + CSGOCli.Rank.getString(profile.account_profiles[0].ranking.rank_id))
  97.                 /*console.log(JSON.stringify(profile, null, 2));*/
  98.             });
  99.  
  100.             //CSGOCli.matchmakingStatsRequest();
  101.             CSGOCli.on("matchmakingStatsData", function(matchmakingStatsResponse) {
  102.                 util.log("Avg. Wait Time: " + matchmakingStatsResponse.global_stats.search_time_avg);
  103.  
  104.                 //CSGOCli.requestRecentGames();
  105.                 CSGOCli.on("matchList", function(list) {
  106.                     //console.log("Match List");
  107.                     if (list.matches && list.matches.length > 0) {
  108.                        // console.log(list.matches[0]);
  109.                     }
  110.                 });
  111. /*
  112.                 CSGOCli.richPresenceUpload({
  113.                     RP: {
  114.                         status: "Hello World!", // Sets rich presence text to "Hello World!"
  115.                         version: 13508, // Not sure what this value does
  116.                         time: 161.164087, // This might be the amount of time since you have started the game, not sure.
  117.                         "game:state": "lobby",
  118.                         steam_display: "#display_Lobby",
  119.                         connect: "+gcconnectG082AA752",
  120.                         "game:mode": "casual"
  121.                     }
  122.                 });
  123.  
  124.                  steam://rungame/730/76561202255233023/+csgo_econ_action_preview%20S76561198084749846A6768147729D12557175561287951743
  125.                 CSGOCli.itemDataRequest("76561198084749846", "6768147729", "12557175561287951743", "0");
  126.  
  127.                 CSGOCli.on("itemData", function(itemdata) {
  128.                     //console.log(itemdata);
  129.                 });*/
  130.             });
  131.         });
  132.  
  133.         steamUser.on("unready", function onUnready(){
  134.             //util.log("node-csgo unready.");
  135.         });
  136.     },
  137.     onSteamSentry = function onSteamSentry(sentry) {
  138.         util.log("Received sentry.");
  139.         require('fs').writeFileSync('sentry', sentry);
  140.     }
  141.  
  142. var username = "USERNAME";
  143. var password = "PW";
  144. var authCode = "";
  145.  
  146. var logOnDetails = {
  147.     "account_name": username,
  148.     "password": password,
  149. };
  150. if (authCode !== "") {
  151.     logOnDetails.auth_code = authCode;
  152. }
  153. var sentry = fs.readFileSync('sentry');
  154. if (sentry.length) {
  155.     logOnDetails.sha_sentryfile = MakeSha(sentry);
  156. }
  157. bot.connect();
  158. steamUser.on('updateMachineAuth', function(response, callback){
  159.     fs.writeFileSync('sentry', response.bytes);
  160.     callback({ sha_file: MakeSha(response.bytes) });
  161. });
  162. bot.on("logOnResponse", onSteamLogOn)
  163.     .on('sentry', onSteamSentry)
  164.     .on('connected', function(){
  165.         steamUser.logOn(logOnDetails);
  166.     });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement