From 46ceb4d1d84d9071d2b9ad2fd121ee04aa3dfcd9 Mon Sep 17 00:00:00 2001 From: crizzitello <98421672+crizzitello@users.noreply.github.com> Date: Fri, 15 Jul 2022 17:03:06 -0400 Subject: [PATCH] replace missing Db method (#197) Co-authored-by: Chris Rizzitello --- src/appconfig.cpp | 2 +- src/porting/system_manifest.cpp | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/appconfig.cpp b/src/appconfig.cpp index d546373..f453edb 100644 --- a/src/appconfig.cpp +++ b/src/appconfig.cpp @@ -56,7 +56,7 @@ bool AppConfig::exportConfig(const QString &fileName) if(fileName.isEmpty()) return false; QSettings newConfig(fileName, JSON); - for (const auto &key : newConfig.allKeys()) + for (const auto &key : get()->appConfig->allKeys()) newConfig.setValue(key, get()->appConfig->value(key)); newConfig.sync(); return true; diff --git a/src/porting/system_manifest.cpp b/src/porting/system_manifest.cpp index 1072b62..6addfd7 100644 --- a/src/porting/system_manifest.cpp +++ b/src/porting/system_manifest.cpp @@ -102,14 +102,25 @@ void SystemManifest::exportManifest(DatabaseConnection* db, const QString& outpu os = QSysInfo::kernelType(); // may need to check possible answers, or maybe just compare to new system value? QString basePath = QDir(outputDirPath).path(); - if (options.exportConfig) { Q_EMIT onStatusUpdate(tr("Exporting settings")); configPath = QStringLiteral("config.json"); AppConfig::exportConfig(m_fileTemplate.arg(basePath, configPath)); } - m_pathToManifest = QStringLiteral("%1/system.json").arg(basePath); + if (options.exportDb) { + Q_EMIT onStatusUpdate(tr("Exporting Evidence")); + dbPath = QStringLiteral("db.sqlite"); + evidenceManifestPath = QStringLiteral("evidence.json"); + auto allEvidence = DatabaseConnection::createEvidenceExportView(m_fileTemplate.arg(basePath, dbPath), EvidenceFilters(), db); + Q_EMIT onReady(allEvidence.size()); + porting::EvidenceManifest evidenceManifest = copyEvidence(basePath, allEvidence); + // write evidence manifest + FileHelpers::writeFile(m_fileTemplate.arg(basePath, evidenceManifestPath), + QJsonDocument(EvidenceManifest::serialize(evidenceManifest)).toJson()); + } + + m_pathToManifest = QStringLiteral("%1/system.json").arg(basePath); FileHelpers::writeFile(m_pathToManifest, QJsonDocument(serialize(*this)).toJson()); Q_EMIT onComplete(); }