Advertisement
Krusher666

[leaks.ro] CS:GO Lobby Joiner | Written in C++

Apr 30th, 2017
6,438
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.99 KB | None | 0 0
  1. #include <Windows.h> //WinAPI functions and structures
  2.  
  3.  #include <iostream> // For standard c++ library (cout, etc)
  4.  #include <string>   // For standard c++ string manipulation
  5.  #include <sstream>  // For standard c++ string stream (string manipulation)
  6.  #include <fstream>  // For standard c++ file I/O (writing, reading, etc)
  7.  
  8.  #include <WinInet.h> // For internet usage, for DeleteUrlCacheEntryW function.
  9.  #include <urlmon.h>  // For downloading a file from url.
  10.  
  11.  #pragma comment(lib, "wininet.lib") // For linking against wininet.dll so we can use it's functions
  12.  #pragma comment(lib, "urlmon.lib")  // For linking against urlmon.dll so we can download files from url
  13.  
  14.  using std::cout; // This is better way than doing: using namespace std;
  15.  using std::cin;
  16.  using std::endl;
  17.  
  18.  int main()
  19.  {
  20.      std::string SteamProfileLink;
  21.      std::string FileName = "steamprofile.dat";
  22.      std::string SteamBuffer, LobbyId;
  23.      std::ifstream FileReader;
  24.  
  25.      cout << "Please Enter a Link to Target Steam Profile:";
  26.      cin >> SteamProfileLink; // save link to a string
  27.      cout << "Attempting to join a lobby..." << endl;
  28.      
  29.      DeleteUrlCacheEntryA(SteamProfileLink.c_str()); // Delete cache, so we wont download old data
  30.      HRESULT DownloadResult = URLDownloadToFileA(0, SteamProfileLink.c_str(), FileName.c_str(), 0, 0); // Download steam profile to file
  31.      if (SUCCEEDED(DownloadResult)) //Check if download was succesful
  32.      {
  33.          FileReader.open(FileName);
  34.          if (FileReader.is_open())
  35.          {
  36.              std::ostringstream FileBuffer; // Create stringstream
  37.              FileBuffer << FileReader.rdbuf(); // read file to that string stream
  38.              SteamBuffer = FileBuffer.str(); // store buffer to string
  39.              if (SteamBuffer.find("steam://joinlobby/730/") != std::string::npos) // Check if user is in lobby
  40.              {
  41.                  std::size_t LobbyIdStart, LobbyIdEnd;
  42.                  LobbyIdStart = SteamBuffer.find("steam://joinlobby/730/");
  43.                  if (LobbyIdStart != std::string::npos)
  44.                  {
  45.                      LobbyIdEnd = SteamBuffer.find("\"", LobbyIdStart);
  46.                      if (LobbyIdEnd != std::string::npos) {
  47.                          LobbyId = SteamBuffer.substr(LobbyIdStart, LobbyIdEnd - LobbyIdStart);
  48.                          cout << "Lobby ID is: " << LobbyId << endl;
  49.                          cout << "Joining lobby..." << endl;
  50.  
  51.                          ShellExecuteA(0, "open", LobbyId.c_str(), 0, 0, SW_SHOWNORMAL); // Join to the lobby
  52.                      }
  53.                  }
  54.              }
  55.              else {
  56.                  cout << "Error: User not in lobby!" << endl;
  57.              }
  58.          }
  59.          else {
  60.              cout << "Error: Failed to open downloaded file!" << endl;
  61.          }
  62.      }
  63.      else {
  64.          cout << "Error: Failed to download profile information!" << endl;
  65.      }
  66.      FileReader.close();
  67.      std::remove(FileName.c_str());
  68.      return 0;
  69.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement