implemented guid check, for more reliable results from api.
This commit is contained in:
parent
88880ec14f
commit
c3074b6db6
@ -19,14 +19,16 @@ namespace Game
|
||||
((std::string*)userp)->append((char*)contents, size * nmemb);
|
||||
return size * nmemb;
|
||||
}
|
||||
std::string testcurl(std::string clientname)
|
||||
std::string testcurl(unsigned int clientguid)
|
||||
{
|
||||
std::string guidstring = std::to_string(clientguid);
|
||||
//std::cout << "guid string: " + guidstring + '\n';
|
||||
CURL* curl;
|
||||
CURLcode res;
|
||||
std::string readBuffer;
|
||||
curl = curl_easy_init();
|
||||
if (curl) {
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:1624/api/gsc/clientname/" + clientname);
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:1624/api/gsc/clientguid/" + guidstring);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
|
||||
/* example.com is redirected, so we tell libcurl to follow redirection */
|
||||
@ -46,13 +48,13 @@ namespace Game
|
||||
}
|
||||
return readBuffer;
|
||||
}
|
||||
std::string ClanTagRequest(std::string username)
|
||||
std::string ClanTagRequest(unsigned int clientguid)
|
||||
{
|
||||
std::string readBuffer;
|
||||
//const char* constClanTag;
|
||||
if (username.length() >= 3)
|
||||
if (clientguid != 0)
|
||||
{
|
||||
readBuffer = testcurl(username);
|
||||
readBuffer = testcurl(clientguid);
|
||||
}
|
||||
readBuffer.erase(std::remove(readBuffer.begin(), readBuffer.end(), '\n'), readBuffer.end());
|
||||
readBuffer.erase(std::remove(readBuffer.begin(), readBuffer.end(), '\r'), readBuffer.end());
|
||||
@ -67,7 +69,8 @@ namespace Game
|
||||
void clanTagChanger()
|
||||
{
|
||||
|
||||
|
||||
|
||||
unsigned int clientguid{};
|
||||
char emptyname[16]{};
|
||||
char currentname[16]{};
|
||||
std::string currentname_str;
|
||||
@ -77,25 +80,30 @@ namespace Game
|
||||
|
||||
|
||||
|
||||
int clientAddr{ 0x02347CD4 - 0x57F8 };
|
||||
int clanTagAddr{ 0x6C };
|
||||
int clientAddr{ 0x02347D10 - 0x57F8 };// check for client GUID instead of name
|
||||
int clientNameAddr{ 0x02347cd4 - 0x57F8 };
|
||||
int clanTagAddr{ 0x30 };
|
||||
int clientOffset{ 0x57F8 };
|
||||
|
||||
//loop through clients to get their name and current clan tag.
|
||||
for (int i = 1; i < 9; i++)
|
||||
{
|
||||
memcpy((void*)currentname, (void*)((clientAddr + (clientOffset * i))), 16);
|
||||
currentname_str = std::string(currentname, 16);
|
||||
memcpy(&clientguid, (void*)((clientAddr + (clientOffset * i))), 4);
|
||||
memcpy(¤tname, (void*)((clientNameAddr + (clientOffset * i))), 16);
|
||||
//currentname_str = std::string(currentname, 16);
|
||||
memcpy((void*)currentClanTag, (void*)(((clientAddr +(clientOffset * i)) + clanTagAddr)), 8);
|
||||
if ((strstr(currentClanTag, "Creator") == NULL) && (strstr(currentClanTag, "Admin") == NULL) && (strstr(currentClanTag, "SrAdmin") == NULL) && (strstr(currentClanTag, "Trusted") == NULL) && (strstr(currentClanTag, "Mod") == NULL) && (strstr(currentClanTag, "Owner") == NULL) && (strstr(currentClanTag, "3arc") == NULL) && (strncmp(currentname, emptyname, 16) != 0))
|
||||
//std::cout << "guid uint: " + clientguid << '\n';
|
||||
|
||||
//if ((strstr(currentClanTag, "Creator") == NULL) && (strstr(currentClanTag, "Admin") == NULL) && (strstr(currentClanTag, "SrAdmin") == NULL) && (strstr(currentClanTag, "Trusted") == NULL) && (strstr(currentClanTag, "Mod") == NULL) && (strstr(currentClanTag, "Owner") == NULL) && (strstr(currentClanTag, "3arc") == NULL) && (clientguid > 0) && (clientguid != NULL))
|
||||
if (!*currentClanTag && (clientguid > 0) && (clientguid != NULL))
|
||||
{
|
||||
changeClanTag_str = ClanTagRequest(currentname);
|
||||
changeClanTag_str = ClanTagRequest(clientguid);
|
||||
|
||||
changeClanTag = changeClanTag_str.c_str();
|
||||
if ((strstr(currentClanTag, changeClanTag) == NULL) || (strstr(changeClanTag, "Error: Client info is null") == NULL))
|
||||
{
|
||||
|
||||
if(!(changeClanTag_str.find("Error:") != std::string::npos) && !(changeClanTag_str.find("User") != std::string::npos))
|
||||
if(!(changeClanTag_str.find("Error:") != std::string::npos)) //&& !(changeClanTag_str.find("User") != std::string::npos))
|
||||
{
|
||||
std::cout << "ClanTag Rank: [" + changeClanTag_str + "]" + currentname + '\n';
|
||||
memcpy((void*)(clientAddr + (clientOffset * i) + clanTagAddr), changeClanTag, 8);
|
||||
|
Loading…
x
Reference in New Issue
Block a user