1
mirror of https://github.com/rapid7/metasploit-payloads synced 2025-01-02 11:36:22 +01:00

Fix error response in packet_transmit_http

The response code from packet_transmit_http was hardcoded to always return ERROR_SUCCESS.

This fix emulates how errors are debug-printed and returned from server_transport_tcp and server_transport_pipe.
This commit is contained in:
guffre 2023-02-26 17:54:39 -06:00
parent 6d92de2b7e
commit 1c6241604d

View File

@ -290,7 +290,7 @@ static DWORD validate_response_winhttp(HANDLE hReq, HttpTransportContext* ctx)
*/
static DWORD packet_transmit_http(Remote *remote, LPBYTE rawPacket, DWORD rawPacketLength)
{
DWORD res = 0;
DWORD result = ERROR_SUCCESS;
HINTERNET hReq;
BOOL result;
DWORD retries = 5;
@ -303,26 +303,32 @@ static DWORD packet_transmit_http(Remote *remote, LPBYTE rawPacket, DWORD rawPac
hReq = ctx->create_req(ctx, FALSE, "PACKET TRANSMIT");
if (hReq == NULL)
{
result = GetLastError();
break;
}
result = ctx->send_req(ctx, hReq, rawPacket, rawPacketLength);
if (!result)
{
dprintf("[PACKET TRANSMIT] Failed HttpSendRequest: %d", GetLastError());
SetLastError(ERROR_NOT_FOUND);
result = GetLastError();
break;
}
dprintf("[PACKET TRANSMIT] request sent.. apparently");
} while(0);
if (result != ERROR_SUCCESS)
{
dprintf("[PACKET TRANSMIT] transmit request failed with return: %d", result);
}
else
{
dprintf("[PACKET TRANSMIT] request sent.. apparently");
}
ctx->close_req(hReq);
lock_release(remote->lock);
return res;
return result;
}
/*!