Add FortFirewallDriverPayload.pro

This commit is contained in:
Nodir Temirkhodjaev 2021-11-04 12:32:37 +03:00
parent 72e6e12adb
commit 935e466850
5 changed files with 89 additions and 0 deletions

View File

@ -16,3 +16,10 @@ ui_bin.file = ui_bin/FortFirewallUIBin.pro
tests.depends = ui
tests.file = tests/FortFirewallTests.pro
# Driver Payload
driver_payload {
SUBDIRS += driver_payload
driver_payload.file = driver_payload/FortFirewallDriverPayload.pro
}

View File

@ -0,0 +1,14 @@
include(../global.pri)
CONFIG += console
CONFIG -= debug_and_release
TARGET = DriverPayload
TEMPLATE = app
SOURCES += \
driverpayload.cpp \
main.cpp
HEADERS += \
driverpayload.h

View File

@ -0,0 +1,36 @@
#include "driverpayload.h"
#include <QCommandLineParser>
void DriverPayload::processArguments(const QStringList &args)
{
QCommandLineParser parser;
const QCommandLineOption inputOption(QStringList() << "i"
<< "input",
"Input file.", "input");
parser.addOption(inputOption);
const QCommandLineOption outputOption(QStringList() << "o"
<< "output",
"Output file.", "output");
parser.addOption(outputOption);
const QCommandLineOption payloadOption(QStringList() << "p"
<< "payload",
"Payload file.", "payload");
parser.addOption(payloadOption);
parser.addHelpOption();
parser.process(args);
if (!parser.isSet(inputOption) || !parser.isSet(outputOption) || !parser.isSet(payloadOption)) {
parser.showHelp(1);
return;
}
m_inputFilePath = parser.value(inputOption);
m_outputFilePath = parser.value(outputOption);
m_payloadFilePath = parser.value(payloadOption);
}

View File

@ -0,0 +1,19 @@
#ifndef DRIVERPAYLOAD_H
#define DRIVERPAYLOAD_H
#include <QObject>
class DriverPayload
{
public:
explicit DriverPayload() = default;
void processArguments(const QStringList &args);
private:
QString m_inputFilePath;
QString m_outputFilePath;
QString m_payloadFilePath;
};
#endif // DRIVERPAYLOAD_H

View File

@ -0,0 +1,13 @@
#include <QCoreApplication>
#include "driverpayload.h"
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
DriverPayload payload;
payload.processArguments(QCoreApplication::arguments());
return 0;
}