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

A covert channel using inter packet delays. More...

Inheritance diagram for whisper_library::TimingCovertChannel:
Inheritance graph

Public Member Functions

 TimingCovertChannel (function< void(string)> output, function< void(GenericPacket)> send)
 Constructor. More...
 
 ~TimingCovertChannel ()
 
CovertChannelinstance ()
 
void sendMessage (string message)
 
void receivePacket (GenericPacket &packet)
 
void setArguments (string arguments)
 Gives arguments to the channel to configure the delays. More...
 
void initialize ()
 
void setOutput (function< void(string)> output)
 sets the output method More...
 
void setSend (function< void(GenericPacket)> send)
 sets the methode used to send packets
 
string name () const
 Returns a string with the name of the covert channel "Timing Covert Channel".
 
string info () const
 Returns a string with basic information about the timing covert channel.
 
string protocol () const
 Returns the protocol used by this covert channel (udp)
 
unsigned short port () const
 Returns the used port (23)
 
string id () const
 
- Public Member Functions inherited from whisper_library::CovertChannel
 CovertChannel ()
 Creates a CovertChannel.
 
virtual ~CovertChannel ()
 Destructor. More...
 
virtual void sendMessage (std::string message)=0
 sends a message More...
 

Private Member Functions

void calculateTresholds ()
 
void startTimeoutTimer ()
 
void sendDelays (vector< unsigned int > delays)
 

Private Attributes

MorseCoderm_coder
 MorseCoder is used to encode messages as morse.
 
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 Udp Packets via the socket
 
chrono::time_point
< chrono::system_clock > 
m_receive_start
 Marks the time the last packet was received to measure inter-packet delays.
 
chrono::time_point
< chrono::system_clock > 
m_timeout_end
 Marks the time point at which the timeout ends. It is increased each time a packet is received.
 
atomic< bool > m_timeout_changed
 signals 'startTimeoutTimer' that the timeout end point has changed.
 
vector< unsigned int > m_received_delays
 stores the measured delays
 
atomic< bool > m_receiving
 indicates, if the channel is currently receiving a message
 
unsigned int m_timeout
 timeout in milliseconds after the last received message until the delays are interpreted
 
unsigned int m_delay_short
 delay_short is used to encode a short signal (in milliseconds)
 
unsigned int m_threshold_delay_short
 threshold between short and long delays
 
unsigned int m_delay_long
 delay_long is used to encode a long signal (in milliseconds)
 
unsigned int m_threshold_delay_long
 threshold between long and letter delays
 
unsigned int m_delay_letter
 delay_letter is used to encode the end of a letter (in milliseconds)
 
unsigned int m_threshold_delay_letter
 threshold between letter and space delays
 
unsigned int m_delay_space
 delay_space is used to encode space between words (in milliseconds)
 
mutex m_mutex_sending
 mutex to prevent different threads from sending simultaneously
 

Detailed Description

A covert channel using inter packet delays.

The TimingCovertChannel implements a covert channel, that uses inter-packet delays to transmit morse. The receiver measures the delays between incoming packets to decode the message. To use the channel, call 'sendMessage' with your message as a string. Received packets are given to 'receiveMessage' which returns the decoded message after a timeout to the callback function m_output.

Constructor & Destructor Documentation

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

Constructor.

Parameters
outputfunction pointer that is called, when a complete message arrived. Its parameter is this message.
sendfunction pointer that is called to send a UdpPacket via the socket.
whisper_library::TimingCovertChannel::~TimingCovertChannel ( )

Destructor

Member Function Documentation

void whisper_library::TimingCovertChannel::calculateTresholds ( )
private

Calcules thresholds between the different intervals to compensate for transmitting delays.

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

Implements whisper_library::CovertChannel.

void whisper_library::TimingCovertChannel::initialize ( )
inlinevirtual

No initialisation needed, empty function

Implements whisper_library::CovertChannel.

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

Implements whisper_library::CovertChannel.

void whisper_library::TimingCovertChannel::receivePacket ( GenericPacket packet)
virtual

Has to be called when a packet is received, with the packet as the argument. After a timeout the callback m_output is called with the received message.

Parameters
packetpacket that was received on network

Implements whisper_library::CovertChannel.

void whisper_library::TimingCovertChannel::sendDelays ( vector< unsigned int >  delays)
private

Sends Udp packets using m_send with inter-packet delays given as the argument.

void whisper_library::TimingCovertChannel::sendMessage ( string  message)

Sends a message using the timing channel.

Parameters
messageMessage that is send
void whisper_library::TimingCovertChannel::setArguments ( string  arguments)
virtual

Gives arguments to the channel to configure the delays.

Available arguments: -set_timings [short] [long] [letter] [space] [short] [long] [letter] [space] are the delays used for morse encoding in milliseconds

Parameters
argumentsstring that is parsed for channel arguments

Implements whisper_library::CovertChannel.

void whisper_library::TimingCovertChannel::setOutput ( function< void(string)>  output)
virtual

sets the output method

Parameters
outputthe method the covert channel uses to output the received messages

Implements whisper_library::CovertChannel.

void whisper_library::TimingCovertChannel::startTimeoutTimer ( )
private

Starts the timeout. If m_timeout_changed is false and m_timeout_end is in the past, it calls the callback function m_output.