Whisper Library
|
The connecting part for the CovertChannel and the framework. More...
Public Member Functions | |
ChannelManager () | |
Constructor. | |
~ChannelManager () | |
Destructor. | |
void | setErrorStream (std::ostream *stream) |
Sets the stream that is used to output error messages of the channelmanager. More... | |
vector< string > | getChannelNames () |
Returns a list with available covert channels. More... | |
vector< string > | getChannelInfos () |
Returns a list with descriptions of all available covert channels. More... | |
vector< string > | getChannelIDs () |
Returns a list with IDs of the available covert channels. More... | |
unsigned int | channelCount () |
Returns the amount of available channels. More... | |
void | setChannelArguments (string ip, string arguments) |
Sets the arguments of the current covert channel. More... | |
void | addChannel (CovertChannel *channel) |
adds an CovertChannel to the available Channels (m_channels) More... | |
void | setOutputStream (std::ostream *stream) |
Sets the stream, that the covert channel uses as the output for received messages. More... | |
void | setMessageCallback (function< void(string, string)> message_callback) |
Sets a function that is called, when a covert channel receives a message. More... | |
void | outputMessage (string ip, string message) |
Writes a message to the selected output stream. More... | |
void | packetReceived (string ip, GenericPacket packet) |
Is called, when a packet is received on the network. More... | |
void | sendPacket (string ip, GenericPacket packet, string protocol) |
sends a packet to m_network More... | |
bool | openConnection (string ip, string channel_id) |
Starts a conversation. More... | |
void | closeConnection (string ip) |
Stops a conversation. More... | |
unsigned int | connectionCount () |
Returns the number of open connections. | |
bool | connection (string ip) |
Checks for an open connection with a specific ip. More... | |
void | sendMessage (string ip, string message) |
Sends a message to the given ip. More... | |
bool | setAdapter (string name) |
Sets the network adapter that is used to send (win32 only) and receive messages. More... | |
unsigned int | adapterCount () |
Returns the number of available network adapters. | |
vector< string > | networkAdapters () |
Returns a list of available network adapters. More... | |
string | adapterDescription (string adapter_name) |
Returns the description of an adapter. More... | |
vector< string > | adapterAddresses () |
Returns the network addresses of the currently set adapter. More... | |
Private Member Functions | |
void | outputErrorMessage (string message) |
Outputs an error message to the stream set with 'setErrorStream'. More... | |
CovertChannel * | createChannel (string ip, CovertChannel *channel) |
Covert channel factory. More... | |
Private Attributes | |
map< string, CovertChannel * > | m_channels |
std::ostream * | m_output_stream |
Stream that is used to output messages received by a covert channel. | |
std::ostream * | m_error_stream |
Stream that is used to output error messages. | |
NetworkConnector * | m_network |
Pointer to NetworkConnector that is used to access network functionalities. | |
map< string, CovertChannel * > | m_ip_mapping |
function< void(string, string)> | m_message_callback |
The connecting part for the CovertChannel and the framework.
You can add and remove covert channels you want to use. You pass the data you want to send to this class. It is connected to the network via a SocketConnector.
vector< string > whisper_library::ChannelManager::adapterAddresses | ( | ) |
Returns the network addresses of the currently set adapter.
string whisper_library::ChannelManager::adapterDescription | ( | string | adapter_name | ) |
Returns the description of an adapter.
adapter_name | unique name of the adapter. Can be retrieved by calling 'networkAdapters'. |
void whisper_library::ChannelManager::addChannel | ( | CovertChannel * | channel | ) |
adds an CovertChannel to the available Channels (m_channels)
channel | an Instance of the Covert Channel you want to add. Can be created with the default constructor and is only used for information and Channel creation by calling CovertChannel::instance() |
unsigned int whisper_library::ChannelManager::channelCount | ( | ) |
Returns the amount of available channels.
void whisper_library::ChannelManager::closeConnection | ( | string | ip | ) |
Stops a conversation.
Closes the covert channel and stops listening for packets of the given ip.
ip | Ipv4 address of the host you no longer want to communicate with |
bool whisper_library::ChannelManager::connection | ( | string | ip | ) |
Checks for an open connection with a specific ip.
ip | Ipv4 address of the host that you want to check |
|
private |
Covert channel factory.
Creates a covert channel instance and returns a pointer to the object.
ip | Ipv4 address you want to communicate with using the created channel |
channel | instance of the CovertChannel you want to create |
vector< string > whisper_library::ChannelManager::getChannelIDs | ( | ) |
Returns a list with IDs of the available covert channels.
vector< string > whisper_library::ChannelManager::getChannelInfos | ( | ) |
Returns a list with descriptions of all available covert channels.
The order matches the name list retrieved by calling 'getChannelNames'.
vector< string > whisper_library::ChannelManager::getChannelNames | ( | ) |
Returns a list with available covert channels.
vector< string > whisper_library::ChannelManager::networkAdapters | ( | ) |
Returns a list of available network adapters.
The name of a network adapter uniquely identifies it and is used to select it by calling 'setAdapter'.
bool whisper_library::ChannelManager::openConnection | ( | string | ip, |
string | channel_id | ||
) |
Starts a conversation.
Opens a connection to a specific ip using the covert channel that matches the id. After calling this, you can send messages to that ip by calling 'sendMessage'.
ip | Ipv4 you want to communicate with |
channel_id | id of the channel you want to use, to hide the coversation. |
|
private |
Outputs an error message to the stream set with 'setErrorStream'.
message | error message that is display to the user |
void whisper_library::ChannelManager::outputMessage | ( | string | ip, |
string | message | ||
) |
Writes a message to the selected output stream.
Change the output stream by calling 'setOutputStream'.
ip | the sender ip of the message |
message | the message to be written |
void whisper_library::ChannelManager::packetReceived | ( | string | ip, |
GenericPacket | packet | ||
) |
Is called, when a packet is received on the network.
It is then forwarded to the channel with the specified ip.
ip | Ip of the sender of the packet |
packet | the packet that was received |
void whisper_library::ChannelManager::sendMessage | ( | string | ip, |
string | message | ||
) |
Sends a message to the given ip.
There needs to be an open connection to be able to send a message to that ip.
ip | Ipv4 adress that you want to send the message to |
message | the message as string |
void whisper_library::ChannelManager::sendPacket | ( | string | ip, |
GenericPacket | packet, | ||
string | protocol | ||
) |
sends a packet to m_network
Interprets the given GenericPacket as an packet of the protocol and sends it to the given ip.
ip | the receivers IP |
packet | the packet to send |
protocol | the protocol used to send the packet |
bool whisper_library::ChannelManager::setAdapter | ( | string | name | ) |
Sets the network adapter that is used to send (win32 only) and receive messages.
name | unique name of the adapter. A list of adapters can be retrieved by calling 'networkAdapters'. |
void whisper_library::ChannelManager::setChannelArguments | ( | string | ip, |
string | arguments | ||
) |
Sets the arguments of the current covert channel.
The string arguments is parsed by the channel to set channel specific options. More information on which arguments are supported can be found in the specific covertchannel source.
ip | destination ip the covert channel is used to communicate with |
arguments | argument string that is given to the channel |
void whisper_library::ChannelManager::setErrorStream | ( | std::ostream * | stream | ) |
Sets the stream that is used to output error messages of the channelmanager.
stream | stream that is used to output error messages |
void whisper_library::ChannelManager::setMessageCallback | ( | function< void(string, string)> | message_callback | ) |
Sets a function that is called, when a covert channel receives a message.
message_callback | Pointer to a function that is called, when a message is received. The first argument is the ip(v4) in dotted form, the message was received from. The second argument is the received message. |
void whisper_library::ChannelManager::setOutputStream | ( | std::ostream * | stream | ) |
Sets the stream, that the covert channel uses as the output for received messages.
stream | a pointer to the output stream |
|
private |
Holds an instance of each available covert channel type. Used just to pull information from, not for communication.
|
private |
Maps Ipv4 addresses in dotted form to a pointer of the covert channel that is used to communicate with that ip
|
private |
Pointer to the function that is called when a covert channel receives a message. The first argument is the ip(v4) in dotted form, the message was received from. The second argument is the received message.