|
@@ -16,15 +16,9 @@
|
|
|
#include "../include/config.h"
|
|
|
#include "../include/jsonhandler.h"
|
|
|
#include "../include/qmlhandler.h"
|
|
|
-#include <boost/asio.hpp>
|
|
|
-#include <boost/filesystem.hpp>
|
|
|
-#include <boost/lexical_cast.hpp>
|
|
|
#include <iostream>
|
|
|
#include <json/json.h>
|
|
|
|
|
|
-using boost::lexical_cast;
|
|
|
-using boost::asio::buffer;
|
|
|
-
|
|
|
using namespace std;
|
|
|
|
|
|
QUrl sendFileUrl = QUrl("");
|
|
@@ -33,9 +27,20 @@ bool _RESTART = false;
|
|
|
QMLHandler::QMLHandler(QObject *parent) : QObject(parent) {}
|
|
|
|
|
|
void QMLHandler::loadSettingsToGUI() {
|
|
|
- int covertMethod = lexical_cast<int>(Config::getValue("Covert-Channel-Method"));
|
|
|
- bool saveIP = lexical_cast<bool>(Config::getValue("Autofill-IP"));
|
|
|
- bool saveUsername = lexical_cast<bool>(Config::getValue("Autofill-Username"));
|
|
|
+ stringstream ss;
|
|
|
+
|
|
|
+ int covertMethod;
|
|
|
+ ss << Config::getValue("Covert-Channel-Method");
|
|
|
+ ss >> covertMethod;
|
|
|
+
|
|
|
+ bool saveIP;
|
|
|
+ ss << Config::getValue("Autofill-IP");
|
|
|
+ ss >> saveIP;
|
|
|
+
|
|
|
+ bool saveUsername;
|
|
|
+ ss << Config::getValue("Autofill-Username");
|
|
|
+ ss >> saveUsername;
|
|
|
+
|
|
|
QString cliPath = QString::fromStdString(Config::getValue("CLI-Path"));
|
|
|
emit loadSettings(covertMethod, saveIP, saveUsername, cliPath);
|
|
|
}
|
|
@@ -49,8 +54,7 @@ void QMLHandler::onStart() {
|
|
|
// Config exists
|
|
|
if (Config::checkConfig() == true) {
|
|
|
// Config is valid
|
|
|
- if (!boost::filesystem::is_regular_file(Config::getValue("CLI-Path")) ||
|
|
|
- boost::filesystem::path(Config::getValue("CLI-Path")).filename().compare("ccats-cli")) {
|
|
|
+ if (!ifstream(Config::getValue("CLI-Path"))) {
|
|
|
// Invalid CLI Path
|
|
|
emit invalidCliPathPopupOpen();
|
|
|
}
|
|
@@ -155,9 +159,9 @@ void QMLHandler::onSettingsResetButton() {
|
|
|
}
|
|
|
|
|
|
void QMLHandler::onSettingsSaveButton(int covertMethod, bool saveIP, bool saveUsername, QString cliPath) {
|
|
|
- Config::setValue("Covert-Channel-Method", lexical_cast<string>(covertMethod));
|
|
|
- Config::setValue("Autofill-IP", lexical_cast<string>(saveIP));
|
|
|
- Config::setValue("Autofill-Username", lexical_cast<string>(saveUsername));
|
|
|
+ Config::setValue("Covert-Channel-Method", to_string(covertMethod));
|
|
|
+ Config::setValue("Autofill-IP", to_string(saveIP));
|
|
|
+ Config::setValue("Autofill-Username", to_string(saveUsername));
|
|
|
Config::setValue("CLI-Path", cliPath.toUtf8().constData());
|
|
|
Config::saveFile();
|
|
|
emit log("Settings saved.");
|