mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-01-11 07:19:44 -05:00
Cleanup CLI includes across all components
* Remove unused include files * Move includes out of widely shared headers (reduced rebuild time) * Consolidate code for Analyze command
This commit is contained in:
parent
dc496fd1d9
commit
be3e77d721
@ -15,18 +15,12 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "Add.h"
|
#include "Add.h"
|
||||||
|
|
||||||
#include "cli/Generate.h"
|
#include "Generate.h"
|
||||||
#include "cli/TextStream.h"
|
#include "Utils.h"
|
||||||
#include "cli/Utils.h"
|
|
||||||
#include "core/Database.h"
|
|
||||||
#include "core/Entry.h"
|
#include "core/Entry.h"
|
||||||
#include "core/Group.h"
|
#include "core/Group.h"
|
||||||
#include "core/PasswordGenerator.h"
|
|
||||||
|
|
||||||
const QCommandLineOption Add::UsernameOption = QCommandLineOption(QStringList() << "u"
|
const QCommandLineOption Add::UsernameOption = QCommandLineOption(QStringList() << "u"
|
||||||
<< "username",
|
<< "username",
|
||||||
|
@ -32,7 +32,6 @@ public:
|
|||||||
static const QCommandLineOption NotesOption;
|
static const QCommandLineOption NotesOption;
|
||||||
static const QCommandLineOption PasswordPromptOption;
|
static const QCommandLineOption PasswordPromptOption;
|
||||||
static const QCommandLineOption GenerateOption;
|
static const QCommandLineOption GenerateOption;
|
||||||
static const QCommandLineOption PasswordLengthOption;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // KEEPASSXC_ADD_H
|
#endif // KEEPASSXC_ADD_H
|
||||||
|
@ -15,14 +15,9 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "AddGroup.h"
|
#include "AddGroup.h"
|
||||||
|
|
||||||
#include "cli/TextStream.h"
|
#include "Utils.h"
|
||||||
#include "cli/Utils.h"
|
|
||||||
#include "core/Database.h"
|
|
||||||
#include "core/Entry.h"
|
#include "core/Entry.h"
|
||||||
#include "core/Group.h"
|
#include "core/Group.h"
|
||||||
|
|
||||||
|
@ -16,16 +16,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Analyze.h"
|
#include "Analyze.h"
|
||||||
#include "cli/Utils.h"
|
|
||||||
|
#include "Utils.h"
|
||||||
|
#include "core/Group.h"
|
||||||
#include "core/HibpOffline.h"
|
#include "core/HibpOffline.h"
|
||||||
|
#include "core/Tools.h"
|
||||||
|
|
||||||
#include <QCommandLineParser>
|
#include <QCommandLineParser>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QString>
|
|
||||||
|
|
||||||
#include "cli/TextStream.h"
|
|
||||||
#include "core/Group.h"
|
|
||||||
#include "core/Tools.h"
|
|
||||||
|
|
||||||
const QCommandLineOption Analyze::HIBPDatabaseOption = QCommandLineOption(
|
const QCommandLineOption Analyze::HIBPDatabaseOption = QCommandLineOption(
|
||||||
{"H", "hibp"},
|
{"H", "hibp"},
|
||||||
@ -84,23 +82,21 @@ int Analyze::executeWithDatabase(QSharedPointer<Database> database, QSharedPoint
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& finding : findings) {
|
for (const auto& finding : findings) {
|
||||||
printHibpFinding(finding.first, finding.second, out);
|
const auto entry = finding.first;
|
||||||
|
auto count = finding.second;
|
||||||
|
|
||||||
|
QString path = entry->title();
|
||||||
|
for (auto g = entry->group(); g && g != g->database()->rootGroup(); g = g->parentGroup()) {
|
||||||
|
path.prepend("/").prepend(g->name());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count > 0) {
|
||||||
|
out << QObject::tr("Password for '%1' has been leaked %2 time(s)!", "", count).arg(path).arg(count) << endl;
|
||||||
|
} else {
|
||||||
|
out << QObject::tr("Password for '%1' has been leaked!", "", count).arg(path) << endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Analyze::printHibpFinding(const Entry* entry, int count, QTextStream& out)
|
|
||||||
{
|
|
||||||
QString path = entry->title();
|
|
||||||
for (auto g = entry->group(); g && g != g->database()->rootGroup(); g = g->parentGroup()) {
|
|
||||||
path.prepend("/").prepend(g->name());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (count > 0) {
|
|
||||||
out << QObject::tr("Password for '%1' has been leaked %2 time(s)!", "", count).arg(path).arg(count) << endl;
|
|
||||||
} else {
|
|
||||||
out << QObject::tr("Password for '%1' has been leaked!", "", count).arg(path) << endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -28,9 +28,6 @@ public:
|
|||||||
|
|
||||||
static const QCommandLineOption HIBPDatabaseOption;
|
static const QCommandLineOption HIBPDatabaseOption;
|
||||||
static const QCommandLineOption OkonOption;
|
static const QCommandLineOption OkonOption;
|
||||||
|
|
||||||
private:
|
|
||||||
void printHibpFinding(const Entry* entry, int count, QTextStream& out);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // KEEPASSXC_HIBP_H
|
#endif // KEEPASSXC_HIBP_H
|
||||||
|
@ -15,18 +15,12 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <chrono>
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <thread>
|
|
||||||
|
|
||||||
#include "Clip.h"
|
#include "Clip.h"
|
||||||
|
|
||||||
#include "cli/TextStream.h"
|
#include "Utils.h"
|
||||||
#include "cli/Utils.h"
|
|
||||||
#include "core/Database.h"
|
|
||||||
#include "core/Entry.h"
|
#include "core/Entry.h"
|
||||||
#include "core/Global.h"
|
|
||||||
#include "core/Group.h"
|
#include "core/Group.h"
|
||||||
|
#include "core/Tools.h"
|
||||||
|
|
||||||
const QCommandLineOption Clip::AttributeOption = QCommandLineOption(
|
const QCommandLineOption Clip::AttributeOption = QCommandLineOption(
|
||||||
QStringList() << "a"
|
QStringList() << "a"
|
||||||
@ -155,7 +149,7 @@ int Clip::executeWithDatabase(QSharedPointer<Database> database, QSharedPointer<
|
|||||||
out << '\r' << QString(lastLine.size(), ' ') << '\r';
|
out << '\r' << QString(lastLine.size(), ' ') << '\r';
|
||||||
lastLine = QObject::tr("Clearing the clipboard in %1 second(s)…", "", timeoutSeconds).arg(timeoutSeconds);
|
lastLine = QObject::tr("Clearing the clipboard in %1 second(s)…", "", timeoutSeconds).arg(timeoutSeconds);
|
||||||
out << lastLine << flush;
|
out << lastLine << flush;
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
Tools::sleep(1000);
|
||||||
--timeoutSeconds;
|
--timeoutSeconds;
|
||||||
}
|
}
|
||||||
Utils::clipText("");
|
Utils::clipText("");
|
||||||
|
@ -17,13 +17,6 @@
|
|||||||
|
|
||||||
#include "Close.h"
|
#include "Close.h"
|
||||||
|
|
||||||
#include <QCommandLineParser>
|
|
||||||
#include <QtGlobal>
|
|
||||||
|
|
||||||
#include "DatabaseCommand.h"
|
|
||||||
#include "TextStream.h"
|
|
||||||
#include "Utils.h"
|
|
||||||
|
|
||||||
Close::Close()
|
Close::Close()
|
||||||
{
|
{
|
||||||
name = QString("close");
|
name = QString("close");
|
||||||
|
@ -15,13 +15,6 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cstdio>
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
#include <QFileInfo>
|
|
||||||
#include <QMap>
|
|
||||||
|
|
||||||
#include "Command.h"
|
#include "Command.h"
|
||||||
|
|
||||||
#include "Add.h"
|
#include "Add.h"
|
||||||
@ -47,9 +40,11 @@
|
|||||||
#include "Remove.h"
|
#include "Remove.h"
|
||||||
#include "RemoveGroup.h"
|
#include "RemoveGroup.h"
|
||||||
#include "Show.h"
|
#include "Show.h"
|
||||||
#include "TextStream.h"
|
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <QRegularExpression>
|
||||||
|
|
||||||
const QCommandLineOption Command::HelpOption = QCommandLineOption(QStringList()
|
const QCommandLineOption Command::HelpOption = QCommandLineOption(QStringList()
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
<< QStringLiteral("?")
|
<< QStringLiteral("?")
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
#include <QCommandLineOption>
|
#include <QCommandLineOption>
|
||||||
#include <QCommandLineParser>
|
#include <QCommandLineParser>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QObject>
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
|
@ -15,21 +15,12 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cstdlib>
|
#include "Create.h"
|
||||||
#include <stdio.h>
|
|
||||||
|
#include "Utils.h"
|
||||||
|
#include "keys/FileKey.h"
|
||||||
|
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QString>
|
|
||||||
#include <QTextStream>
|
|
||||||
|
|
||||||
#include "Create.h"
|
|
||||||
#include "Utils.h"
|
|
||||||
|
|
||||||
#include "core/Database.h"
|
|
||||||
|
|
||||||
#include "keys/CompositeKey.h"
|
|
||||||
#include "keys/FileKey.h"
|
|
||||||
#include "keys/Key.h"
|
|
||||||
|
|
||||||
const QCommandLineOption Create::DecryptionTimeOption =
|
const QCommandLineOption Create::DecryptionTimeOption =
|
||||||
QCommandLineOption(QStringList() << "t"
|
QCommandLineOption(QStringList() << "t"
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "DatabaseCommand.h"
|
#include "DatabaseCommand.h"
|
||||||
|
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
|
||||||
DatabaseCommand::DatabaseCommand()
|
DatabaseCommand::DatabaseCommand()
|
||||||
|
@ -18,11 +18,7 @@
|
|||||||
#ifndef KEEPASSXC_DATABASECOMMAND_H
|
#ifndef KEEPASSXC_DATABASECOMMAND_H
|
||||||
#define KEEPASSXC_DATABASECOMMAND_H
|
#define KEEPASSXC_DATABASECOMMAND_H
|
||||||
|
|
||||||
#include <QCommandLineOption>
|
|
||||||
|
|
||||||
#include "Command.h"
|
#include "Command.h"
|
||||||
#include "Utils.h"
|
|
||||||
#include "core/Database.h"
|
|
||||||
|
|
||||||
class DatabaseCommand : public Command
|
class DatabaseCommand : public Command
|
||||||
{
|
{
|
||||||
|
@ -15,13 +15,9 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "Diceware.h"
|
#include "Diceware.h"
|
||||||
|
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
#include "cli/TextStream.h"
|
|
||||||
#include "core/PassphraseGenerator.h"
|
#include "core/PassphraseGenerator.h"
|
||||||
|
|
||||||
const QCommandLineOption Diceware::WordCountOption =
|
const QCommandLineOption Diceware::WordCountOption =
|
||||||
|
@ -15,19 +15,13 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "Edit.h"
|
#include "Edit.h"
|
||||||
|
|
||||||
#include "cli/Add.h"
|
#include "Add.h"
|
||||||
#include "cli/Generate.h"
|
#include "Generate.h"
|
||||||
#include "cli/TextStream.h"
|
#include "Utils.h"
|
||||||
#include "cli/Utils.h"
|
|
||||||
#include "core/Database.h"
|
|
||||||
#include "core/Entry.h"
|
#include "core/Entry.h"
|
||||||
#include "core/Group.h"
|
#include "core/Group.h"
|
||||||
#include "core/PasswordGenerator.h"
|
|
||||||
|
|
||||||
const QCommandLineOption Edit::TitleOption = QCommandLineOption(QStringList() << "t"
|
const QCommandLineOption Edit::TitleOption = QCommandLineOption(QStringList() << "t"
|
||||||
<< "title",
|
<< "title",
|
||||||
|
@ -16,21 +16,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Estimate.h"
|
#include "Estimate.h"
|
||||||
#include "cli/Utils.h"
|
|
||||||
|
|
||||||
#include "cli/TextStream.h"
|
#include "Utils.h"
|
||||||
#include "core/PasswordHealth.h"
|
#include "core/PasswordHealth.h"
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <zxcvbn.h>
|
|
||||||
|
|
||||||
/* For pre-compiled headers under windows */
|
#include <zxcvbn.h>
|
||||||
#ifdef _WIN32
|
|
||||||
#ifndef __MINGW32__
|
|
||||||
#include "stdafx.h"
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const QCommandLineOption Estimate::AdvancedOption =
|
const QCommandLineOption Estimate::AdvancedOption =
|
||||||
QCommandLineOption(QStringList() << "a"
|
QCommandLineOption(QStringList() << "a"
|
||||||
|
@ -17,10 +17,6 @@
|
|||||||
|
|
||||||
#include "Exit.h"
|
#include "Exit.h"
|
||||||
|
|
||||||
#include <QCommandLineParser>
|
|
||||||
#include <QObject>
|
|
||||||
#include <QtGlobal>
|
|
||||||
|
|
||||||
Exit::Exit(const QString& name)
|
Exit::Exit(const QString& name)
|
||||||
{
|
{
|
||||||
this->name = name;
|
this->name = name;
|
||||||
|
@ -15,14 +15,10 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "Export.h"
|
#include "Export.h"
|
||||||
|
|
||||||
#include "cli/TextStream.h"
|
#include "TextStream.h"
|
||||||
#include "cli/Utils.h"
|
#include "Utils.h"
|
||||||
#include "core/Database.h"
|
|
||||||
#include "format/CsvExporter.h"
|
#include "format/CsvExporter.h"
|
||||||
|
|
||||||
const QCommandLineOption Export::FormatOption = QCommandLineOption(
|
const QCommandLineOption Export::FormatOption = QCommandLineOption(
|
||||||
|
@ -15,13 +15,10 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "Generate.h"
|
#include "Generate.h"
|
||||||
|
|
||||||
#include "cli/TextStream.h"
|
#include "TextStream.h"
|
||||||
#include "cli/Utils.h"
|
#include "Utils.h"
|
||||||
|
|
||||||
const QCommandLineOption Generate::PasswordLengthOption =
|
const QCommandLineOption Generate::PasswordLengthOption =
|
||||||
QCommandLineOption(QStringList() << "L"
|
QCommandLineOption(QStringList() << "L"
|
||||||
|
@ -17,8 +17,6 @@
|
|||||||
|
|
||||||
#include "Help.h"
|
#include "Help.h"
|
||||||
|
|
||||||
#include "Command.h"
|
|
||||||
#include "TextStream.h"
|
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
|
||||||
Help::Help()
|
Help::Help()
|
||||||
|
@ -15,22 +15,12 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include <QFileInfo>
|
|
||||||
#include <QString>
|
|
||||||
#include <QTextStream>
|
|
||||||
|
|
||||||
#include "Create.h"
|
|
||||||
#include "Import.h"
|
#include "Import.h"
|
||||||
|
|
||||||
#include "cli/TextStream.h"
|
#include "Create.h"
|
||||||
#include "cli/Utils.h"
|
#include "Utils.h"
|
||||||
#include "core/Database.h"
|
|
||||||
#include "keys/CompositeKey.h"
|
#include <QFileInfo>
|
||||||
#include "keys/FileKey.h"
|
|
||||||
#include "keys/Key.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a database file from an XML export of another database.
|
* Create a database file from an XML export of another database.
|
||||||
|
@ -14,16 +14,12 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include <cstdlib>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "Info.h"
|
#include "Info.h"
|
||||||
#include "Utils.h"
|
|
||||||
|
|
||||||
#include "core/Database.h"
|
#include "Utils.h"
|
||||||
#include "core/Global.h"
|
#include "core/Global.h"
|
||||||
#include "core/Metadata.h"
|
#include "core/Metadata.h"
|
||||||
#include "format/KeePass2.h"
|
|
||||||
|
|
||||||
Info::Info()
|
Info::Info()
|
||||||
{
|
{
|
||||||
|
@ -15,15 +15,9 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "List.h"
|
#include "List.h"
|
||||||
#include "cli/Utils.h"
|
|
||||||
|
|
||||||
#include "cli/TextStream.h"
|
#include "Utils.h"
|
||||||
#include "core/Database.h"
|
|
||||||
#include "core/Entry.h"
|
|
||||||
#include "core/Group.h"
|
#include "core/Group.h"
|
||||||
|
|
||||||
const QCommandLineOption List::RecursiveOption =
|
const QCommandLineOption List::RecursiveOption =
|
||||||
|
@ -15,18 +15,12 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "Locate.h"
|
#include "Locate.h"
|
||||||
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
#include "cli/TextStream.h"
|
#include "TextStream.h"
|
||||||
#include "cli/Utils.h"
|
#include "Utils.h"
|
||||||
#include "core/Database.h"
|
|
||||||
#include "core/Entry.h"
|
|
||||||
#include "core/Global.h"
|
|
||||||
#include "core/Group.h"
|
#include "core/Group.h"
|
||||||
|
|
||||||
Locate::Locate()
|
Locate::Locate()
|
||||||
|
@ -15,13 +15,10 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cstdlib>
|
|
||||||
|
|
||||||
#include "Merge.h"
|
#include "Merge.h"
|
||||||
|
|
||||||
#include "cli/TextStream.h"
|
#include "TextStream.h"
|
||||||
#include "cli/Utils.h"
|
#include "Utils.h"
|
||||||
#include "core/Database.h"
|
|
||||||
#include "core/Merger.h"
|
#include "core/Merger.h"
|
||||||
|
|
||||||
const QCommandLineOption Merge::SameCredentialsOption =
|
const QCommandLineOption Merge::SameCredentialsOption =
|
||||||
|
@ -15,14 +15,10 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "Move.h"
|
#include "Move.h"
|
||||||
|
|
||||||
#include "cli/TextStream.h"
|
#include "TextStream.h"
|
||||||
#include "cli/Utils.h"
|
#include "Utils.h"
|
||||||
#include "core/Database.h"
|
|
||||||
#include "core/Entry.h"
|
#include "core/Entry.h"
|
||||||
#include "core/Group.h"
|
#include "core/Group.h"
|
||||||
|
|
||||||
|
@ -17,12 +17,6 @@
|
|||||||
|
|
||||||
#include "Open.h"
|
#include "Open.h"
|
||||||
|
|
||||||
#include <QCommandLineParser>
|
|
||||||
|
|
||||||
#include "DatabaseCommand.h"
|
|
||||||
#include "TextStream.h"
|
|
||||||
#include "Utils.h"
|
|
||||||
|
|
||||||
Open::Open()
|
Open::Open()
|
||||||
{
|
{
|
||||||
name = QString("open");
|
name = QString("open");
|
||||||
|
@ -15,18 +15,12 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "Remove.h"
|
#include "Remove.h"
|
||||||
|
|
||||||
#include "cli/TextStream.h"
|
#include "TextStream.h"
|
||||||
#include "cli/Utils.h"
|
#include "Utils.h"
|
||||||
#include "core/Database.h"
|
|
||||||
#include "core/Entry.h"
|
|
||||||
#include "core/Group.h"
|
#include "core/Group.h"
|
||||||
#include "core/Metadata.h"
|
#include "core/Metadata.h"
|
||||||
#include "core/Tools.h"
|
|
||||||
|
|
||||||
Remove::Remove()
|
Remove::Remove()
|
||||||
{
|
{
|
||||||
|
@ -15,18 +15,12 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "RemoveGroup.h"
|
#include "RemoveGroup.h"
|
||||||
|
|
||||||
#include "cli/TextStream.h"
|
#include "TextStream.h"
|
||||||
#include "cli/Utils.h"
|
#include "Utils.h"
|
||||||
#include "core/Database.h"
|
|
||||||
#include "core/Entry.h"
|
|
||||||
#include "core/Group.h"
|
#include "core/Group.h"
|
||||||
#include "core/Metadata.h"
|
#include "core/Metadata.h"
|
||||||
#include "core/Tools.h"
|
|
||||||
|
|
||||||
RemoveGroup::RemoveGroup()
|
RemoveGroup::RemoveGroup()
|
||||||
{
|
{
|
||||||
|
@ -17,18 +17,9 @@
|
|||||||
|
|
||||||
#include "Show.h"
|
#include "Show.h"
|
||||||
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
#include "cli/TextStream.h"
|
|
||||||
#include "core/Database.h"
|
|
||||||
#include "core/Entry.h"
|
|
||||||
#include "core/Global.h"
|
|
||||||
#include "core/Group.h"
|
#include "core/Group.h"
|
||||||
|
|
||||||
#include <QLocale>
|
|
||||||
|
|
||||||
const QCommandLineOption Show::TotpOption = QCommandLineOption(QStringList() << "t"
|
const QCommandLineOption Show::TotpOption = QCommandLineOption(QStringList() << "t"
|
||||||
<< "totp",
|
<< "totp",
|
||||||
QObject::tr("Show the entry's current TOTP."));
|
QObject::tr("Show the entry's current TOTP."));
|
||||||
|
@ -17,6 +17,11 @@
|
|||||||
|
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
|
||||||
|
#include "core/Database.h"
|
||||||
|
#include "core/EntryAttributes.h"
|
||||||
|
#include "keys/CompositeKey.h"
|
||||||
|
#include "keys/FileKey.h"
|
||||||
|
#include "keys/PasswordKey.h"
|
||||||
#ifdef WITH_XC_YUBIKEY
|
#ifdef WITH_XC_YUBIKEY
|
||||||
#include "keys/YkChallengeResponseKey.h"
|
#include "keys/YkChallengeResponseKey.h"
|
||||||
#endif
|
#endif
|
||||||
@ -30,7 +35,7 @@
|
|||||||
|
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QScopedPointer>
|
#include <QTextStream>
|
||||||
|
|
||||||
namespace Utils
|
namespace Utils
|
||||||
{
|
{
|
||||||
@ -91,7 +96,7 @@ namespace Utils
|
|||||||
}
|
}
|
||||||
|
|
||||||
QSharedPointer<Database> unlockDatabase(const QString& databaseFilename,
|
QSharedPointer<Database> unlockDatabase(const QString& databaseFilename,
|
||||||
const bool isPasswordProtected,
|
bool isPasswordProtected,
|
||||||
const QString& keyFilename,
|
const QString& keyFilename,
|
||||||
const QString& yubiKeySlot,
|
const QString& yubiKeySlot,
|
||||||
bool quiet)
|
bool quiet)
|
||||||
@ -289,7 +294,7 @@ namespace Utils
|
|||||||
|
|
||||||
QStringList failedProgramNames;
|
QStringList failedProgramNames;
|
||||||
|
|
||||||
for (auto prog : clipPrograms) {
|
for (const auto& prog : clipPrograms) {
|
||||||
QScopedPointer<QProcess> clipProcess(new QProcess(nullptr));
|
QScopedPointer<QProcess> clipProcess(new QProcess(nullptr));
|
||||||
|
|
||||||
// Skip empty parts, otherwise the program may clip the empty string
|
// Skip empty parts, otherwise the program may clip the empty string
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
#ifndef KEEPASSXC_UTILS_H
|
#ifndef KEEPASSXC_UTILS_H
|
||||||
#define KEEPASSXC_UTILS_H
|
#define KEEPASSXC_UTILS_H
|
||||||
|
|
||||||
#include "cli/TextStream.h"
|
#include <QTextStream>
|
||||||
#include "core/Database.h"
|
|
||||||
#include "core/EntryAttributes.h"
|
class CompositeKey;
|
||||||
#include "keys/CompositeKey.h"
|
class Database;
|
||||||
#include "keys/FileKey.h"
|
class EntryAttributes;
|
||||||
#include "keys/PasswordKey.h"
|
class FileKey;
|
||||||
#include <QtCore/qglobal.h>
|
class PasswordKey;
|
||||||
|
|
||||||
namespace Utils
|
namespace Utils
|
||||||
{
|
{
|
||||||
@ -41,7 +41,7 @@ namespace Utils
|
|||||||
QSharedPointer<PasswordKey> getConfirmedPassword();
|
QSharedPointer<PasswordKey> getConfirmedPassword();
|
||||||
int clipText(const QString& text);
|
int clipText(const QString& text);
|
||||||
QSharedPointer<Database> unlockDatabase(const QString& databaseFilename,
|
QSharedPointer<Database> unlockDatabase(const QString& databaseFilename,
|
||||||
const bool isPasswordProtected = true,
|
bool isPasswordProtected = true,
|
||||||
const QString& keyFilename = {},
|
const QString& keyFilename = {},
|
||||||
const QString& yubiKeySlot = {},
|
const QString& yubiKeySlot = {},
|
||||||
bool quiet = false);
|
bool quiet = false);
|
||||||
|
@ -15,20 +15,14 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#include <QCommandLineParser>
|
#include <QCommandLineParser>
|
||||||
#include <QCoreApplication>
|
#include <QFileInfo>
|
||||||
#include <QDir>
|
|
||||||
#include <QScopedPointer>
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
#include "cli/TextStream.h"
|
#include "Command.h"
|
||||||
#include <cli/Command.h>
|
|
||||||
|
|
||||||
#include "DatabaseCommand.h"
|
#include "DatabaseCommand.h"
|
||||||
#include "Open.h"
|
#include "Open.h"
|
||||||
|
#include "TextStream.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
#include "config-keepassx.h"
|
#include "config-keepassx.h"
|
||||||
#include "core/Bootstrap.h"
|
#include "core/Bootstrap.h"
|
||||||
@ -165,10 +159,9 @@ void enterInteractiveMode(const QStringList& arguments)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd->currentDatabase = currentDatabase;
|
cmd->currentDatabase.swap(currentDatabase);
|
||||||
cmd->execute(args);
|
cmd->execute(args);
|
||||||
currentDatabase = cmd->currentDatabase;
|
currentDatabase.swap(cmd->currentDatabase);
|
||||||
cmd->currentDatabase.reset();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentDatabase) {
|
if (currentDatabase) {
|
||||||
@ -179,7 +172,7 @@ void enterInteractiveMode(const QStringList& arguments)
|
|||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
if (!Crypto::init()) {
|
if (!Crypto::init()) {
|
||||||
qFatal("Fatal error while testing the cryptographic functions:\n%s", qPrintable(Crypto::errorString()));
|
qWarning("Fatal error while testing the cryptographic functions:\n%s", qPrintable(Crypto::errorString()));
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,18 +21,17 @@
|
|||||||
#include "core/Bootstrap.h"
|
#include "core/Bootstrap.h"
|
||||||
#include "core/Config.h"
|
#include "core/Config.h"
|
||||||
#include "core/Entry.h"
|
#include "core/Entry.h"
|
||||||
#include "core/Global.h"
|
|
||||||
#include "core/Group.h"
|
#include "core/Group.h"
|
||||||
#include "core/Metadata.h"
|
#include "core/Metadata.h"
|
||||||
#include "core/Tools.h"
|
#include "core/Tools.h"
|
||||||
#include "crypto/Crypto.h"
|
#include "crypto/Crypto.h"
|
||||||
|
#include "keys/FileKey.h"
|
||||||
#include "keys/drivers/YubiKey.h"
|
#include "keys/drivers/YubiKey.h"
|
||||||
|
|
||||||
#include "cli/Add.h"
|
#include "cli/Add.h"
|
||||||
#include "cli/AddGroup.h"
|
#include "cli/AddGroup.h"
|
||||||
#include "cli/Analyze.h"
|
#include "cli/Analyze.h"
|
||||||
#include "cli/Clip.h"
|
#include "cli/Clip.h"
|
||||||
#include "cli/Command.h"
|
|
||||||
#include "cli/Create.h"
|
#include "cli/Create.h"
|
||||||
#include "cli/Diceware.h"
|
#include "cli/Diceware.h"
|
||||||
#include "cli/Edit.h"
|
#include "cli/Edit.h"
|
||||||
@ -53,16 +52,11 @@
|
|||||||
#include "cli/Utils.h"
|
#include "cli/Utils.h"
|
||||||
|
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include <QFuture>
|
|
||||||
#include <QSet>
|
|
||||||
#include <QSignalSpy>
|
#include <QSignalSpy>
|
||||||
#include <QTextStream>
|
|
||||||
#include <QtConcurrent>
|
#include <QtConcurrent>
|
||||||
|
|
||||||
QTEST_MAIN(TestCli)
|
QTEST_MAIN(TestCli)
|
||||||
|
|
||||||
QSharedPointer<Database> globalCurrentDatabase;
|
|
||||||
|
|
||||||
void TestCli::initTestCase()
|
void TestCli::initTestCase()
|
||||||
{
|
{
|
||||||
QVERIFY(Crypto::init());
|
QVERIFY(Crypto::init());
|
||||||
|
Loading…
Reference in New Issue
Block a user