Whisper Library
 All Classes Functions Variables Typedefs Enumerations Friends
whisper_library::PacketLengthCovertChannel Class Reference

A covert channel using packet lengths. More...

Inheritance diagram for whisper_library::PacketLengthCovertChannel:
Inheritance graph

Public Member Functions

 PacketLengthCovertChannel (function< void(std::string)> output, function< void(GenericPacket)> send)
 Creates an PacketLengthCovertChannel. More...
 
 ~PacketLengthCovertChannel ()
 Deletes the PacketLengthCovertChannel. More...
 
CovertChannelinstance ()
 
void sendMessage (std::string message)
 sends a message More...
 
void receivePacket (GenericPacket &udp_packet)
 interprets an udp packet More...
 
void setArguments (std::string arguments)
 
void initialize ()
 
void setOutput (function< void(std::string)> output)
 sets the function used to output received messages More...
 
void setSend (function< void(GenericPacket)> send)
 sets the function used to send packets More...
 
std::string name () const
 
std::string info () const
 
std::string protocol () const
 
unsigned short port () const
 
std::string id () const
 
- Public Member Functions inherited from whisper_library::CovertChannel
 CovertChannel ()
 Creates a CovertChannel.
 
virtual ~CovertChannel ()
 Destructor. More...
 
virtual void setArguments (string arguments)=0
 configures the covert channel More...
 
virtual void setOutput (function< void(string)> output)=0
 sets the output method More...
 

Private Attributes

std::function< void(std::string)> m_output
 function used to return received messages as a string
 
std::function< void(GenericPacket)> m_send
 function used to send Udp Packets via the socket
 
std::vector< unsigned int > m_packetlengths
 holds the packet lengths send or received
 
int m_received
 counts the received packets
 
int m_packetcount
 number of packets for the current transmission
 
int m_baselength
 minimal length of data payload of the udp packets
 
LengthCoderm_coder
 used to encode and decode messages
 

Detailed Description

A covert channel using packet lengths.

A PacketLengthCovertChannel can be used to send and receive messages coded in the length of udp packets. It uses a base length of ten and increases this length depending on the send message.

Constructor & Destructor Documentation

whisper_library::PacketLengthCovertChannel::PacketLengthCovertChannel ( function< void(std::string)>  output,
function< void(GenericPacket)>  send 
)
inline

Creates an PacketLengthCovertChannel.

Creates a new PacketLengthCovertChannel. An PacketLengthCovertChannel needs three function pointers. It than can be use to send and receive messages.

Parameters
outputa function the covert channel calls with the message he received as an argument
senda function the covert channel uses to send udp packets
whisper_library::PacketLengthCovertChannel::~PacketLengthCovertChannel ( )

Deletes the PacketLengthCovertChannel.

Deletes this instance of PacketLengthCovertChannel and frees all memory.

Member Function Documentation

std::string whisper_library::PacketLengthCovertChannel::id ( ) const
virtual
Returns
the ID of the covert channel

Implements whisper_library::CovertChannel.

std::string whisper_library::PacketLengthCovertChannel::info ( ) const
virtual
Returns
Some information about the covert channel

Implements whisper_library::CovertChannel.

void whisper_library::PacketLengthCovertChannel::initialize ( )
inlinevirtual

No initialisation needed, empty function

Implements whisper_library::CovertChannel.

CovertChannel * whisper_library::PacketLengthCovertChannel::instance ( )
virtual
Returns
an instance of this covert channel

Implements whisper_library::CovertChannel.

std::string whisper_library::PacketLengthCovertChannel::name ( ) const
virtual
Returns
The name of the covert channel

Implements whisper_library::CovertChannel.

unsigned short whisper_library::PacketLengthCovertChannel::port ( ) const
virtual
Returns
Port that packets are send to

Implements whisper_library::CovertChannel.

std::string whisper_library::PacketLengthCovertChannel::protocol ( ) const
virtual
Returns
Protocol used by this covert channel

Implements whisper_library::CovertChannel.

void whisper_library::PacketLengthCovertChannel::receivePacket ( GenericPacket udp_packet)
virtual

interprets an udp packet

The given packet is interpreted as an udp packet and the length of the packet is used to reassemble the message.

Parameters
udp_packetthe packet that gets interpreted

Implements whisper_library::CovertChannel.

void whisper_library::PacketLengthCovertChannel::sendMessage ( std::string  message)
virtual

sends a message

The message gets encoded as packet lengths and then udp packets with this lengths get send using the function passed in the constructor.

Parameters
messagethe message that is send

Implements whisper_library::CovertChannel.

void whisper_library::PacketLengthCovertChannel::setArguments ( std::string  arguments)
inline

No arguments, empty function

void whisper_library::PacketLengthCovertChannel::setOutput ( function< void(std::string)>  output)

sets the function used to output received messages

Parameters
outputa function-pointer used to output messages
void whisper_library::PacketLengthCovertChannel::setSend ( function< void(GenericPacket)>  send)
virtual

sets the function used to send packets

Parameters
senda function-pointer used to send packets

Implements whisper_library::CovertChannel.