From e3b7cf162be05364bd996a5591e56b62378373ca Mon Sep 17 00:00:00 2001 From: Syping Date: Sun, 25 Oct 2020 16:35:15 +0100 Subject: [PATCH] add -t test function --- src/main.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 71f7d76..00088aa 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -36,7 +36,7 @@ int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); a.setApplicationName("checkbrute"); - a.setApplicationVersion("0.3"); + a.setApplicationVersion("0.3.1"); QCommandLineParser commandLineParser; commandLineParser.addHelpOption(); @@ -49,7 +49,8 @@ int main(int argc, char *argv[]) QCommandLineOption lengthsOption = QCommandLineOption("lengths", "Lengths to use for bruteforcing.", "lengths"); QCommandLineOption threadsOption = QCommandLineOption("threads", "Threads to use for bruteforcing.", "threads"); QCommandLineOption strictOption = QCommandLineOption(QStringList() << "s" << "strict", "Match checksums strict."); - commandLineParser.addOptions(QList() << algorithmsOption << startOption << stopOption << lengthsOption << threadsOption << strictOption); + QCommandLineOption testOption = QCommandLineOption(QStringList() << "t" << "test", "Test checkbrute plugin hashes."); + commandLineParser.addOptions(QList() << algorithmsOption << startOption << stopOption << lengthsOption << threadsOption << strictOption << testOption); commandLineParser.process(a); QTextStream(stderr) << "INFO: Launch " << a.applicationName() << " " << a.applicationVersion() << "..." << Qt::endl; @@ -62,6 +63,7 @@ int main(int argc, char *argv[]) const QString bruteforceFile = args.at(0); const QString checksumsFile = args.at(1); const bool strictHash = commandLineParser.isSet(strictOption); + const bool testEnabled = commandLineParser.isSet(testOption); if (strictHash) { QTextStream(stderr) << "INFO: Strict matching enabled" << Qt::endl; @@ -123,6 +125,8 @@ int main(int argc, char *argv[]) version = QString::fromUtf8(versionFunc()); checksum_map[format] = new checksum_lib(formatFunc, hash32Func, hashSzFunc); QTextStream(stderr) << "INFO: " << format << " plugin " << fileName << " loaded" << Qt::endl; + if (testEnabled) + QTextStream(stderr) << "TEST: " << format << " checkbrute -> " << QString::number(hash32Func((unsigned char*)"checkbrute", 7), 16) << Qt::endl; } else if (formatFunc && hash64Func && hashSzFunc) { QString version = "undefined"; @@ -131,6 +135,8 @@ int main(int argc, char *argv[]) version = QString::fromUtf8(versionFunc()); checksum_map[format] = new checksum_lib(formatFunc, hash64Func, hashSzFunc); QTextStream(stderr) << "INFO: " << format << " plugin " << fileName << " loaded" << Qt::endl; + if (testEnabled) + QTextStream(stderr) << "TEST: " << format << " checkbrute -> " << QString::number(hash64Func((unsigned char*)"checkbrute", 7), 16) << Qt::endl; } else { QTextStream(stderr) << "WARNING: Failed loading plugin " << fileName << "!" << Qt::endl;