Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5f7ab419b0 | |||
| 38b98bc3ab | |||
| fd0f55bd5e | |||
| 502a35357c | |||
| f3020200a0 | |||
| 492677d5bb | |||
| a325ee5fb5 | |||
| 2812d225cd | |||
| 603627bd33 |
@@ -13,6 +13,7 @@
|
|||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
#include <processthreadsapi.h>
|
#include <processthreadsapi.h>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
std::string randomizeString(size_t length)
|
std::string randomizeString(size_t length)
|
||||||
{
|
{
|
||||||
@@ -133,8 +134,11 @@ bool CertManager::GenerateCA()
|
|||||||
|
|
||||||
Log::info("Generated new CA key and certificate files. Installing to Windows Root CA store automatically...");
|
Log::info("Generated new CA key and certificate files. Installing to Windows Root CA store automatically...");
|
||||||
|
|
||||||
STARTUPINFOA si = {sizeof(si)};
|
STARTUPINFOA si;
|
||||||
|
memset(&si, 0, sizeof(si));
|
||||||
|
si.cb = sizeof(si);
|
||||||
PROCESS_INFORMATION pi;
|
PROCESS_INFORMATION pi;
|
||||||
|
memset(&pi, 0, sizeof(pi));
|
||||||
char cmd[] = "certutil.exe -user -addstore root ca_cert.pem";
|
char cmd[] = "certutil.exe -user -addstore root ca_cert.pem";
|
||||||
if (CreateProcessA(NULL, cmd, NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi))
|
if (CreateProcessA(NULL, cmd, NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -534,10 +534,6 @@ void Proxy::handleClient(SOCKET hClientSocket)
|
|||||||
if (!pendingUrls.empty()) pendingUrls.pop_front();
|
if (!pendingUrls.empty()) pendingUrls.pop_front();
|
||||||
|
|
||||||
std::string respHeaders = serverStream.buffer.substr(0, bStart);
|
std::string respHeaders = serverStream.buffer.substr(0, bStart);
|
||||||
size_t firstSpace = respHeaders.find(' ');
|
|
||||||
int sc =
|
|
||||||
(firstSpace != std::string::npos) ? safe_stoi(respHeaders.substr(firstSpace + 1, 3)) : 0;
|
|
||||||
|
|
||||||
OnServerResponse.run(url, body, respHeaders);
|
OnServerResponse.run(url, body, respHeaders);
|
||||||
|
|
||||||
removeHeader(respHeaders, "Transfer-Encoding");
|
removeHeader(respHeaders, "Transfer-Encoding");
|
||||||
|
|||||||
+69
-54
@@ -33,6 +33,11 @@ void Spoofer::registerListeners(Proxy* proxy)
|
|||||||
proxy->OnServerResponse.addListener([this](const std::string& url, std::string& body, std::string& respHeaders) {
|
proxy->OnServerResponse.addListener([this](const std::string& url, std::string& body, std::string& respHeaders) {
|
||||||
this->serverResponseHandler(url, body, respHeaders);
|
this->serverResponseHandler(url, body, respHeaders);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
proxy->OnClientRequest.addListener(
|
||||||
|
[this](const std::string& url, const std::string& body, std::string& reqHeaders) {
|
||||||
|
this->clientRequestHandler(url, body, reqHeaders);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Spoofer::loadData()
|
void Spoofer::loadData()
|
||||||
@@ -259,7 +264,7 @@ void Spoofer::modifyCharacterData(json& js)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Spoofer::serverResponseHandler(const std::string& url, std::string& body, std::string& /*respHeaders*/)
|
void Spoofer::serverResponseHandler(const std::string& url, std::string& body, std::string& respHeaders)
|
||||||
{
|
{
|
||||||
if (url.find("bhvrdbd.com") != std::string::npos) Log::verbose("BHVR api res @ {}", url);
|
if (url.find("bhvrdbd.com") != std::string::npos) Log::verbose("BHVR api res @ {}", url);
|
||||||
|
|
||||||
@@ -278,14 +283,6 @@ void Spoofer::serverResponseHandler(const std::string& url, std::string& body, s
|
|||||||
std::unordered_set<std::string> foundOfferings;
|
std::unordered_set<std::string> foundOfferings;
|
||||||
std::unordered_set<std::string> foundCatalogItems;
|
std::unordered_set<std::string> foundCatalogItems;
|
||||||
|
|
||||||
//std::unordered_set<std::string> objectIds;
|
|
||||||
//objectIds.insert(_camperItemIds.begin(), _camperItemIds.end());
|
|
||||||
//objectIds.insert(_slasherPowerIds.begin(), _slasherPowerIds.end());
|
|
||||||
|
|
||||||
//std::unordered_set<std::string> addonIds;
|
|
||||||
//addonIds.insert(_camperAddonIds.begin(), _camperAddonIds.end());
|
|
||||||
//addonIds.insert(_slasherAddonIds.begin(), _slasherAddonIds.end());
|
|
||||||
|
|
||||||
std::unordered_set<std::string> offeringIds;
|
std::unordered_set<std::string> offeringIds;
|
||||||
offeringIds.insert(_camperOfferingIds.begin(), _camperOfferingIds.end());
|
offeringIds.insert(_camperOfferingIds.begin(), _camperOfferingIds.end());
|
||||||
offeringIds.insert(_slasherOfferingIds.begin(), _slasherOfferingIds.end());
|
offeringIds.insert(_slasherOfferingIds.begin(), _slasherOfferingIds.end());
|
||||||
@@ -302,20 +299,6 @@ void Spoofer::serverResponseHandler(const std::string& url, std::string& body, s
|
|||||||
{
|
{
|
||||||
std::string objectId = item["objectId"];
|
std::string objectId = item["objectId"];
|
||||||
|
|
||||||
/*if (objectIds.find(objectId) != objectIds.end())
|
|
||||||
{
|
|
||||||
foundObjects.insert(objectId);
|
|
||||||
item["quantity"] = 100;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (addonIds.find(objectId) != addonIds.end())
|
|
||||||
{
|
|
||||||
foundAddons.insert(objectId);
|
|
||||||
item["quantity"] = 100;
|
|
||||||
continue;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
if (perkIds.find(objectId) != perkIds.end())
|
if (perkIds.find(objectId) != perkIds.end())
|
||||||
{
|
{
|
||||||
foundPerks.insert(objectId);
|
foundPerks.insert(objectId);
|
||||||
@@ -337,30 +320,6 @@ void Spoofer::serverResponseHandler(const std::string& url, std::string& body, s
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*for (const std::string& id : objectIds)
|
|
||||||
{
|
|
||||||
if (foundObjects.find(id) == foundObjects.end())
|
|
||||||
{
|
|
||||||
itemsArr.push_back({
|
|
||||||
{"objectId", id},
|
|
||||||
{"quantity", 100},
|
|
||||||
{"lastUpdateAt", std::time(nullptr)},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const std::string& id : addonIds)
|
|
||||||
{
|
|
||||||
if (foundAddons.find(id) == foundAddons.end())
|
|
||||||
{
|
|
||||||
itemsArr.push_back({
|
|
||||||
{"objectId", id},
|
|
||||||
{"quantity", 100},
|
|
||||||
{"lastUpdateAt", std::time(nullptr)},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
for (const std::string& id : perkIds)
|
for (const std::string& id : perkIds)
|
||||||
{
|
{
|
||||||
if (foundPerks.find(id) == foundPerks.end())
|
if (foundPerks.find(id) == foundPerks.end())
|
||||||
@@ -423,11 +382,19 @@ void Spoofer::serverResponseHandler(const std::string& url, std::string& body, s
|
|||||||
|
|
||||||
for (auto& charInfo : charList)
|
for (auto& charInfo : charList)
|
||||||
{
|
{
|
||||||
charInfo["isEntitled"] = true;
|
if (charInfo["isEntitled"] == false)
|
||||||
if (charInfo.contains("bloodWebLevel") && charInfo["bloodWebLevel"] <= 1)
|
|
||||||
{
|
{
|
||||||
charInfo["bloodWebLevel"] = 15;
|
charInfo["isEntitled"] = true;
|
||||||
if (charInfo["bloodWebData"].contains("level")) charInfo["bloodWebData"]["level"] = 1;
|
if (charInfo.contains("bloodWebLevel")) charInfo["bloodWebLevel"] = 15;
|
||||||
|
if (charInfo.contains("bloodWebData")) charInfo["bloodWebData"]["level"] = 1;
|
||||||
|
if (charInfo.contains("origin"))
|
||||||
|
{
|
||||||
|
charInfo["purchaseInfo"] = {{"quantity", 1},
|
||||||
|
{"origin", "PlayerInventory"},
|
||||||
|
{"reason", "Item(s) added via Purchase"},
|
||||||
|
{"lastUpdateAt", 1770702482},
|
||||||
|
{"objectId", charInfo["characterName"]}};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
modifyCharacterData(charInfo);
|
modifyCharacterData(charInfo);
|
||||||
@@ -446,8 +413,36 @@ void Spoofer::serverResponseHandler(const std::string& url, std::string& body, s
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
json doc = json::parse(body);
|
json doc = json::parse(body);
|
||||||
modifyCharacterData(doc);
|
|
||||||
body = doc.dump();
|
if (body.find("NotAllowedException") != std::string::npos && body.find("not owned") != std::string::npos)
|
||||||
|
{
|
||||||
|
Log::info("Spoofing bloodweb error error for unowned character");
|
||||||
|
json mock;
|
||||||
|
mock["bloodWebLevelChanged"] = false;
|
||||||
|
mock["updatedWallets"] = json::array();
|
||||||
|
mock["bloodWebLevel"] = 15;
|
||||||
|
mock["prestigeLevel"] = 0;
|
||||||
|
mock["bloodWebData"] = {{"ringData", json::array()}, {"paths", json::array()}};
|
||||||
|
mock["characterItems"] = json::array();
|
||||||
|
mock["characterName"] = this->_lastBloodWebChar;
|
||||||
|
|
||||||
|
modifyCharacterData(mock);
|
||||||
|
|
||||||
|
size_t firstSpace = respHeaders.find(' ');
|
||||||
|
if (firstSpace != std::string::npos)
|
||||||
|
{
|
||||||
|
respHeaders.replace(firstSpace + 1, 3, "200");
|
||||||
|
}
|
||||||
|
|
||||||
|
body = mock.dump();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
modifyCharacterData(doc);
|
||||||
|
body = doc.dump();
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
catch (const json::parse_error& e)
|
catch (const json::parse_error& e)
|
||||||
{
|
{
|
||||||
@@ -455,4 +450,24 @@ void Spoofer::serverResponseHandler(const std::string& url, std::string& body, s
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Spoofer::clientRequestHandler(const std::string& url, const std::string& body, std::string& /*reqHeaders*/)
|
||||||
|
{
|
||||||
|
if (url.find("api/v1/dbd-character-data/bloodweb") != std::string::npos ||
|
||||||
|
url.find("api/v1/dbd-character-data/bulk-spending-bloodweb") != std::string::npos)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
json req = json::parse(body);
|
||||||
|
if (req.contains("characterName"))
|
||||||
|
{
|
||||||
|
this->_lastBloodWebChar = req["characterName"];
|
||||||
|
Log::info("Detected bloodweb request for character: {}", this->_lastBloodWebChar);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ class Spoofer
|
|||||||
void modifyCharacterData(nlohmann::json& js);
|
void modifyCharacterData(nlohmann::json& js);
|
||||||
|
|
||||||
void serverResponseHandler(const std::string& url, std::string& body, std::string& respHeaders);
|
void serverResponseHandler(const std::string& url, std::string& body, std::string& respHeaders);
|
||||||
|
void clientRequestHandler(const std::string& url, const std::string& body, std::string& reqHeaders);
|
||||||
|
|
||||||
std::unordered_set<std::string> _camperItemIds;
|
std::unordered_set<std::string> _camperItemIds;
|
||||||
std::unordered_set<std::string> _slasherPowerIds;
|
std::unordered_set<std::string> _slasherPowerIds;
|
||||||
@@ -37,4 +38,6 @@ class Spoofer
|
|||||||
|
|
||||||
std::unordered_set<std::string> _catalogOutfitIds;
|
std::unordered_set<std::string> _catalogOutfitIds;
|
||||||
std::unordered_set<std::string> _catalogItemIds;
|
std::unordered_set<std::string> _catalogItemIds;
|
||||||
|
|
||||||
|
std::string _lastBloodWebChar = "Ace";
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user