This commit is contained in:
BugisoftRSG 2023-08-09 16:25:40 +02:00
parent 466edec3a3
commit a5cafbd0ee
No known key found for this signature in database
GPG Key ID: 709B5D5A25866561
10 changed files with 193 additions and 15 deletions

View File

@ -80,8 +80,6 @@ string command::run(const string url, map<string, string> map)
}, },
cpr::Parameters{ params }); cpr::Parameters{ params });
cout << response.status_code << endl;
return response.text; return response.text;
} }

View File

@ -38,6 +38,28 @@ public:
virtual string execute(const vector<string>& args) = 0; virtual string execute(const vector<string>& args) = 0;
virtual SERVICE_TYPE get_service_type() = 0; virtual SERVICE_TYPE get_service_type() = 0;
inline string get_category()
{
switch (get_service_type())
{
case PROD_ROS:
return "prod.ros";
break;
case PROD_ROS_LAUNCHER:
return "prod.ros (launcher)";
break;
case PROD_SCAPI_AMC:
return "SCAPI";
break;
case PROD_CLOUD:
return "cloud";
break;
default:
return "unknown";
break;
}
}
static ROSCrypt* m_launcher_ros; static ROSCrypt* m_launcher_ros;
static ROSCrypt* m_ros; static ROSCrypt* m_ros;
}; };

View File

@ -110,7 +110,10 @@ class CreateTicket : command
} }
} }
string data = command::get(hash<string>()("getaccountinfo"))->execute({}); string data = "";
if (!TICKET.empty())
data = command::get(hash<string>()("getaccountinfo"))->execute({});
if (data.empty() || data.contains("Internal Server Error") || data.contains("AuthenticationFailed")) if (data.empty() || data.contains("Internal Server Error") || data.contains("AuthenticationFailed"))
{ {
cout << "Auth -> Cached session is no longer valid... recreating now." << endl; cout << "Auth -> Cached session is no longer valid... recreating now." << endl;

View File

@ -0,0 +1,26 @@
#include "../../../command.hpp"
#include <iostream>
class SearchCrew : command
{
using command::command;
SERVICE_TYPE get_service_type() { return SERVICE_TYPE::PROD_SCAPI_AMC; }
virtual string execute(const vector<string>& args)
{
map<string, string> map;
map["title"] = "gtav";
map["platform"] = "pc";
map["includeCommentCount"] = "false";
//map["searchTerm"] = "looping";
//map["sort"] = "membercount";
//map["dateRange"] = "any";
//map["pageSize"] = "1";
//map["crewtype"] = "rockstar";
return run("https://scapi.rockstargames.com/search/crew", map);
}
};
SearchCrew g_search_crew("searchcrew");

View File

@ -13,6 +13,12 @@ class SearchMission : command
map["title"] = "gtav"; map["title"] = "gtav";
map["platform"] = "pc"; map["platform"] = "pc";
map["includeCommentCount"] = "false"; map["includeCommentCount"] = "false";
map["searchTerm"] = "looping";
//map["sort"] = "date";
//map["dateRange"] = "any";
//map["creatorRockstarId"] = "12345678";
map["pageSize"] = "1";
//map["filter"] = "friends";
return run("https://scapi.rockstargames.com/search/mission", map); return run("https://scapi.rockstargames.com/search/mission", map);
} }

View File

@ -0,0 +1,30 @@
#include "../../../command.hpp"
#include <iostream>
class SearchPhoto : command
{
using command::command;
SERVICE_TYPE get_service_type() { return SERVICE_TYPE::PROD_SCAPI_AMC; }
virtual string execute(const vector<string>& args)
{
map<string, string> map;
map["title"] = "gtav";
map["platform"] = "pc";
map["includeCommentCount"] = "false";
//map["searchTerm"] = "looping";
//map["sort"] = "date";
//map["dateRange"] = "any";
//map["creatorRockstarId"] = "12345678";
//map["pageSize"] = "1";
//map["filter"] = "friends";
//map["regularPhoto"] = "true";
//map["selfie"] = "true";
//map["mugshot"] = "true";
return run("https://scapi.rockstargames.com/search/photo", map);
}
};
SearchPhoto g_search_photo("searchphoto");

View File

@ -0,0 +1,27 @@
#include "../../../command.hpp"
#include <iostream>
class SearchVideo : command
{
using command::command;
SERVICE_TYPE get_service_type() { return SERVICE_TYPE::PROD_SCAPI_AMC; }
virtual string execute(const vector<string>& args)
{
map<string, string> map;
map["title"] = "gtav";
map["platform"] = "pc";
map["includeCommentCount"] = "false";
//map["searchTerm"] = "looping";
//map["sort"] = "date";
//map["dateRange"] = "any";
//map["creatorRockstarId"] = "12345678";
//map["pageSize"] = "1";
//map["filter"] = "friends";
return run("https://scapi.rockstargames.com/search/video", map);
}
};
SearchVideo g_search_video("searchvideo");

View File

@ -0,0 +1,24 @@
#include "../../../command.hpp"
#include <iostream>
class MissionComments : command
{
using command::command;
SERVICE_TYPE get_service_type() { return SERVICE_TYPE::PROD_SCAPI_AMC; }
virtual string execute(const vector<string>& args)
{
cout << "Specify the contentId" << endl;
string contentId;
cin >> contentId;
map<string, string> map;
map["title"] = "gtav";
map["contentId"] = contentId;
return run("https://scapi.rockstargames.com/ugc/mission/comments", map);
}
};
MissionComments g_mission_comments("getmissioncomments");

View File

@ -0,0 +1,24 @@
#include "../../../command.hpp"
#include <iostream>
class MissionDetails : command
{
using command::command;
SERVICE_TYPE get_service_type() { return SERVICE_TYPE::PROD_SCAPI_AMC; }
virtual string execute(const vector<string>& args)
{
cout << "Specify the contentId" << endl;
string contentId;
cin >> contentId;
map<string, string> map;
map["title"] = "gtav";
map["contentId"] = contentId;
return run("https://scapi.rockstargames.com/ugc/mission/details", map);
}
};
MissionDetails g_mission_details("getmissiondetails");

View File

@ -114,11 +114,15 @@ int main()
SESSION_TICKET = string(session_ticket, 88); SESSION_TICKET = string(session_ticket, 88);
SESSION_KEY = Botan::base64_encode(reinterpret_cast<const Botan::byte*>(session_key), sizeof(session_key)); SESSION_KEY = Botan::base64_encode(reinterpret_cast<const Botan::byte*>(session_key), sizeof(session_key));
} }
else
{
cout << "GTA5.exe was not found... trying to use cached session.";
}
#endif #endif
cout << "Help:" << endl; cout << "Help:" << endl;
for (auto& it : g_commands) { for (auto& it : g_commands) {
cout << it.second->get_name() << endl; cout << it.second->get_category() << " - " << it.second->get_name() << endl;
} }
if (!TICKET.empty()) if (!TICKET.empty())
@ -126,29 +130,43 @@ int main()
cout << "Ticket " << TICKET << endl; cout << "Ticket " << TICKET << endl;
cout << "Session Ticket " << SESSION_TICKET << endl; cout << "Session Ticket " << SESSION_TICKET << endl;
cout << "Session Key " << SESSION_KEY << endl; cout << "Session Key " << SESSION_KEY << endl;
cout << "Enter the endpoint:" << endl;
cin >> ws >> endpoint;
} }
else else {
{ cout << "Do you want to proceed without session credentials? (y/n)" << endl;
string response = command::get(hash<string>()("createticket"))->execute({}); cout << "If so you are not able to use most of the prod.ros endpoints" << endl;
if (TICKET.length() > 20) string skipSessionCredentials;
cin >> skipSessionCredentials;
if (skipSessionCredentials != "y")
{ {
cout << "Ticket " << TICKET << endl; string _temp = command::get(hash<string>()("createticket"))->execute({});
cout << "Session Ticket " << SESSION_TICKET << endl;
cout << "Session Key " << SESSION_KEY << endl; if (TICKET.length() > 20)
{
cout << "Ticket " << TICKET << endl;
cout << "Session Ticket " << SESSION_TICKET << endl;
cout << "Session Key " << SESSION_KEY << endl;
}
} }
} }
cout << "Enter the endpoint:" << endl;
cin >> ws >> endpoint;
while (true) while (true)
{ {
transform(endpoint.begin(), endpoint.end(), endpoint.begin(), ::tolower); transform(endpoint.begin(), endpoint.end(), endpoint.begin(), ::tolower);
static command* command = command::get(hash<string>()(endpoint)); static command* command = command::get(hash<string>()(endpoint));
if (command) { if (command) {
cout << command->execute({ }) << endl; string response = command->execute({ });
if (command->get_service_type() == SERVICE_TYPE::PROD_SCAPI_AMC && response.starts_with("{") && response.ends_with("}"))
{
response = nlohmann::json::parse(response).dump(4);
}
cout << response << endl;
} }
cout << "Enter the endpoint:" << endl; cout << "Enter the endpoint:" << endl;
cin >> ws >> endpoint; cin >> ws >> endpoint;