From 0189e27fd98ad9a8ba9aacd1c5f715e56129167e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 14 Jun 2023 16:23:38 +0300 Subject: Steam: old shitty perversion migrated to the kernel MHttpRequest --- protocols/Steam/src/api/app_info.h | 6 ++-- protocols/Steam/src/api/authorization.h | 11 +++--- protocols/Steam/src/api/avatar.h | 2 +- protocols/Steam/src/api/captcha.h | 4 +-- protocols/Steam/src/api/friend.h | 6 ++-- protocols/Steam/src/api/friend_list.h | 59 ++++++++------------------------- protocols/Steam/src/api/history.h | 8 ++--- protocols/Steam/src/api/login.h | 8 ++--- protocols/Steam/src/api/message.h | 8 ++--- protocols/Steam/src/api/pending.h | 24 +++++++++----- protocols/Steam/src/api/poll.h | 6 ++-- protocols/Steam/src/api/rsa_key.h | 4 +-- protocols/Steam/src/api/search.h | 4 +-- protocols/Steam/src/api/session.h | 8 ++--- 14 files changed, 64 insertions(+), 94 deletions(-) (limited to 'protocols/Steam/src/api') diff --git a/protocols/Steam/src/api/app_info.h b/protocols/Steam/src/api/app_info.h index 7aeb26f9d4..b4c2618249 100644 --- a/protocols/Steam/src/api/app_info.h +++ b/protocols/Steam/src/api/app_info.h @@ -5,11 +5,9 @@ class GetAppInfoRequest : public HttpRequest { public: GetAppInfoRequest(const char *token, const char *appIds) : - HttpRequest(HttpGet, STEAM_API_URL "/ISteamGameOAuth/GetAppInfo/v0001") + HttpRequest(REQUEST_GET, STEAM_API_URL "/ISteamGameOAuth/GetAppInfo/v0001") { - Uri - << CHAR_PARAM("access_token", token) - << CHAR_PARAM("appIds", appIds); + this << CHAR_PARAM("access_token", token) << CHAR_PARAM("appIds", appIds); } //{ diff --git a/protocols/Steam/src/api/authorization.h b/protocols/Steam/src/api/authorization.h index b2ba2639c0..fdaec9920d 100644 --- a/protocols/Steam/src/api/authorization.h +++ b/protocols/Steam/src/api/authorization.h @@ -5,15 +5,14 @@ class AuthorizationRequest : public HttpRequest { public: AuthorizationRequest(const char *username, const char *password, const char *timestamp, const char *twoFactorCode, const char *guardCode, const char *guardId = "", const char *captchaId = "-1", const char *captchaText = "") : - HttpRequest(HttpPost, STEAM_WEB_URL "/mobilelogin/dologin/") + HttpRequest(REQUEST_POST, STEAM_WEB_URL "/mobilelogin/dologin/") { flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_NODUMP; - Headers - << CHAR_PARAM("Referer", STEAM_WEB_URL "/mobilelogin/dologin?oauth_client_id=3638BFB1&oauth_scope=read_profile%20write_profile%20read_client%20write_client") - << CHAR_PARAM("Cookie", "mobileClientVersion=1291812;forceMobile=1;mobileClient=ios"); + AddHeader("Referer", STEAM_WEB_URL "/mobilelogin/dologin?oauth_client_id=3638BFB1&oauth_scope=read_profile%20write_profile%20read_client%20write_client"); + AddHeader("Cookie", "mobileClientVersion=1291812;forceMobile=1;mobileClient=ios"); - Content = new FormUrlEncodedContent(this) + this << CHAR_PARAM("oauth_client_id", "3638BFB1") << CHAR_PARAM("loginfriendlyname", "Miranda NG") << CHAR_PARAM("password", password) @@ -24,7 +23,7 @@ public: << CHAR_PARAM("captchagid", captchaId) << CHAR_PARAM("captcha_text", captchaText) << CHAR_PARAM("rsatimestamp", timestamp) - << BOOL_PARAM("rememberlogin", false) + << INT_PARAM("rememberlogin", 0) << INT64_PARAM("donotcache", now()); } }; diff --git a/protocols/Steam/src/api/avatar.h b/protocols/Steam/src/api/avatar.h index 521536550e..28e573d9d1 100644 --- a/protocols/Steam/src/api/avatar.h +++ b/protocols/Steam/src/api/avatar.h @@ -5,7 +5,7 @@ class GetAvatarRequest : public HttpRequest { public: GetAvatarRequest(const char *url) : - HttpRequest(HttpGet, url) + HttpRequest(REQUEST_GET, url) { flags = NLHRF_HTTP11 | NLHRF_NODUMP; } diff --git a/protocols/Steam/src/api/captcha.h b/protocols/Steam/src/api/captcha.h index 0b8ba9191a..a4bacb59f7 100644 --- a/protocols/Steam/src/api/captcha.h +++ b/protocols/Steam/src/api/captcha.h @@ -5,11 +5,11 @@ class GetCaptchaRequest : public HttpRequest { public: GetCaptchaRequest(const char *captchaId) : - HttpRequest(HttpGet, STEAM_WEB_URL "/public/captcha.php") + HttpRequest(REQUEST_GET, STEAM_WEB_URL "/public/captcha.php") { flags = NLHRF_HTTP11 | NLHRF_NODUMP; - Uri << CHAR_PARAM("gid", captchaId); + this << CHAR_PARAM("gid", captchaId); } }; diff --git a/protocols/Steam/src/api/friend.h b/protocols/Steam/src/api/friend.h index 2f088a7e40..e6740e7151 100644 --- a/protocols/Steam/src/api/friend.h +++ b/protocols/Steam/src/api/friend.h @@ -5,11 +5,9 @@ class GetUserSummariesRequest : public HttpRequest { public: GetUserSummariesRequest(CSteamProto *ppro, const char *steamIds) : - HttpRequest(HttpGet, STEAM_API_URL "/ISteamUserOAuth/GetUserSummaries/v0002") + HttpRequest(REQUEST_GET, STEAM_API_URL "/ISteamUserOAuth/GetUserSummaries/v0002") { - Uri - << CHAR_PARAM("access_token", ppro->getMStringA("TokenSecret")) - << CHAR_PARAM("steamids", steamIds); + this << CHAR_PARAM("access_token", ppro->getMStringA("TokenSecret")) << CHAR_PARAM("steamids", steamIds); } //{ diff --git a/protocols/Steam/src/api/friend_list.h b/protocols/Steam/src/api/friend_list.h index c291f14b85..359423d359 100644 --- a/protocols/Steam/src/api/friend_list.h +++ b/protocols/Steam/src/api/friend_list.h @@ -5,31 +5,17 @@ class GetFriendListRequest : public HttpRequest { public: GetFriendListRequest(const char *token, const char *steamId, const char *relationship) : - HttpRequest(HttpGet, STEAM_API_URL "/ISteamUserOAuth/GetFriendList/v0001") + HttpRequest(REQUEST_GET, STEAM_API_URL "/ISteamUserOAuth/GetFriendList/v0001") { - Uri - << CHAR_PARAM("access_token", token) - << CHAR_PARAM("steamid", steamId) - << CHAR_PARAM("relationship", relationship); + this << CHAR_PARAM("access_token", token) << CHAR_PARAM("steamid", steamId) << CHAR_PARAM("relationship", relationship); } - - //{ - // "friends": [ - // { - // "steamid": "XXXXXXXXXXXXXXXXX", - // "relationship" : "friend", - // "friend_since" : 1514314629 - // } - // ] - //} - }; class AddFriendRequest : public HttpRequest { public: AddFriendRequest(const char *token, const char *sessionId, const char *steamId, const char *who) : - HttpRequest(HttpPost, STEAM_WEB_URL "/actions/AddFriendAjax") + HttpRequest(REQUEST_POST, STEAM_WEB_URL "/actions/AddFriendAjax") { char login[MAX_PATH]; mir_snprintf(login, "%s||oauth:%s", steamId, token); @@ -37,25 +23,17 @@ public: char cookie[MAX_PATH]; mir_snprintf(cookie, "steamLogin=%s;sessionid=%s;mobileClientVersion=1291812;forceMobile=1;mobileClient=ios", login, sessionId); - Headers << CHAR_PARAM("Cookie", cookie); + AddHeader("Cookie", cookie); - Content = new FormUrlEncodedContent(this) - << CHAR_PARAM("sessionID", sessionId) - << CHAR_PARAM("steamid", who); + this << CHAR_PARAM("sessionID", sessionId) << CHAR_PARAM("steamid", who); } - - // "true" - - // {"invited":["XXXXXXXXXXXXXXXXX"], "success" : 1} - - // {"failed_invites":["XXXXXXXXXXXXXXXXX"], "failed_invites_result" : [24], "success" : 1} }; class BlockFriendRequest : public HttpRequest { public: BlockFriendRequest(const char *token, const char *sessionId, const char *steamId, const char *who) : - HttpRequest(HttpPost, STEAM_WEB_URL "/actions/BlockUserAjax") + HttpRequest(REQUEST_POST, STEAM_WEB_URL "/actions/BlockUserAjax") { char login[MAX_PATH]; mir_snprintf(login, "%s||oauth:%s", steamId, token); @@ -63,12 +41,9 @@ public: char cookie[MAX_PATH]; mir_snprintf(cookie, "steamLogin=%s;sessionid=%s;mobileClientVersion=1291812;forceMobile=1;mobileClient=ios", login, sessionId); - Headers << CHAR_PARAM("Cookie", cookie); + AddHeader("Cookie", cookie); - Content = new FormUrlEncodedContent(this) - << CHAR_PARAM("sessionID", sessionId) - << CHAR_PARAM("steamid", who) - << CHAR_PARAM("action", "ignore"); + this << CHAR_PARAM("sessionID", sessionId) << CHAR_PARAM("steamid", who) << CHAR_PARAM("action", "ignore"); } }; @@ -76,7 +51,7 @@ class UnblockFriendRequest : public HttpRequest { public: UnblockFriendRequest(const char *token, const char *sessionId, const char *steamId, const char *who) : - HttpRequest(HttpPost, STEAM_WEB_URL "/actions/BlockUserAjax") + HttpRequest(REQUEST_POST, STEAM_WEB_URL "/actions/BlockUserAjax") { char login[MAX_PATH]; mir_snprintf(login, "%s||oauth:%s", steamId, token); @@ -84,13 +59,9 @@ public: char cookie[MAX_PATH]; mir_snprintf(cookie, "steamLogin=%s;sessionid=%s;mobileClientVersion=1291812;forceMobile=1;mobileClient=ios", login, sessionId); - Headers << CHAR_PARAM("Cookie", cookie); + AddHeader("Cookie", cookie); - Content = new FormUrlEncodedContent(this) - << CHAR_PARAM("sessionID", sessionId) - << CHAR_PARAM("steamid", who) - << CHAR_PARAM("action", "unignore") - << INT_PARAM("block", 0); + this << CHAR_PARAM("sessionID", sessionId) << CHAR_PARAM("steamid", who) << CHAR_PARAM("action", "unignore") << INT_PARAM("block", 0); } }; @@ -98,7 +69,7 @@ class RemoveFriendRequest : public HttpRequest { public: RemoveFriendRequest(const char *token, const char *sessionId, const char *steamId, const char *who) : - HttpRequest(HttpPost, STEAM_WEB_URL "/actions/RemoveFriendAjax") + HttpRequest(REQUEST_POST, STEAM_WEB_URL "/actions/RemoveFriendAjax") { char login[MAX_PATH]; mir_snprintf(login, "%s||oauth:%s", steamId, token); @@ -106,11 +77,9 @@ public: char cookie[MAX_PATH]; mir_snprintf(cookie, "steamLogin=%s;sessionid=%s;mobileClientVersion=1291812;forceMobile=1;mobileClient=ios", login, sessionId); - Headers << CHAR_PARAM("Cookie", cookie); + AddHeader("Cookie", cookie); - Content = new FormUrlEncodedContent(this) - << CHAR_PARAM("sessionID", sessionId) - << CHAR_PARAM("steamid", who); + this << CHAR_PARAM("sessionID", sessionId) << CHAR_PARAM("steamid", who); } }; diff --git a/protocols/Steam/src/api/history.h b/protocols/Steam/src/api/history.h index decbea87f0..290f2310df 100644 --- a/protocols/Steam/src/api/history.h +++ b/protocols/Steam/src/api/history.h @@ -5,9 +5,9 @@ class GetConversationsRequest : public HttpRequest { public: GetConversationsRequest(CSteamProto *ppro) : - HttpRequest(HttpGet, STEAM_API_URL "/IFriendMessagesService/GetActiveMessageSessions/v0001") + HttpRequest(REQUEST_GET, STEAM_API_URL "/IFriendMessagesService/GetActiveMessageSessions/v0001") { - Uri << CHAR_PARAM("access_token", ppro->getMStringA("TokenSecret")); + this << CHAR_PARAM("access_token", ppro->getMStringA("TokenSecret")); } //{ @@ -30,9 +30,9 @@ class GetHistoryMessagesRequest : public HttpRequest { public: GetHistoryMessagesRequest(const char *token, const char *steamId, const char *who, time_t since) : - HttpRequest(HttpGet, STEAM_API_URL "/IFriendMessagesService/GetRecentMessages/v0001") + HttpRequest(REQUEST_GET, STEAM_API_URL "/IFriendMessagesService/GetRecentMessages/v0001") { - Uri + this << CHAR_PARAM("access_token", token) << CHAR_PARAM("steamid1", steamId) << CHAR_PARAM("steamid2", who) diff --git a/protocols/Steam/src/api/login.h b/protocols/Steam/src/api/login.h index e061d4236c..d9511c4752 100644 --- a/protocols/Steam/src/api/login.h +++ b/protocols/Steam/src/api/login.h @@ -5,12 +5,12 @@ class LogonRequest : public HttpRequest { public: LogonRequest(const char *token) : - HttpRequest(HttpPost, STEAM_API_URL "/ISteamWebUserPresenceOAuth/Logon/v0001") + HttpRequest(REQUEST_POST, STEAM_API_URL "/ISteamWebUserPresenceOAuth/Logon/v0001") { char data[256]; mir_snprintf(data, "access_token=%s&ui_mode=web", token); - Content = new FormUrlEncodedContent(this) + this << CHAR_PARAM("access_token", token) << CHAR_PARAM("ui_mode", "web"); } @@ -31,9 +31,9 @@ class LogoffRequest : public HttpRequest { public: LogoffRequest(const char *token, const char *umqId) : - HttpRequest(HttpPost, STEAM_API_URL "/ISteamWebUserPresenceOAuth/Logoff/v0001") + HttpRequest(REQUEST_POST, STEAM_API_URL "/ISteamWebUserPresenceOAuth/Logoff/v0001") { - Content = new FormUrlEncodedContent(this) + this << CHAR_PARAM("access_token", token) << CHAR_PARAM("umqid", umqId); } diff --git a/protocols/Steam/src/api/message.h b/protocols/Steam/src/api/message.h index eee4c43b28..e07e70d959 100644 --- a/protocols/Steam/src/api/message.h +++ b/protocols/Steam/src/api/message.h @@ -5,9 +5,9 @@ class SendMessageRequest : public HttpRequest { public: SendMessageRequest(const char *token, const char *umqId, const char *steamId, const char *text) : - HttpRequest(HttpPost, STEAM_API_URL "/ISteamWebUserPresenceOAuth/Message/v0001") + HttpRequest(REQUEST_POST, STEAM_API_URL "/ISteamWebUserPresenceOAuth/Message/v0001") { - Content = new FormUrlEncodedContent(this) + this << CHAR_PARAM("access_token", token) << CHAR_PARAM("umqid", umqId) << CHAR_PARAM("steamid_dst", steamId) @@ -20,9 +20,9 @@ class SendTypingRequest : public HttpRequest { public: SendTypingRequest(const char *token, const char *umqId, const char *steamId) : - HttpRequest(HttpPost, STEAM_API_URL "/ISteamWebUserPresenceOAuth/Message/v0001") + HttpRequest(REQUEST_POST, STEAM_API_URL "/ISteamWebUserPresenceOAuth/Message/v0001") { - Content = new FormUrlEncodedContent(this) + this << CHAR_PARAM("access_token", token) << CHAR_PARAM("umqid", umqId) << CHAR_PARAM("steamid_dst", steamId) diff --git a/protocols/Steam/src/api/pending.h b/protocols/Steam/src/api/pending.h index 9aeed4e182..b8e8e6e15f 100644 --- a/protocols/Steam/src/api/pending.h +++ b/protocols/Steam/src/api/pending.h @@ -5,15 +5,17 @@ class ApprovePendingRequest : public HttpRequest { public: ApprovePendingRequest(const char *token, const char *sessionId, const char *steamId, const char *who) : - HttpRequest(HttpPost, FORMAT, STEAM_WEB_URL "/profiles/%s/home_process", steamId) + HttpRequest(REQUEST_POST, "") { + m_szUrl.Format(STEAM_WEB_URL "/profiles/%s/home_process", steamId); + char cookie[MAX_PATH]; mir_snprintf(cookie, "steamLogin=%s||oauth:%s;sessionid=%s;mobileClientVersion=1291812;forceMobile=1;mobileClient=ios", steamId, token, sessionId); - Headers << CHAR_PARAM("Cookie", cookie); + AddHeader("Cookie", cookie); - Content = new FormUrlEncodedContent(this) + this << CHAR_PARAM("sessionID", sessionId) << CHAR_PARAM("id", who) << CHAR_PARAM("perform", "accept") @@ -28,15 +30,17 @@ class IgnorePendingRequest : public HttpRequest { public: IgnorePendingRequest(const char *token, const char *sessionId, const char *steamId, const char *who) : - HttpRequest(HttpPost, FORMAT, STEAM_WEB_URL "/profiles/%s/home_process", steamId) + HttpRequest(REQUEST_POST, "") { + m_szUrl.Format(STEAM_WEB_URL "/profiles/%s/home_process", steamId); + char cookie[MAX_PATH]; mir_snprintf(cookie, "steamLogin=%s||oauth:%s;sessionid=%s;mobileClientVersion=1291812;forceMobile=1;mobileClient=ios", steamId, token, sessionId); - Headers << CHAR_PARAM("Cookie", cookie); + AddHeader("Cookie", cookie); - Content = new FormUrlEncodedContent(this) + this << CHAR_PARAM("sessionID", sessionId) << CHAR_PARAM("id", who) << CHAR_PARAM("perform", "ignore") @@ -51,15 +55,17 @@ class BlockPendingRequest : public HttpRequest { public: BlockPendingRequest(const char *token, const char *sessionId, const char *steamId, const char *who) : - HttpRequest(HttpPost, FORMAT, STEAM_WEB_URL "/profiles/%s/home_process", steamId) + HttpRequest(REQUEST_POST, "") { + m_szUrl.Format(STEAM_WEB_URL "/profiles/%s/home_process", steamId); + char cookie[MAX_PATH]; mir_snprintf(cookie, "steamLogin=%s||oauth:%s;sessionid=%s;mobileClientVersion=1291812;forceMobile=1;mobileClient=ios", steamId, token, sessionId); - Headers << CHAR_PARAM("Cookie", cookie); + AddHeader("Cookie", cookie); - Content = new FormUrlEncodedContent(this) + this << CHAR_PARAM("sessionID", sessionId) << CHAR_PARAM("id", who) << CHAR_PARAM("perform", "block") diff --git a/protocols/Steam/src/api/poll.h b/protocols/Steam/src/api/poll.h index a8f0ac3edb..9de2ed32d3 100644 --- a/protocols/Steam/src/api/poll.h +++ b/protocols/Steam/src/api/poll.h @@ -5,14 +5,14 @@ class PollRequest : public HttpRequest { public: PollRequest(CSteamProto *ppro) : - HttpRequest(HttpPost, STEAM_API_URL "/ISteamWebUserPresenceOAuth/Poll/v0001") + HttpRequest(REQUEST_POST, STEAM_API_URL "/ISteamWebUserPresenceOAuth/Poll/v0001") { timeout = (STEAM_API_TIMEOUT + 5) * 1000; // flags |= NLHRF_PERSISTENT; - Headers << CHAR_PARAM("Connection", "keep-alive"); + AddHeader("Connection", "keep-alive"); - Content = new FormUrlEncodedContent(this) + this << CHAR_PARAM("access_token", ppro->getMStringA("TokenSecret")) << CHAR_PARAM("umqid", ppro->getMStringA("UMQID")) << INT64_PARAM("message", ppro->getDword("MessageID")) diff --git a/protocols/Steam/src/api/rsa_key.h b/protocols/Steam/src/api/rsa_key.h index a0369f4db4..48c76e3e6d 100644 --- a/protocols/Steam/src/api/rsa_key.h +++ b/protocols/Steam/src/api/rsa_key.h @@ -5,11 +5,11 @@ class GetRsaKeyRequest : public HttpRequest { public: GetRsaKeyRequest(const char *username) : - HttpRequest(HttpPost, STEAM_WEB_URL "/mobilelogin/getrsakey/") + HttpRequest(REQUEST_POST, STEAM_WEB_URL "/mobilelogin/getrsakey/") { flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_NODUMP; - Content = new FormUrlEncodedContent(this) + this << CHAR_PARAM("username", username) << INT64_PARAM("donotcache", now()); } diff --git a/protocols/Steam/src/api/search.h b/protocols/Steam/src/api/search.h index 4484af4ba8..fd3c8a66f0 100644 --- a/protocols/Steam/src/api/search.h +++ b/protocols/Steam/src/api/search.h @@ -5,9 +5,9 @@ class SearchRequest : public HttpRequest { public: SearchRequest(const char *token, const char *text, int offset = 0, int count = 30) : - HttpRequest(HttpGet, STEAM_API_URL "/ISteamUserOAuth/Search/v0001") + HttpRequest(REQUEST_GET, STEAM_API_URL "/ISteamUserOAuth/Search/v0001") { - Uri + this << CHAR_PARAM("access_token", token) << CHAR_PARAM("keywords", text) << INT_PARAM("offset", offset) diff --git a/protocols/Steam/src/api/session.h b/protocols/Steam/src/api/session.h index dec2e0aa0a..00705c1b67 100644 --- a/protocols/Steam/src/api/session.h +++ b/protocols/Steam/src/api/session.h @@ -5,11 +5,11 @@ class GetSessionRequest : public HttpRequest { public: GetSessionRequest(const char *token, const char *steamId, const char *cookie) : - HttpRequest(HttpPost, STEAM_WEB_URL "/mobileloginsucceeded") + HttpRequest(REQUEST_POST, STEAM_WEB_URL "/mobileloginsucceeded") { flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_NODUMP; - Content = new FormUrlEncodedContent(this) + this << CHAR_PARAM("oauth_token", token) << CHAR_PARAM("steamid", steamId) << CHAR_PARAM("webcookie", cookie); @@ -27,14 +27,14 @@ class GetSessionRequest2 : public HttpRequest { public: GetSessionRequest2(const char *token, const char *steamId) : - HttpRequest(HttpGet, STEAM_WEB_URL "/mobilesettings/GetManifest/v0001") + HttpRequest(REQUEST_GET, STEAM_WEB_URL "/mobilesettings/GetManifest/v0001") { flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_NODUMPHEADERS; char cookie[MAX_PATH]; mir_snprintf(cookie, "steamLogin=%s||oauth:%s", steamId, token); - Headers << CHAR_PARAM("Cookie", cookie); + AddHeader("Cookie", cookie); } }; -- cgit v1.2.3