Whisper Library
|
A covert channel using tcp header fields. More...
Public Member Functions | |
TcpHeaderCovertChannel (function< void(string)> output, function< void(GenericPacket)> send) | |
Constructor. More... | |
CovertChannel * | instance () |
void | sendMessage (string message) |
void | receivePacket (GenericPacket &packet) |
void | setArguments (string arguments) |
configures the covert channel More... | |
void | setOutput (function< void(string)> output) |
sets the output method More... | |
void | setSend (function< void(GenericPacket)> send) |
sets the methode used to send packets | |
void | initialize () |
Initializes the covert channel. Is called after construction. | |
string | name () const |
string | info () const |
string | protocol () const |
unsigned short | port () const |
std::string | id () const |
![]() | |
CovertChannel () | |
Creates a CovertChannel. | |
virtual | ~CovertChannel () |
Destructor. More... | |
virtual void | sendMessage (std::string message)=0 |
sends a message More... | |
Private Member Functions | |
vector< bitset< 3 > > | encodeMessageWithLength (string message) |
void | modifyTcpPacket (TcpPacket &packet, bitset< 3 > data) |
bitset< 3 > | extractData (TcpPacket &packet) |
Private Attributes | |
vector< bitset< 3 > > | m_data_blocks |
This vector stores the bit blocks we received in the current communication. | |
int | m_remaining_packets |
BitSetCoder< 3 > | m_coder |
The encoder/decoder we use, to split messages into bit blocks. | |
TcpPacketGenerator * | m_generator |
A TcpPacketGenerator acting as client used for sending messages. | |
function< void(string)> | m_output |
callback function pointer that is used to return received messages as a string | |
function< void(GenericPacket)> | m_send |
function pointer that is used to send Tcp Packets via the socket | |
A covert channel using tcp header fields.
Covert Channel, that uses 3 bits of the TCP Header, that are not used, to hide a message. To use this class, call 'sendMessage' with your message as a string. Received packets are used to call 'receiveMessage'. The decoded message is given to the callback function 'm_output'.
whisper_library::TcpHeaderCovertChannel::TcpHeaderCovertChannel | ( | function< void(string)> | output, |
function< void(GenericPacket)> | send | ||
) |
Constructor.
output | a function pointer that is called, when a complete message arrived. Its parameter is this message. |
send | a function pointer that is called to send a TcpPacket via the socket. |
|
private |
encodeMessageWithLength splits the message into parts of 3 bits and adds length blocks inbetween.
|
private |
extractData extracts the data we hid in the packet.
|
virtual |
Implements whisper_library::CovertChannel.
|
virtual |
Returns a string with basic information about the tcp header covert channel
Implements whisper_library::CovertChannel.
|
virtual |
Implements whisper_library::CovertChannel.
|
private |
modifyTcpPacket sets the reserved bits of packet to the value of data.
|
virtual |
Returns a string with the name of the covert channel "TCP Header Covert Channel"
Implements whisper_library::CovertChannel.
|
virtual |
Implements whisper_library::CovertChannel.
|
virtual |
Returns the protocol used by this covert channel
Implements whisper_library::CovertChannel.
|
virtual |
This function is called, when a new packet arrives at the socket. It collects them and returns the message via the callback function "m_output".
Implements whisper_library::CovertChannel.
void whisper_library::TcpHeaderCovertChannel::sendMessage | ( | string | message | ) |
SendMessage sends a message of type string through the Tcp Header Covert Channel.
|
inlinevirtual |
configures the covert channel
arguments | Arguments that are given to the covert channel |
Implements whisper_library::CovertChannel.
|
virtual |
sets the output method
output | the method the covert channel uses to output the received messages |
Implements whisper_library::CovertChannel.
|
private |
Stores the number of packets, we expect to receive in the current communication. 0 means, all packets were received and the channel is ready to receive a new length packet.