-
Notifications
You must be signed in to change notification settings - Fork 1
How to use the library
If you want to use the library to send a message using a covert channel, there are a few things you need to know so that the library works as it should. In short, the library needs to know about the adapter, the covert channel and the IP address.
Besides that, the ChannelManager offers a few more methods you may need, depending on what you want to do with the library. See the documentation for a detailed description of these methods.
Most computers have several network adapters, so you need to tell the library which one it should use to send the network packets. You can get information about the adapters over three methods:
ChannelManager::networkAdapters()
ChannelManager::adapterDescription()
ChannelManager::adapterAddresses()
The first one gives you a list with names which is unique and used as identifier. Use this identifier to chose an adapter by calling
ChannelManager::setAdapter(std::string name)
Selecting a covert channel works similar to selecting a network adapter. Again, there are three methods to show the available covert channels:
ChannelManager::getChannelIDs()
ChannelManager::getChannelNames()
ChannelManager::getChannelInfos()
The identifiers returned by the first method are used to select a channel. Different to the adapters you select a channel for each IP address you want to communicate with. This is done by calling
ChannelManager::openConnection(std::string ip, std::string channel_id)
When you have set the adapter and opened a connection, you can send messages to and receive messages from the IP address you used to open the connection. Message sending is done by calling
ChannelManager::sendMessage(std::string ip, std::string message)
There are two ways to get the received messages. You can ether set an output stream or use a callback method. You can tell the library with the methods
ChannelManager::setOutputStream(std::ostream* stream)
ChannelManager::setMessageCallback(function<void(std::string,std::string)> message_callback)
The callback functions gets the ip address as first argument and the message text as second argument. There is also an error stream which displays if something went wrong. It can be set with
ChannelManager::setErrorStream(std::ostream* stream)
As an example on how this can look like, we have implemented a console application. It can be found under "tests/communicationTest.cpp". It is embedded in our automatic testing system, but you can see the BOOST_AUTO_TEST_CASE as the main-Method and the Constructor of CommunicationFixture as the initialization of the ChannelManger.
Another example is the Pidgin plugin. Because plugisn in pidgin are written in C, we needed to wrap the functions of the channelmanager, but that is not effecting how to use the library. The setup of the ChannelManager is done in init_plugin(PurplePlugin* plugin).