feat: make body editable on proxy client req listeners
This commit is contained in:
@@ -526,6 +526,11 @@ void Proxy::handleClient(SOCKET clientSocket)
|
|||||||
|
|
||||||
OnClientRequest.run(url, fullBody, headers);
|
OnClientRequest.run(url, fullBody, headers);
|
||||||
|
|
||||||
|
removeHeader(headers, "Transfer-Encoding");
|
||||||
|
removeHeader(headers, "Content-Length");
|
||||||
|
headers.insert(headers.size() - 2,
|
||||||
|
"Content-Length: " + std::to_string(fullBody.size()) + "\r\n");
|
||||||
|
|
||||||
SSL_write(remoteSSL.get(), headers.data(), (int)headers.size());
|
SSL_write(remoteSSL.get(), headers.data(), (int)headers.size());
|
||||||
SSL_write(remoteSSL.get(), fullBody.data(), (int)fullBody.size());
|
SSL_write(remoteSSL.get(), fullBody.data(), (int)fullBody.size());
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class Proxy
|
|||||||
bool init();
|
bool init();
|
||||||
void shutdown();
|
void shutdown();
|
||||||
|
|
||||||
CallbackEvent<std::string&, const std::string&, std::string&> OnClientRequest;
|
CallbackEvent<const std::string&, std::string&, std::string&> OnClientRequest;
|
||||||
CallbackEvent<const std::string&, std::string&, std::string&> OnServerResponse;
|
CallbackEvent<const std::string&, std::string&, std::string&> OnServerResponse;
|
||||||
|
|
||||||
void addWhitelistDomain(const std::string& domain);
|
void addWhitelistDomain(const std::string& domain);
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ void Spoofer::registerListeners(Proxy* proxy)
|
|||||||
this->serverResponseHandler(url, body, respHeaders);
|
this->serverResponseHandler(url, body, respHeaders);
|
||||||
});
|
});
|
||||||
|
|
||||||
proxy->OnClientRequest.addListener([this](std::string& url, const std::string& body, std::string& reqHeaders) {
|
proxy->OnClientRequest.addListener([this](const std::string& url, std::string& body, std::string& reqHeaders) {
|
||||||
this->clientRequestHandler(url, body, reqHeaders);
|
this->clientRequestHandler(url, body, reqHeaders);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class Spoofer
|
|||||||
void onBloodweb(std::string& body, std::string& respHeaders);
|
void onBloodweb(std::string& body, std::string& respHeaders);
|
||||||
|
|
||||||
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(std::string& url, const std::string& body, std::string& reqHeaders);
|
void clientRequestHandler(const std::string& url, std::string& body, std::string& reqHeaders);
|
||||||
|
|
||||||
SpooferConfig _config;
|
SpooferConfig _config;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user