Compare commits

..

6 Commits

Author SHA1 Message Date
neru 502a35357c fix: remove unused variable
Build / build (push) Failing after 2m45s
2026-03-21 23:59:00 -03:00
neru f3020200a0 fix: use zeromemory for initialization (wtf)
Build / build (push) Failing after 2m36s
2026-03-21 23:55:28 -03:00
neru 492677d5bb fix: add workaround for bloodpoint error
Build / build (push) Failing after 2m26s
2026-03-21 23:50:53 -03:00
neru a325ee5fb5 fix: empty initialization 2026-03-21 23:45:36 -03:00
neru 2812d225cd style: remove even more deprecated code 2026-03-21 23:37:57 -03:00
neru 603627bd33 style: remove deprecated code 2026-03-21 23:37:43 -03:00
4 changed files with 65 additions and 54 deletions
+5 -1
View File
@@ -13,6 +13,7 @@
#include <ctime>
#include <processthreadsapi.h>
#include <cstring>
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...");
STARTUPINFOA si = {sizeof(si)};
STARTUPINFOA si;
memset(&si, 0, sizeof(si));
si.cb = sizeof(si);
PROCESS_INFORMATION pi;
memset(&pi, 0, sizeof(pi));
char cmd[] = "certutil.exe -user -addstore root ca_cert.pem";
if (CreateProcessA(NULL, cmd, NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi))
{
-3
View File
@@ -535,9 +535,6 @@ void Proxy::handleClient(SOCKET hClientSocket)
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);
removeHeader(respHeaders, "Transfer-Encoding");
+57 -50
View File
@@ -33,6 +33,11 @@ void Spoofer::registerListeners(Proxy* proxy)
proxy->OnServerResponse.addListener([this](const std::string& url, std::string& body, std::string& 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()
@@ -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);
@@ -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> 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;
offeringIds.insert(_camperOfferingIds.begin(), _camperOfferingIds.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"];
/*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())
{
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)
{
if (foundPerks.find(id) == foundPerks.end())
@@ -446,8 +405,36 @@ void Spoofer::serverResponseHandler(const std::string& url, std::string& body, s
try
{
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)
{
@@ -455,4 +442,24 @@ void Spoofer::serverResponseHandler(const std::string& url, std::string& body, s
}
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 (...)
{
}
}
}
+3
View File
@@ -22,6 +22,7 @@ class Spoofer
void modifyCharacterData(nlohmann::json& js);
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> _slasherPowerIds;
@@ -37,4 +38,6 @@ class Spoofer
std::unordered_set<std::string> _catalogOutfitIds;
std::unordered_set<std::string> _catalogItemIds;
std::string _lastBloodWebChar = "Ace";
};