123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- #include <iostream>
- #include "../include/Config.h"
- #include "../include/CovertChannel/CovertChannel.h"
- #include "../include/CovertChannel/CovertProtocol.hpp"
- #include "../include/CovertChannel/ForwardChannel.h"
- #include "../include/CovertChannel/TCPUrgencyChannel.hpp"
- #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 == "tcpurgency") {
- const string innerInterface = Config::getValue("innerInterface");
- const string outerInterface = Config::getValue("outerInterface");
- const string ownIP = Config::getValue("ownIP");
- const string targetIP = Config::getValue("targetIP");
- const string targetPort = Config::getValue("targetPort");
- const string passiveMode = Config::getValue("passiveMode");
- const string sendFile = Config::getValue("sendFile");
- if (passiveMode == "true") {
- covertchannel = new TCPUrgencyChannel<true>(innerInterface, outerInterface, ownIP, targetIP, targetPort);
- } else {
- covertchannel = new TCPUrgencyChannel<false>(innerInterface, outerInterface, ownIP, targetIP, targetPort);
- }
- // test sending file
- if (passiveMode != "true" && sendFile != "")
- covertchannel->sendFile(sendFile);
- // 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;
- }
|