Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/external/source/passivex/HttpTunnel.h
Views: 11766
/*1* This file is part of the Metasploit Exploit Framework2* and is subject to the same licenses and copyrights as3* the rest of this package.4*/5#ifndef _PASSIVEX_HTTPTUNNEL_H6#define _PASSIVEX_HTTPTUNNEL_H78#define PASSIVEX_URI_SECOND_STAGE TEXT("/stage")9#define PASSIVEX_URI_TUNNEL_IN TEXT("/tunnel_in")10#define PASSIVEX_URI_TUNNEL_OUT TEXT("/tunnel_out")1112#define PROFILE_CHECKPOINT(x) \13CPassiveX::Log("%s:%d:%lu: %s\n", __FILE__, __LINE__, GetTickCount(), x)141516/*17* This class is responsible for managing the HTTP tunnel between a target host18* and the local machine.19*/20class HttpTunnel21{22public:23HttpTunnel();24~HttpTunnel();2526// Initialization27DWORD Start(28IN LPSTR HttpHost,29IN LPSTR HttpUriBase,30IN LPSTR HttpSid,31IN USHORT HttpPort);32DWORD Stop();33protected:34// Internal Initialization35DWORD InitializeLocalConnection();3637// Second stage loader38VOID DownloadSecondStage();3940// Data transmission41DWORD TransmitToRemote(42IN PUCHAR Buffer,43IN ULONG BufferSize);44DWORD TransmitToLocal(45IN PUCHAR Buffer,46IN ULONG BufferSize);4748DWORD TransmitHttpRequest(49IN LPTSTR Method,50IN LPTSTR Uri,51IN PVOID RequestPayload = NULL,52IN ULONG RequestPayloadLength = 0,53IN ULONG WaitResponseTimeout = 0,54OUT LPDWORD ResponseCode = NULL,55OUT PVOID *ResponsePayload = NULL,56OUT LPDWORD ResponsePayloadLength = NULL);5758// Thread functions59static ULONG SendThreadFuncSt(60IN HttpTunnel *Tunnel);61ULONG SendThreadFunc();62static ULONG ReceiveThreadFuncSt(63IN HttpTunnel *Tunnel);64ULONG ReceiveThreadFunc();6566static ULONG SecondStageThreadFuncSt(67IN HttpTunnel *Tunnel);6869/**************70* Attributes *71**************/7273// Remote host information74LPSTR HttpHost;75LPSTR HttpUriBase;76LPSTR HttpSid;77USHORT HttpPort;7879// Sockets80WSADATA WsaData;81SOCKET LocalTcpListener;82SOCKET LocalTcpClientSide;83SOCKET LocalTcpServerSide;8485// Internet context86HINTERNET InternetHandle;8788// Stage attributes89PUCHAR SecondStage;90DWORD SecondStageSize;9192// Threads93HANDLE SendThread;94HANDLE ReceiveThread;95HANDLE SecondStageThread;96};9798#endif99100101