123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- #include <iostream>
- #include "../include/Config.h"
- #include "../include/CovertChannel/CovertChannel.h"
- #include "../include/CovertChannel/ForwardChannel.h"
- #include "../include/CovertChannel/ProxyChannel.h"
- #include "../include/Server.h"
- #include "../include/UserManager.h"
- using namespace std;
- int main(int argc, char *argv[]) {
- // load config int namespace
- if (!Config::init("config.txt")) {
- cerr << "configuration could not be loaded properly" << endl;
- exit(EXIT_FAILURE);
- }
- CovertChannel *covertchannel = nullptr;
- const std::string covertChannelMode = Config::getValue("covertChannelMode");
- if (covertChannelMode == "proxy") {
- const string innerInterface = Config::getValue("innerInterface");
- const string outerInterface = Config::getValue("outerInterface");
- const string ownIP = Config::getValue("ownIP");
- const string partnerIP = Config::getValue("partnerIP");
- const string originIP = Config::getValue("originIP");
- const string targetIP = Config::getValue("targetIP");
- const string targetPort = Config::getValue("targetPort");
- const string relayMode = Config::getValue("relayMode");
- covertchannel = new ProxyChannel(innerInterface, outerInterface, ownIP, partnerIP, originIP, targetIP, targetPort, relayMode == "true");
- // covertchannel = new ForwardChannel(innerInterface, outerInterface);
- covertchannel->startSniffing();
- } else if (covertChannelMode == "forward") {
- const string innerInterface = Config::getValue("innerInterface");
- const string outerInterface = Config::getValue("outerInterface");
- covertchannel = new ForwardChannel(innerInterface, outerInterface);
- covertchannel->startSniffing();
- }
- // check if userStorage is add specified location
- // if not create one
- UserManager::init(Config::getValue("userdatabase"));
- try {
- io_service io_service;
- Server server(io_service);
- io_service.run();
- } catch (exception &e) {
- cerr << e.what() << endl;
- }
- if (covertchannel == nullptr) {
- delete (covertchannel);
- }
- return 0;
- }
|