├── README.md ├── release_version.txt ├── icons ├── main.ico └── main.icns ├── winloader_source ├── rsrc.rc └── winloader.cpp ├── NFD_sort_source.pro ├── gui_source ├── gui_source.pro ├── main_gui.cpp ├── dialogscanprogress.h ├── dialogscanprogress.cpp ├── scanprogress.h ├── guimainwindow.h ├── dialogscanprogress.ui ├── scanprogress.cpp ├── guimainwindow.cpp └── guimainwindow.ui ├── LICENSE ├── .gitmodules └── global.h /README.md: -------------------------------------------------------------------------------- 1 | NFD-sort 2 | -------------------------------------------------------------------------------- /release_version.txt: -------------------------------------------------------------------------------- 1 | 0.02 -------------------------------------------------------------------------------- /icons/main.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horsicq/NFD-sort/master/icons/main.ico -------------------------------------------------------------------------------- /icons/main.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horsicq/NFD-sort/master/icons/main.icns -------------------------------------------------------------------------------- /winloader_source/rsrc.rc: -------------------------------------------------------------------------------- 1 | 500 ICON MOVEABLE PURE LOADONCALL DISCARDABLE "..\icons\main.ico" -------------------------------------------------------------------------------- /NFD_sort_source.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | 3 | SUBDIRS += build_libs 4 | SUBDIRS += gui_source 5 | -------------------------------------------------------------------------------- /gui_source/gui_source.pro: -------------------------------------------------------------------------------- 1 | QT += core gui sql concurrent 2 | 3 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 4 | 5 | TARGET = nfd-sort 6 | TEMPLATE = app 7 | 8 | SOURCES += \ 9 | guimainwindow.cpp \ 10 | main_gui.cpp \ 11 | dialogscanprogress.cpp \ 12 | scanprogress.cpp 13 | 14 | HEADERS += \ 15 | guimainwindow.h \ 16 | ../global.h \ 17 | dialogscanprogress.h \ 18 | scanprogress.h 19 | 20 | FORMS += \ 21 | guimainwindow.ui \ 22 | dialogscanprogress.ui 23 | 24 | !contains(XCONFIG, specabstract) { 25 | XCONFIG += specabstract 26 | include(../../_mylibs/SpecAbstract/specabstract.pri) 27 | } 28 | 29 | include(../build.pri) 30 | 31 | win32 { 32 | RC_ICONS = ../icons/main.ico 33 | } 34 | 35 | macx { 36 | ICON = ../icons/main.icns 37 | } 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019-2025 hors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "StaticScan"] 2 | path = StaticScan 3 | url = https://github.com/horsicq/StaticScan.git 4 | [submodule "XArchive"] 5 | path = XArchive 6 | url = https://github.com/horsicq/XArchive.git 7 | [submodule "SpecAbstract"] 8 | path = SpecAbstract 9 | url = https://github.com/horsicq/SpecAbstract.git 10 | [submodule "Formats"] 11 | path = Formats 12 | url = https://github.com/horsicq/Formats.git 13 | [submodule "XDEX"] 14 | path = XDEX 15 | url = https://github.com/horsicq/XDEX.git 16 | [submodule "XShortcuts"] 17 | path = XShortcuts 18 | url = https://github.com/horsicq/XShortcuts.git 19 | [submodule "XPDF"] 20 | path = XPDF 21 | url = https://github.com/horsicq/XPDF 22 | [submodule "XUpdate"] 23 | path = XUpdate 24 | url = https://github.com/horsicq/XUpdate 25 | [submodule "XGithub"] 26 | path = XGithub 27 | url = https://github.com/horsicq/XGithub 28 | [submodule "XExtractor"] 29 | path = XExtractor 30 | url = https://github.com/horsicq/XExtractor 31 | [submodule "XScanEngine"] 32 | path = XScanEngine 33 | url = https://github.com/horsicq/XScanEngine 34 | [submodule "XDisasmCore"] 35 | path = XDisasmCore 36 | url = https://github.com/horsicq/XDisasmCore.git 37 | -------------------------------------------------------------------------------- /global.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019-2023 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #ifndef GLOBAL_H 22 | #define GLOBAL_H 23 | 24 | #define X_APPLICATIONNAME "NFD-sort" 25 | #define X_APPLICATIONVERSION "0.02" 26 | #define X_ORGANIZATIONNAME "NTInfo" 27 | #define X_ORGANIZATIONDOMAIN "ntinfo.biz" 28 | 29 | #endif // GLOBAL_H 30 | -------------------------------------------------------------------------------- /gui_source/main_gui.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019-2023 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #include 22 | #include 23 | 24 | #include "guimainwindow.h" 25 | 26 | int main(int argc, char *argv[]) 27 | { 28 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 29 | #ifdef Q_OS_MAC 30 | #ifndef QT_DEBUG 31 | QString sLibraryPath = QString(argv[0]); 32 | sLibraryPath = sLibraryPath.remove("MacOS/nfd-sort") + "PlugIns"; 33 | QCoreApplication::setLibraryPaths(QStringList(sLibraryPath)); 34 | #endif 35 | #endif 36 | 37 | QCoreApplication::setOrganizationName(X_ORGANIZATIONNAME); 38 | QCoreApplication::setOrganizationDomain(X_ORGANIZATIONDOMAIN); 39 | QCoreApplication::setApplicationName(X_APPLICATIONNAME); 40 | QCoreApplication::setApplicationVersion(X_APPLICATIONVERSION); 41 | 42 | QApplication a(argc, argv); 43 | QApplication::setStyle(QStyleFactory::create("Fusion")); 44 | 45 | GuiMainWindow w; 46 | w.show(); 47 | 48 | return a.exec(); 49 | } 50 | -------------------------------------------------------------------------------- /gui_source/dialogscanprogress.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019-2023 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #ifndef DIALOGSCANPROGRESS_H 22 | #define DIALOGSCANPROGRESS_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #include "scanprogress.h" 30 | 31 | namespace Ui { 32 | class DialogScanProgress; 33 | } 34 | 35 | class DialogScanProgress : public QDialog { 36 | Q_OBJECT 37 | 38 | public: 39 | explicit DialogScanProgress(QWidget *parent = 0); 40 | ~DialogScanProgress(); 41 | 42 | void setData(QString sDirectoryName, ScanProgress::SCAN_OPTIONS *pOptions); 43 | 44 | private slots: 45 | void on_pushButtonCancel_clicked(); 46 | void onCompleted(qint64 nElapsed); 47 | void onSetProgressMaximum(int nValue); 48 | void onSetProgressValue(int nValue); 49 | void timerSlot(); 50 | 51 | private: 52 | Ui::DialogScanProgress *ui; 53 | ScanProgress *pScan; 54 | QThread *pThread; 55 | bool bIsRun; 56 | QTimer *pTimer; 57 | }; 58 | 59 | #endif // DIALOGSCANPROGRESS_H 60 | -------------------------------------------------------------------------------- /winloader_source/winloader.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-2023 hors 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to deal 5 | // in the Software without restriction, including without limitation the rights 6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | // copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | 10 | // The above copyright notice and this permission notice shall be included in all 11 | // copies or substantial portions of the Software. 12 | 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | // SOFTWARE. 20 | // 21 | #include 22 | 23 | void GetWorkDirectory(char *pszModuleName, char *pszWorkDirectory) 24 | { 25 | int nTotalNumberOfSlashes = 0; 26 | char *pOffset = pszModuleName; 27 | 28 | while (*pOffset) { 29 | if (*pOffset == '\\') { 30 | nTotalNumberOfSlashes++; 31 | } 32 | pOffset++; 33 | } 34 | 35 | int nCurrentNumberOfSlashes = 0; 36 | 37 | while (*pszModuleName) { 38 | if (*pszModuleName == '\\') { 39 | nCurrentNumberOfSlashes++; 40 | if (nCurrentNumberOfSlashes == nTotalNumberOfSlashes) { 41 | *pszWorkDirectory = 0; 42 | break; 43 | } 44 | } 45 | *pszWorkDirectory = *pszModuleName; 46 | pszModuleName++; 47 | pszWorkDirectory++; 48 | } 49 | } 50 | 51 | void entry() 52 | { 53 | char szModuleFileName[256]; 54 | char szWorkDirectory[256]; 55 | char szArgument[256]; 56 | 57 | char *szFile = "\\base\\nfd-sort.exe"; 58 | char *szStuff = "\\base\\"; 59 | 60 | char *pszCommandLine = GetCommandLineA(); 61 | GetModuleFileName(0, szModuleFileName, sizeof(szModuleFileName) - 1); 62 | 63 | int nFileNameLength = lstrlenA(szModuleFileName); 64 | 65 | if (*(pszCommandLine + nFileNameLength + 2)) { 66 | lstrcpyA(szArgument, pszCommandLine + nFileNameLength + 3); 67 | } 68 | 69 | GetWorkDirectory(szModuleFileName, szWorkDirectory); 70 | lstrcpyA(szModuleFileName, szWorkDirectory); 71 | lstrcatA(szModuleFileName, szFile); 72 | lstrcatA(szWorkDirectory, szStuff); 73 | 74 | if (ShellExecuteA(0, 0, szModuleFileName, szArgument, szWorkDirectory, SW_SHOW) <= (HINSTANCE)32) { 75 | MessageBoxA(0, szModuleFileName, "Cannot open", MB_ICONERROR); 76 | } 77 | 78 | ExitProcess(0); 79 | } 80 | -------------------------------------------------------------------------------- /gui_source/dialogscanprogress.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019-2023 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #include "dialogscanprogress.h" 22 | 23 | #include "ui_dialogscanprogress.h" 24 | 25 | DialogScanProgress::DialogScanProgress(QWidget *parent) : QDialog(parent), ui(new Ui::DialogScanProgress) 26 | { 27 | ui->setupUi(this); 28 | 29 | pScan = new ScanProgress; 30 | pThread = new QThread; 31 | 32 | pScan->moveToThread(pThread); 33 | 34 | connect(pThread, SIGNAL(started()), pScan, SLOT(process())); 35 | connect(pScan, SIGNAL(completed(qint64)), this, SLOT(onCompleted(qint64))); 36 | bIsRun = false; 37 | 38 | pTimer = new QTimer(this); 39 | connect(pTimer, SIGNAL(timeout()), this, SLOT(timerSlot())); 40 | } 41 | 42 | DialogScanProgress::~DialogScanProgress() 43 | { 44 | if (bIsRun) { 45 | pScan->stop(); 46 | } 47 | 48 | pTimer->stop(); 49 | 50 | pThread->quit(); 51 | pThread->wait(); 52 | 53 | delete ui; 54 | 55 | delete pThread; 56 | delete pScan; 57 | } 58 | 59 | void DialogScanProgress::setData(QString sDirectoryName, ScanProgress::SCAN_OPTIONS *pOptions) 60 | { 61 | bIsRun = true; 62 | pScan->setData(sDirectoryName, pOptions); 63 | pThread->start(); 64 | pTimer->start(1000); 65 | ui->progressBarTotal->setMaximum(100); 66 | } 67 | 68 | void DialogScanProgress::on_pushButtonCancel_clicked() 69 | { 70 | if (bIsRun) { 71 | pScan->stop(); 72 | bIsRun = false; 73 | } 74 | } 75 | 76 | void DialogScanProgress::onCompleted(qint64 nElapsed) 77 | { 78 | Q_UNUSED(nElapsed) 79 | 80 | bIsRun = false; 81 | pTimer->stop(); 82 | this->close(); 83 | } 84 | 85 | void DialogScanProgress::onSetProgressMaximum(int nValue) 86 | { 87 | ui->progressBarTotal->setMaximum(nValue); 88 | } 89 | 90 | void DialogScanProgress::onSetProgressValue(int nValue) 91 | { 92 | ui->progressBarTotal->setMaximum(nValue); 93 | } 94 | 95 | void DialogScanProgress::timerSlot() 96 | { 97 | ScanProgress::STATS stats = pScan->getCurrentStats(); 98 | 99 | ui->labelTotal->setText(QString::number(stats.nTotal)); 100 | ui->labelCurrent->setText(QString::number(stats.nCurrent)); 101 | ui->labelThreads->setText(QString::number(stats.nNumberOfThreads)); 102 | 103 | ui->labelCurrentStatus->setText(stats.sStatus); 104 | 105 | if (stats.nTotal) { 106 | ui->progressBarTotal->setValue((int)((stats.nCurrent * 100) / stats.nTotal)); 107 | } 108 | 109 | QDateTime dt; 110 | dt.setMSecsSinceEpoch(stats.nElapsed); 111 | QString sDateTime = dt.time().addSecs(-60 * 60).toString("hh:mm:ss"); 112 | 113 | ui->labelTime->setText(sDateTime); 114 | } 115 | -------------------------------------------------------------------------------- /gui_source/scanprogress.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019-2023 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #ifndef SCANPROGRESS_H 22 | #define SCANPROGRESS_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | #include "staticscan.h" 35 | 36 | class ScanProgress : public QObject { 37 | Q_OBJECT 38 | public: 39 | enum CF { 40 | CF_FT_TYPE_NAME = 0, 41 | CF_ARCH_FT_TYPE_NAME, 42 | CF_FT_ARCH_TYPE_NAME 43 | }; 44 | 45 | enum CT { 46 | CT_IDENT = 0, 47 | CT_IDENT_UNK, 48 | CT_UNK 49 | }; 50 | 51 | enum UP { 52 | UP_NONE = 0, 53 | UP_EP_BYTES, 54 | UP_HEADER_BYTES, 55 | UP_OVERLAY_BYTES 56 | }; 57 | 58 | enum FF { 59 | FF_ORIGINAL = 0, 60 | FF_MD5, 61 | FF_MD5_ORIGINAL 62 | }; 63 | 64 | struct SCAN_OPTIONS { 65 | bool bRecursive; 66 | bool bDeepScan; 67 | bool bSubdirectories; 68 | bool bHeuristic; 69 | bool bVerbose; 70 | QSet stFileTypes; 71 | bool bAllTypes; 72 | QSet stTypes; 73 | qint32 nCopyCount; 74 | QString sResultDirectory; 75 | QSqlDatabase dbSQLLite; 76 | bool bContinue; 77 | bool bDebug; 78 | bool bIsTest; 79 | CF copyFormat; 80 | CT copyType; 81 | FF fileFormat; 82 | bool bRemoveCopied; 83 | }; 84 | struct STATS { 85 | qint32 nTotal; 86 | qint32 nCurrent; 87 | qint64 nElapsed; 88 | QString sStatus; 89 | qint32 nNumberOfThreads; 90 | }; 91 | 92 | explicit ScanProgress(QObject *parent = nullptr); 93 | 94 | void setData(QString sDirectoryName, ScanProgress::SCAN_OPTIONS *pOptions); 95 | 96 | quint32 getFileCount(quint32 nCRC); 97 | void setFileCount(quint32 nCRC, quint32 nCount); 98 | void setFileStat(QString sFileName, QString sTimeCount, QString sDate); 99 | void createTables(); 100 | QString getCurrentFileName(); 101 | QString getCurrentFileNameAndLock(); 102 | qint64 getNumberOfFile(); 103 | void findFiles(QString sDirectoryName); 104 | 105 | void startTransaction(); 106 | void endTransaction(); 107 | 108 | void _processFile(QString sFileName); 109 | 110 | static QString createPath(CF copyFormat, XScanEngine::SCANSTRUCT ss); 111 | 112 | private slots: 113 | void scan_finished(); 114 | 115 | signals: 116 | void completed(qint64 nElapsedTime); 117 | 118 | public slots: 119 | void process(); 120 | void stop(); 121 | STATS getCurrentStats(); 122 | static bool createDatabase(QSqlDatabase *pDb, QString sDatabaseName); 123 | 124 | private: 125 | // const int N_MAXNUMBEROFTHREADS = 8; 126 | #ifdef Q_OS_WIN 127 | const int N_MAXNUMBEROFTHREADS = 8; 128 | #else 129 | const int N_MAXNUMBEROFTHREADS = 1; 130 | #endif 131 | QString _sDirectoryName; 132 | SCAN_OPTIONS *_pOptions; 133 | bool bIsStop; 134 | STATS currentStats; 135 | QElapsedTimer *pElapsedTimer; 136 | QMutex mutex; 137 | QSemaphore *pSemaphore; 138 | }; 139 | 140 | #endif // SCANPROGRESS_H 141 | -------------------------------------------------------------------------------- /gui_source/guimainwindow.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019-2023 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #ifndef GUIMAINWINDOW_H 22 | #define GUIMAINWINDOW_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #include "../global.h" 30 | #include "dialogscanprogress.h" 31 | #include "staticscan.h" 32 | 33 | namespace Ui { 34 | class GuiMainWindow; 35 | } 36 | 37 | class GuiMainWindow : public QMainWindow { 38 | Q_OBJECT 39 | 40 | public: 41 | explicit GuiMainWindow(QWidget *parent = nullptr); 42 | ~GuiMainWindow(); 43 | 44 | private slots: 45 | void on_pushButtonExit_clicked(); 46 | void on_pushButtonOpenDirectory_clicked(); 47 | void on_pushButtonOut_clicked(); 48 | void on_pushButtonScan_clicked(); 49 | void _scan(); 50 | 51 | void on_checkBoxAllFileTypes_toggled(bool checked); 52 | void on_checkBoxBinary_toggled(bool checked); 53 | void on_checkBoxMSDOS_toggled(bool checked); 54 | void on_checkBoxPE32_toggled(bool checked); 55 | void on_checkBoxPE64_toggled(bool checked); 56 | void on_checkBoxELF32_toggled(bool checked); 57 | void on_checkBoxELF64_toggled(bool checked); 58 | void on_checkBoxMACHO32_toggled(bool checked); 59 | void on_checkBoxMACHO64_toggled(bool checked); 60 | void on_checkBoxJAR_toggled(bool checked); 61 | void on_checkBoxAPK_toggled(bool checked); 62 | void on_checkBoxDEX_toggled(bool checked); 63 | void on_checkBoxAllTypes_toggled(bool checked); 64 | void on_checkBoxArchive_toggled(bool checked); 65 | void on_checkBoxCertificate_toggled(bool checked); 66 | void on_checkBoxCompiler_toggled(bool checked); 67 | void on_checkBoxConverter_toggled(bool checked); 68 | void on_checkBoxDatabase_toggled(bool checked); 69 | void on_checkBoxDebugData_toggled(bool checked); 70 | void on_checkBoxDongleProtection_toggled(bool checked); 71 | void on_checkBoxDOSExtender_toggled(bool checked); 72 | void on_checkBoxFormat_toggled(bool checked); 73 | void on_checkBoxGeneric_toggled(bool checked); 74 | void on_checkBoxImage_toggled(bool checked); 75 | void on_checkBoxInstaller_toggled(bool checked); 76 | void on_checkBoxInstallerData_toggled(bool checked); 77 | void on_checkBoxLibrary_toggled(bool checked); 78 | void on_checkBoxLinker_toggled(bool checked); 79 | void on_checkBoxNETObfuscator_toggled(bool checked); 80 | void on_checkBoxPacker_toggled(bool checked); 81 | void on_checkBoxProtector_toggled(bool checked); 82 | void on_checkBoxProtectorData_toggled(bool checked); 83 | void on_checkBoxSFX_toggled(bool checked); 84 | void on_checkBoxSFXData_toggled(bool checked); 85 | void on_checkBoxSignTool_toggled(bool checked); 86 | void on_checkBoxSourceCode_toggled(bool checked); 87 | void on_checkBoxStub_toggled(bool checked); 88 | void on_checkBoxTool_toggled(bool checked); 89 | void on_pushButtonInfo_clicked(); 90 | void on_checkBoxPETool_toggled(bool checked); 91 | void on_checkBoxJoiner_toggled(bool checked); 92 | void on_checkBoxNE_toggled(bool checked); 93 | void on_checkBoxText_toggled(bool checked); 94 | void on_checkBoxLE_toggled(bool checked); 95 | void on_checkBoxLX_toggled(bool checked); 96 | void on_checkBoxAPKTool_toggled(bool checked); 97 | void on_checkBoxOperationSystem_toggled(bool checked); 98 | 99 | private: 100 | Ui::GuiMainWindow *ui; 101 | 102 | ScanProgress::SCAN_OPTIONS options; 103 | }; 104 | 105 | #endif // GUIMAINWINDOW_H 106 | -------------------------------------------------------------------------------- /gui_source/dialogscanprogress.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | DialogScanProgress 4 | 5 | 6 | 7 | 0 8 | 0 9 | 617 10 | 117 11 | 12 | 13 | 14 | Scan progress 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 120 24 | 0 25 | 26 | 27 | 28 | 29 | 120 30 | 16777215 31 | 32 | 33 | 34 | QFrame::NoFrame 35 | 36 | 37 | 38 | 39 | 40 | Qt::AlignCenter 41 | 42 | 43 | 44 | 45 | 46 | 47 | Qt::Horizontal 48 | 49 | 50 | 51 | 40 52 | 20 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 70 62 | 0 63 | 64 | 65 | 66 | 67 | 70 68 | 16777215 69 | 70 | 71 | 72 | QFrame::NoFrame 73 | 74 | 75 | 76 | 77 | 78 | Qt::AlignCenter 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 70 87 | 0 88 | 89 | 90 | 91 | 92 | 70 93 | 16777215 94 | 95 | 96 | 97 | QFrame::NoFrame 98 | 99 | 100 | 101 | 102 | 103 | Qt::AlignCenter 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 70 112 | 0 113 | 114 | 115 | 116 | 117 | 70 118 | 16777215 119 | 120 | 121 | 122 | QFrame::NoFrame 123 | 124 | 125 | 126 | 127 | 128 | Qt::AlignCenter 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | QFrame::NoFrame 138 | 139 | 140 | QFrame::Plain 141 | 142 | 143 | 144 | 145 | 146 | Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter 147 | 148 | 149 | 150 | 151 | 152 | 153 | 0 154 | 155 | 156 | 0 157 | 158 | 159 | Qt::AlignCenter 160 | 161 | 162 | %v/%m 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | Qt::Horizontal 172 | 173 | 174 | 175 | 40 176 | 20 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | Cancel 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | -------------------------------------------------------------------------------- /gui_source/scanprogress.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019-2021 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #include "scanprogress.h" 22 | 23 | ScanProgress::ScanProgress(QObject *parent) : QObject(parent) 24 | { 25 | bIsStop = false; 26 | _pOptions = nullptr; 27 | currentStats = STATS(); 28 | pElapsedTimer = nullptr; 29 | pSemaphore = nullptr; 30 | // connect(&futureWatcher, SIGNAL(finished()), this, SLOT(scan_finished())); 31 | } 32 | 33 | void ScanProgress::setData(QString sDirectoryName, ScanProgress::SCAN_OPTIONS *pOptions) 34 | { 35 | this->_sDirectoryName = sDirectoryName; 36 | this->_pOptions = pOptions; 37 | } 38 | 39 | quint32 ScanProgress::getFileCount(quint32 nCRC) 40 | { 41 | QMutexLocker locker(&mutex); 42 | 43 | quint32 nResult = 0; 44 | 45 | QSqlQuery query(_pOptions->dbSQLLite); 46 | 47 | query.exec(QString("SELECT FILECOUNT FROM records where FILECRC='%1'").arg(nCRC)); 48 | 49 | if (query.next()) { 50 | nResult = query.value("FILECOUNT").toString().trimmed().toUInt(); 51 | } 52 | 53 | if (query.lastError().text().trimmed() != "") { 54 | qDebug(query.lastQuery().toLatin1().data()); 55 | qDebug(query.lastError().text().toLatin1().data()); 56 | } 57 | 58 | return nResult; 59 | } 60 | 61 | void ScanProgress::setFileCount(quint32 nCRC, quint32 nCount) 62 | { 63 | QMutexLocker locker(&mutex); 64 | 65 | QSqlQuery query(_pOptions->dbSQLLite); 66 | 67 | query.exec(QString("INSERT OR REPLACE INTO records(FILECRC,FILECOUNT) VALUES('%1','%2')").arg(nCRC).arg(nCount)); 68 | 69 | if (query.lastError().text().trimmed() != "") { 70 | qDebug(query.lastQuery().toLatin1().data()); 71 | qDebug(query.lastError().text().toLatin1().data()); 72 | } 73 | } 74 | 75 | void ScanProgress::setFileStat(QString sFileName, QString sTimeCount, QString sDate) 76 | { 77 | QMutexLocker locker(&mutex); 78 | 79 | QSqlQuery query(_pOptions->dbSQLLite); 80 | 81 | query.exec(QString("INSERT OR REPLACE INTO files(FILENAME,TIMECOUNT,DATETIME) VALUES('%1','%2','%3')").arg(sFileName.replace("'", "''")).arg(sTimeCount).arg(sDate)); 82 | 83 | // QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss") 84 | 85 | if (query.lastError().text().trimmed() != "") { 86 | qDebug(query.lastQuery().toLatin1().data()); 87 | qDebug(query.lastError().text().toLatin1().data()); 88 | } 89 | } 90 | 91 | void ScanProgress::createTables() 92 | { 93 | QMutexLocker locker(&mutex); 94 | 95 | QSqlQuery query(_pOptions->dbSQLLite); 96 | 97 | query.exec("DROP TABLE if exists records"); 98 | query.exec("DROP TABLE if exists files"); 99 | query.exec("CREATE TABLE if not exists records(FILECRC text,FILECOUNT text,PRIMARY KEY(FILECRC))"); 100 | query.exec("CREATE TABLE if not exists files(FILENAME text,TIMECOUNT text,DATETIME text,PRIMARY KEY(FILENAME))"); 101 | } 102 | 103 | QString ScanProgress::getCurrentFileName() 104 | { 105 | QMutexLocker locker(&mutex); 106 | 107 | QString sResult; 108 | 109 | QSqlQuery query(_pOptions->dbSQLLite); 110 | 111 | query.exec(QString("SELECT FILENAME FROM files where TIMECOUNT='' AND DATETIME='' LIMIT 1")); 112 | 113 | if (query.next()) { 114 | sResult = query.value("FILENAME").toString().trimmed(); 115 | } 116 | 117 | if (query.lastError().text().trimmed() != "") { 118 | qDebug(query.lastQuery().toLatin1().data()); 119 | qDebug(query.lastError().text().toLatin1().data()); 120 | } 121 | 122 | return sResult; 123 | } 124 | 125 | QString ScanProgress::getCurrentFileNameAndLock() 126 | { 127 | QMutexLocker locker(&mutex); 128 | 129 | QString sResult; 130 | 131 | QSqlQuery query(_pOptions->dbSQLLite); 132 | 133 | query.exec(QString("SELECT FILENAME FROM files where TIMECOUNT='' AND DATETIME='' LIMIT 1")); 134 | 135 | if (query.next()) { 136 | sResult = query.value("FILENAME").toString().trimmed(); 137 | } 138 | 139 | if (query.lastError().text().trimmed() != "") { 140 | qDebug(query.lastQuery().toLatin1().data()); 141 | qDebug(query.lastError().text().toLatin1().data()); 142 | } 143 | 144 | query.exec(QString("INSERT OR REPLACE INTO files(FILENAME,TIMECOUNT,DATETIME) VALUES('%1','%2','%3')") 145 | .arg(sResult.replace("'", "''")) 146 | .arg(0) 147 | .arg(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"))); 148 | 149 | if (query.lastError().text().trimmed() != "") { 150 | qDebug(query.lastQuery().toLatin1().data()); 151 | qDebug(query.lastError().text().toLatin1().data()); 152 | } 153 | 154 | return sResult; 155 | } 156 | 157 | qint64 ScanProgress::getNumberOfFile() 158 | { 159 | QMutexLocker locker(&mutex); 160 | 161 | qint64 nResult = 0; 162 | 163 | QSqlQuery query(_pOptions->dbSQLLite); 164 | 165 | query.exec(QString("SELECT COUNT(FILENAME) AS VALUE FROM files where TIMECOUNT='' AND DATETIME=''")); 166 | 167 | if (query.next()) { 168 | nResult = query.value("VALUE").toULongLong(); 169 | } 170 | 171 | return nResult; 172 | } 173 | 174 | void ScanProgress::findFiles(QString sDirectoryName) 175 | { 176 | if (!bIsStop) { 177 | QFileInfo fi(sDirectoryName); 178 | 179 | if (fi.isFile()) { 180 | currentStats.nTotal++; 181 | setFileStat(fi.absoluteFilePath(), "", ""); 182 | } else if (fi.isDir() && (_pOptions->bSubdirectories)) { 183 | QDir dir(sDirectoryName); 184 | 185 | QFileInfoList eil = dir.entryInfoList(); 186 | 187 | int nCount = eil.count(); 188 | 189 | for (int i = 0; (i < nCount) && (!bIsStop); i++) { 190 | QString sFN = eil.at(i).fileName(); 191 | 192 | if ((sFN != ".") && (sFN != "..")) { 193 | findFiles(eil.at(i).absoluteFilePath()); 194 | } 195 | } 196 | } 197 | } 198 | } 199 | 200 | void ScanProgress::startTransaction() 201 | { 202 | QSqlQuery query(_pOptions->dbSQLLite); 203 | 204 | query.exec("BEGIN TRANSACTION"); 205 | } 206 | 207 | void ScanProgress::endTransaction() 208 | { 209 | QSqlQuery query(_pOptions->dbSQLLite); 210 | 211 | query.exec("COMMIT"); 212 | } 213 | 214 | void ScanProgress::_processFile(QString sFileName) 215 | { 216 | // qDebug("%s", sFileName.toUtf8().data()); 217 | 218 | if (N_MAXNUMBEROFTHREADS > 1) { 219 | pSemaphore->acquire(); 220 | } 221 | 222 | currentStats.nCurrent++; 223 | currentStats.sStatus = sFileName; 224 | 225 | if (currentStats.sStatus != "") { 226 | QString sTempFile; 227 | 228 | if (_pOptions->bDebug) { 229 | sTempFile = _pOptions->sResultDirectory; 230 | 231 | XBinary::createDirectory(sFileName); 232 | 233 | sTempFile += QDir::separator() + XBinary::getBaseFileName(currentStats.sStatus); 234 | 235 | XBinary::copyFile(currentStats.sStatus, sTempFile); 236 | } 237 | 238 | SpecAbstract::SCAN_OPTIONS options = {}; 239 | 240 | options.bIsDeepScan = _pOptions->bDeepScan; 241 | options.bIsRecursiveScan = _pOptions->bRecursive; 242 | options.bIsHeuristicScan = _pOptions->bHeuristic; 243 | options.bSubdirectories = _pOptions->bSubdirectories; 244 | options.bIsTest = _pOptions->bIsTest; 245 | options.bIsVerbose = _pOptions->bVerbose; 246 | 247 | #ifdef Q_OS_LINUX 248 | options.bIsTest = true; 249 | #endif 250 | 251 | XScanEngine::SCAN_RESULT scanResult = SpecAbstract().scanFile(currentStats.sStatus, &options); 252 | 253 | QString _sBaseFileName = QFileInfo(scanResult.sFileName).fileName(); 254 | 255 | if ((_pOptions->fileFormat == FF_MD5) || (_pOptions->fileFormat == FF_MD5_ORIGINAL)) { 256 | QString sMD5 = XBinary::getHash(XBinary::HASH_MD5, scanResult.sFileName); 257 | 258 | if (_pOptions->fileFormat == FF_MD5) { 259 | _sBaseFileName = sMD5; 260 | } else if (_pOptions->fileFormat == FF_MD5_ORIGINAL) { 261 | _sBaseFileName = sMD5 + _sBaseFileName; 262 | } 263 | } 264 | 265 | int nCount = scanResult.listRecords.count(); 266 | 267 | bool bGlobalCopy = false; 268 | bool bIdentified = false; 269 | 270 | if (nCount) { 271 | for (int i = 0; i < nCount; i++) { 272 | XScanEngine::SCANSTRUCT ss = scanResult.listRecords.at(i); 273 | 274 | if (_pOptions->stFileTypes.contains(ss.id.fileType)) { 275 | if ((_pOptions->stTypes.contains((SpecAbstract::RECORD_TYPE)ss.nType)) || (_pOptions->bAllTypes)) { 276 | bIdentified = true; 277 | 278 | if ((_pOptions->copyType == CT_IDENT) || (_pOptions->copyType == CT_IDENT_UNK)) { 279 | QString sResult = SpecAbstract::recordNameIdToString(ss.nName); 280 | 281 | if (ss.sVersion != "") { 282 | sResult += QString("(%1)").arg(ss.sVersion); 283 | } 284 | 285 | if (ss.sInfo != "") { 286 | sResult += QString("[%1]").arg(ss.sInfo); 287 | } 288 | 289 | sResult = XBinary::convertFileNameSymbols(sResult); 290 | 291 | quint32 nCRC = XBinary::getStringCustomCRC32(sResult); 292 | 293 | bool bCopy = true; 294 | 295 | int nCurrentCount = getFileCount(nCRC); 296 | 297 | if (_pOptions->nCopyCount) { 298 | if (nCurrentCount >= _pOptions->nCopyCount) { 299 | bCopy = false; 300 | } 301 | } 302 | 303 | if (bCopy) { 304 | QString _sFileName = _pOptions->sResultDirectory + QDir::separator() + createPath(_pOptions->copyFormat, ss) + QDir::separator() + 305 | SpecAbstract::recordTypeIdToString(ss.nType) + QDir::separator() + sResult; 306 | 307 | XBinary::createDirectory(_sFileName); 308 | 309 | _sFileName += QDir::separator() + _sBaseFileName; 310 | 311 | if (XBinary::copyFile(scanResult.sFileName, _sFileName)) { 312 | bGlobalCopy = true; 313 | 314 | setFileCount(nCRC, nCurrentCount + 1); 315 | } 316 | } 317 | } 318 | } 319 | } 320 | } 321 | } 322 | 323 | // if((!bIdentified)&&((_pOptions->copyType==CT_IDENT_UNK)||(_pOptions->copyType==CT_UNK))) 324 | // { 325 | // if(_pOptions->stFileTypes.contains(scanResult..fileType)) 326 | // { 327 | // DiE_Script::SCAN_HEADER sh=scanResult.scanHeader; 328 | 329 | // quint32 nCRC=XBinary::getStringCustomCRC32(XBinary::fileTypeIdToString(sh.fileType)+sh.sArch+"__UNKNOWN"); 330 | 331 | // bool bCopy=true; 332 | 333 | // int nCurrentCount=getFileCount(nCRC); 334 | 335 | // if(_pOptions->nCopyCount) 336 | // { 337 | // if(nCurrentCount>=_pOptions->nCopyCount) 338 | // { 339 | // bCopy=false; 340 | // } 341 | // } 342 | 343 | // if(bCopy) 344 | // { 345 | // QString _sFileName= _pOptions->sResultDirectory+QDir::separator()+ 346 | // createPath(_pOptions->copyFormat,sh)+QDir::separator()+ 347 | // "__UNKNOWN"; 348 | 349 | // XBinary::createDirectory(_sFileName); 350 | 351 | // _sFileName+=QDir::separator()+_sBaseFileName; 352 | 353 | // if(XBinary::copyFile(scanResult.sFileName,_sFileName)) 354 | // { 355 | // bGlobalCopy=true; 356 | 357 | // setFileCount(nCRC,nCurrentCount+1); 358 | // } 359 | // } 360 | // } 361 | // } 362 | 363 | setFileStat(scanResult.sFileName, QString::number(scanResult.nScanTime), QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss")); 364 | 365 | if (_pOptions->bDebug) { 366 | XBinary::removeFile(sTempFile); 367 | } 368 | } 369 | 370 | if (N_MAXNUMBEROFTHREADS > 1) { 371 | pSemaphore->release(); 372 | } 373 | } 374 | 375 | QString ScanProgress::createPath(ScanProgress::CF copyFormat, XScanEngine::SCANSTRUCT ss) 376 | { 377 | QString sResult; 378 | 379 | if (copyFormat == ScanProgress::CF_FT_TYPE_NAME) { 380 | sResult = XBinary::fileTypeIdToString(ss.id.fileType); 381 | } else if (copyFormat == ScanProgress::CF_FT_ARCH_TYPE_NAME) { 382 | sResult = XBinary::fileTypeIdToString(ss.id.fileType) + QDir::separator() + ss.id.sArch; 383 | } else if (copyFormat == ScanProgress::CF_ARCH_FT_TYPE_NAME) { 384 | sResult = ss.id.sArch + QDir::separator() + XBinary::fileTypeIdToString(ss.id.fileType); 385 | } 386 | 387 | return sResult; 388 | } 389 | 390 | void ScanProgress::scan_finished() 391 | { 392 | qDebug("void ScanProgress::scan_finished()"); 393 | } 394 | 395 | void ScanProgress::process() 396 | { 397 | if (N_MAXNUMBEROFTHREADS > 1) { 398 | pSemaphore = new QSemaphore(N_MAXNUMBEROFTHREADS); 399 | } 400 | 401 | pElapsedTimer = new QElapsedTimer; 402 | pElapsedTimer->start(); 403 | 404 | if (!(_pOptions->bContinue)) { 405 | createTables(); 406 | } 407 | currentStats.nTotal = 0; 408 | currentStats.nCurrent = 0; 409 | 410 | bIsStop = false; 411 | 412 | currentStats.sStatus = tr("Directory scan"); 413 | 414 | if (!(_pOptions->bContinue)) { 415 | startTransaction(); 416 | 417 | findFiles(_sDirectoryName); 418 | 419 | endTransaction(); 420 | } 421 | 422 | currentStats.nTotal = getNumberOfFile(); 423 | 424 | for (int i = 0; (i < currentStats.nTotal) && (!bIsStop); i++) { 425 | QString sFileName = getCurrentFileNameAndLock(); 426 | 427 | if (sFileName == "") { 428 | break; 429 | } 430 | 431 | if (N_MAXNUMBEROFTHREADS > 1) { 432 | QFuture future = QtConcurrent::run(this, &ScanProgress::_processFile, sFileName); 433 | 434 | QThread::msleep(100); 435 | 436 | while (true) { 437 | int nAvailable = pSemaphore->available(); 438 | currentStats.nNumberOfThreads = N_MAXNUMBEROFTHREADS - nAvailable; 439 | if (nAvailable) { 440 | break; 441 | } 442 | 443 | QThread::msleep(50); 444 | } 445 | } else { 446 | _processFile(sFileName); 447 | } 448 | } 449 | 450 | if (N_MAXNUMBEROFTHREADS > 1) { 451 | while (true) { 452 | int nAvailable = pSemaphore->available(); 453 | currentStats.nNumberOfThreads = N_MAXNUMBEROFTHREADS - nAvailable; 454 | 455 | if (nAvailable == N_MAXNUMBEROFTHREADS) { 456 | break; 457 | } 458 | 459 | QThread::msleep(1000); 460 | } 461 | } 462 | 463 | if (N_MAXNUMBEROFTHREADS > 1) { 464 | delete pSemaphore; 465 | } 466 | 467 | emit completed(pElapsedTimer->elapsed()); 468 | delete pElapsedTimer; 469 | pElapsedTimer = nullptr; 470 | 471 | bIsStop = false; 472 | } 473 | 474 | void ScanProgress::stop() 475 | { 476 | bIsStop = true; 477 | } 478 | 479 | ScanProgress::STATS ScanProgress::getCurrentStats() 480 | { 481 | if (pElapsedTimer) { 482 | currentStats.nElapsed = pElapsedTimer->elapsed(); 483 | } 484 | 485 | return currentStats; 486 | } 487 | 488 | bool ScanProgress::createDatabase(QSqlDatabase *pDb, QString sDatabaseName) 489 | { 490 | bool bResult = false; 491 | 492 | *pDb = QSqlDatabase::addDatabase("QSQLITE", "sqllite"); 493 | pDb->setDatabaseName(sDatabaseName); 494 | 495 | if (pDb->open()) { 496 | QSqlQuery query(*pDb); 497 | 498 | query.exec("PRAGMA journal_mode = WAL"); 499 | query.exec("PRAGMA synchronous = NORMAL"); 500 | 501 | bResult = true; 502 | } 503 | 504 | return bResult; 505 | } 506 | -------------------------------------------------------------------------------- /gui_source/guimainwindow.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019-2023 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #include "guimainwindow.h" 22 | 23 | #include "ui_guimainwindow.h" 24 | 25 | GuiMainWindow::GuiMainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::GuiMainWindow) 26 | { 27 | ui->setupUi(this); 28 | 29 | setWindowTitle(QString("%1 v%2").arg(X_APPLICATIONNAME, X_APPLICATIONVERSION)); 30 | 31 | options = {0}; 32 | 33 | QString sSettingsFile = QApplication::applicationDirPath() + QDir::separator() + QString("%1.ini").arg(X_APPLICATIONNAME); 34 | QSettings settings(sSettingsFile, QSettings::IniFormat); 35 | 36 | ui->checkBoxAllFileTypes->setChecked(true); 37 | ui->checkBoxAllTypes->setChecked(true); 38 | 39 | ui->comboBoxCopyFormat->addItem("FileType/Type/Name"); 40 | ui->comboBoxCopyFormat->addItem("Arch/FileType/Type/Name"); 41 | ui->comboBoxCopyFormat->addItem("FileType/Arch/Type/Name"); 42 | 43 | ui->comboBoxCopyType->addItem("Identified"); 44 | ui->comboBoxCopyType->addItem("Identified/Unknown"); 45 | ui->comboBoxCopyType->addItem("Unknown"); 46 | 47 | ui->comboBoxFileFormat->addItem("Original"); 48 | ui->comboBoxFileFormat->addItem("MD5"); 49 | ui->comboBoxFileFormat->addItem("MD5+Original"); 50 | 51 | ui->comboBoxCopyFormat->setCurrentIndex(settings.value("CopyFormat", 0).toInt()); 52 | ui->comboBoxCopyType->setCurrentIndex(settings.value("CopyType", 0).toInt()); 53 | ui->comboBoxFileFormat->setCurrentIndex(settings.value("FileFormat", 0).toInt()); 54 | 55 | ui->lineEditDirectoryName->setText(settings.value("DirectoryName", QDir::currentPath()).toString()); 56 | ui->lineEditOut->setText(settings.value("ResultName", QDir::currentPath()).toString()); 57 | 58 | options.bContinue = settings.value("Continue", false).toBool(); 59 | options.bIsTest = settings.value("Test", false).toBool(); 60 | 61 | QString sDatabaseName = settings.value("DatabaseName", ":memory:").toString(); 62 | 63 | if (!ScanProgress::createDatabase(&options.dbSQLLite, sDatabaseName)) { 64 | QMessageBox::critical(this, tr("Error"), options.dbSQLLite.lastError().text()); 65 | 66 | exit(1); 67 | } 68 | 69 | options.bDebug = false; 70 | options.bIsTest = true; 71 | } 72 | 73 | GuiMainWindow::~GuiMainWindow() 74 | { 75 | QString sSettingsFile = QApplication::applicationDirPath() + QDir::separator() + QString("%1.ini").arg(X_APPLICATIONNAME); 76 | QSettings settings(sSettingsFile, QSettings::IniFormat); 77 | 78 | settings.setValue("DirectoryName", ui->lineEditDirectoryName->text()); 79 | settings.setValue("ResultName", ui->lineEditOut->text()); 80 | settings.setValue("CopyCount", ui->spinBoxCopyCount->value()); 81 | settings.setValue("CopyFormat", ui->comboBoxCopyFormat->currentIndex()); 82 | settings.setValue("CopyType", ui->comboBoxCopyType->currentIndex()); 83 | settings.setValue("FileFormat", ui->comboBoxFileFormat->currentIndex()); 84 | settings.setValue("RemoveCopied", ui->checkBoxRemoveCopied->isChecked()); 85 | 86 | delete ui; 87 | } 88 | 89 | void GuiMainWindow::on_pushButtonExit_clicked() 90 | { 91 | this->close(); 92 | } 93 | 94 | void GuiMainWindow::on_pushButtonOpenDirectory_clicked() 95 | { 96 | QString sInitDirectory = ui->lineEditDirectoryName->text(); 97 | 98 | QString sDirectoryName = QFileDialog::getExistingDirectory(this, tr("Open directory..."), sInitDirectory, QFileDialog::ShowDirsOnly); 99 | 100 | if (!sDirectoryName.isEmpty()) { 101 | ui->lineEditDirectoryName->setText(sDirectoryName); 102 | } 103 | } 104 | 105 | void GuiMainWindow::on_pushButtonOut_clicked() 106 | { 107 | QString sInitDirectory = ui->lineEditOut->text(); 108 | 109 | QString sDirectoryName = QFileDialog::getExistingDirectory(this, tr("Open directory..."), sInitDirectory, QFileDialog::ShowDirsOnly); 110 | 111 | if (!sDirectoryName.isEmpty()) { 112 | ui->lineEditOut->setText(sDirectoryName); 113 | } 114 | } 115 | 116 | void GuiMainWindow::on_pushButtonScan_clicked() 117 | { 118 | _scan(); 119 | } 120 | 121 | void GuiMainWindow::_scan() 122 | { 123 | options.nCopyCount = ui->spinBoxCopyCount->value(); 124 | options.sResultDirectory = ui->lineEditOut->text(); 125 | 126 | options.stFileTypes.clear(); 127 | 128 | if (ui->checkBoxBinary->isChecked()) options.stFileTypes.insert(XBinary::FT_BINARY); 129 | if (ui->checkBoxText->isChecked()) options.stFileTypes.insert(XBinary::FT_TEXT); 130 | if (ui->checkBoxMSDOS->isChecked()) options.stFileTypes.insert(XBinary::FT_MSDOS); 131 | if (ui->checkBoxNE->isChecked()) options.stFileTypes.insert(XBinary::FT_NE); 132 | if (ui->checkBoxLE->isChecked()) options.stFileTypes.insert(XBinary::FT_LE); 133 | if (ui->checkBoxLX->isChecked()) options.stFileTypes.insert(XBinary::FT_LX); 134 | if (ui->checkBoxPE32->isChecked()) options.stFileTypes.insert(XBinary::FT_PE32); 135 | if (ui->checkBoxPE64->isChecked()) options.stFileTypes.insert(XBinary::FT_PE64); 136 | if (ui->checkBoxELF32->isChecked()) options.stFileTypes.insert(XBinary::FT_ELF32); 137 | if (ui->checkBoxELF64->isChecked()) options.stFileTypes.insert(XBinary::FT_ELF64); 138 | if (ui->checkBoxMACHO32->isChecked()) options.stFileTypes.insert(XBinary::FT_MACHO32); 139 | if (ui->checkBoxMACHO64->isChecked()) options.stFileTypes.insert(XBinary::FT_MACHO64); 140 | if (ui->checkBoxArchive->isChecked()) options.stFileTypes.insert(XBinary::FT_ARCHIVE); 141 | if (ui->checkBoxJAR->isChecked()) options.stFileTypes.insert(XBinary::FT_JAR); 142 | if (ui->checkBoxAPK->isChecked()) options.stFileTypes.insert(XBinary::FT_APK); 143 | if (ui->checkBoxDEX->isChecked()) options.stFileTypes.insert(XBinary::FT_DEX); 144 | if (ui->checkBoxIPA->isChecked()) options.stFileTypes.insert(XBinary::FT_IPA); 145 | 146 | options.stTypes.clear(); 147 | 148 | options.bAllTypes = ui->checkBoxAllTypes->isChecked(); 149 | 150 | if (ui->checkBoxAPKTool->isChecked()) options.stTypes.insert(SpecAbstract::RECORD_TYPE_APKTOOL); 151 | if (ui->checkBoxCertificate->isChecked()) options.stTypes.insert(SpecAbstract::RECORD_TYPE_CERTIFICATE); 152 | if (ui->checkBoxCompiler->isChecked()) options.stTypes.insert(SpecAbstract::RECORD_TYPE_COMPILER); 153 | if (ui->checkBoxConverter->isChecked()) options.stTypes.insert(SpecAbstract::RECORD_TYPE_CONVERTER); 154 | if (ui->checkBoxDatabase->isChecked()) options.stTypes.insert(SpecAbstract::RECORD_TYPE_DATABASE); 155 | if (ui->checkBoxDebugData->isChecked()) options.stTypes.insert(SpecAbstract::RECORD_TYPE_DEBUGDATA); 156 | if (ui->checkBoxDongleProtection->isChecked()) options.stTypes.insert(SpecAbstract::RECORD_TYPE_DONGLEPROTECTION); 157 | if (ui->checkBoxDOSExtender->isChecked()) options.stTypes.insert(SpecAbstract::RECORD_TYPE_DOSEXTENDER); 158 | if (ui->checkBoxFormat->isChecked()) options.stTypes.insert(SpecAbstract::RECORD_TYPE_FORMAT); 159 | if (ui->checkBoxGeneric->isChecked()) options.stTypes.insert(SpecAbstract::RECORD_TYPE_GENERIC); 160 | if (ui->checkBoxImage->isChecked()) options.stTypes.insert(SpecAbstract::RECORD_TYPE_IMAGE); 161 | if (ui->checkBoxInstaller->isChecked()) options.stTypes.insert(SpecAbstract::RECORD_TYPE_INSTALLER); 162 | if (ui->checkBoxInstallerData->isChecked()) options.stTypes.insert(SpecAbstract::RECORD_TYPE_INSTALLERDATA); 163 | if (ui->checkBoxJoiner->isChecked()) options.stTypes.insert(SpecAbstract::RECORD_TYPE_JOINER); 164 | if (ui->checkBoxLibrary->isChecked()) options.stTypes.insert(SpecAbstract::RECORD_TYPE_LIBRARY); 165 | if (ui->checkBoxLinker->isChecked()) options.stTypes.insert(SpecAbstract::RECORD_TYPE_LINKER); 166 | if (ui->checkBoxNETObfuscator->isChecked()) options.stTypes.insert(SpecAbstract::RECORD_TYPE_NETOBFUSCATOR); 167 | if (ui->checkBoxOperationSystem->isChecked()) options.stTypes.insert(SpecAbstract::RECORD_TYPE_OPERATIONSYSTEM); 168 | if (ui->checkBoxPacker->isChecked()) options.stTypes.insert(SpecAbstract::RECORD_TYPE_PACKER); 169 | if (ui->checkBoxPETool->isChecked()) options.stTypes.insert(SpecAbstract::RECORD_TYPE_PETOOL); 170 | if (ui->checkBoxProtector->isChecked()) options.stTypes.insert(SpecAbstract::RECORD_TYPE_PROTECTOR); 171 | if (ui->checkBoxProtectorData->isChecked()) options.stTypes.insert(SpecAbstract::RECORD_TYPE_PROTECTORDATA); 172 | if (ui->checkBoxSFX->isChecked()) options.stTypes.insert(SpecAbstract::RECORD_TYPE_SFX); 173 | if (ui->checkBoxSFXData->isChecked()) options.stTypes.insert(SpecAbstract::RECORD_TYPE_SFXDATA); 174 | if (ui->checkBoxSignTool->isChecked()) options.stTypes.insert(SpecAbstract::RECORD_TYPE_SIGNTOOL); 175 | if (ui->checkBoxSourceCode->isChecked()) options.stTypes.insert(SpecAbstract::RECORD_TYPE_SOURCECODE); 176 | if (ui->checkBoxStub->isChecked()) options.stTypes.insert(SpecAbstract::RECORD_TYPE_STUB); 177 | if (ui->checkBoxTool->isChecked()) options.stTypes.insert(SpecAbstract::RECORD_TYPE_TOOL); 178 | 179 | options.bRecursive = ui->checkBoxRecursive->isChecked(); 180 | options.bDeepScan = ui->checkBoxDeepScan->isChecked(); 181 | options.bSubdirectories = ui->checkBoxScanSubdirectories->isChecked(); 182 | options.bHeuristic = ui->checkBoxHeuristicScan->isChecked(); 183 | options.bVerbose = ui->checkBoxVerbose->isChecked(); 184 | 185 | options.copyFormat = (ScanProgress::CF)ui->comboBoxCopyFormat->currentIndex(); 186 | options.copyType = (ScanProgress::CT)ui->comboBoxCopyType->currentIndex(); 187 | options.bRemoveCopied = ui->checkBoxRemoveCopied->isChecked(); 188 | 189 | options.fileFormat = (ScanProgress::FF)ui->comboBoxFileFormat->currentIndex(); 190 | 191 | DialogScanProgress ds(this); 192 | 193 | ds.setData(ui->lineEditDirectoryName->text(), &options); 194 | 195 | ds.exec(); 196 | 197 | // DialogStaticScan ds(this); 198 | // connect(&ds, SIGNAL(scanFileStarted(QString)),this,SLOT(scanFileStarted(QString)),Qt::DirectConnection); 199 | // connect(&ds, SIGNAL(scanResult(SpecAbstract::SCAN_RESULT)),this,SLOT(scanResult(SpecAbstract::SCAN_RESULT)),Qt::DirectConnection); 200 | // ds.setData(ui->lineEditDirectoryName->text(),&options); 201 | // ds.exec(); 202 | } 203 | 204 | void GuiMainWindow::on_checkBoxAllFileTypes_toggled(bool checked) 205 | { 206 | ui->checkBoxBinary->setChecked(checked); 207 | ui->checkBoxText->setChecked(checked); 208 | ui->checkBoxMSDOS->setChecked(checked); 209 | ui->checkBoxNE->setChecked(checked); 210 | ui->checkBoxLE->setChecked(checked); 211 | ui->checkBoxLX->setChecked(checked); 212 | ui->checkBoxPE32->setChecked(checked); 213 | ui->checkBoxPE64->setChecked(checked); 214 | ui->checkBoxELF32->setChecked(checked); 215 | ui->checkBoxELF64->setChecked(checked); 216 | ui->checkBoxMACHO32->setChecked(checked); 217 | ui->checkBoxMACHO64->setChecked(checked); 218 | ui->checkBoxArchive->setChecked(checked); 219 | ui->checkBoxJAR->setChecked(checked); 220 | ui->checkBoxAPK->setChecked(checked); 221 | ui->checkBoxDEX->setChecked(checked); 222 | ui->checkBoxIPA->setChecked(checked); 223 | } 224 | 225 | void GuiMainWindow::on_checkBoxBinary_toggled(bool checked) 226 | { 227 | QSignalBlocker blocker(ui->checkBoxAllFileTypes); 228 | 229 | if (!checked) { 230 | ui->checkBoxAllFileTypes->setChecked(false); 231 | } 232 | } 233 | 234 | void GuiMainWindow::on_checkBoxMSDOS_toggled(bool checked) 235 | { 236 | QSignalBlocker blocker(ui->checkBoxAllFileTypes); 237 | 238 | if (!checked) { 239 | ui->checkBoxAllFileTypes->setChecked(false); 240 | } 241 | } 242 | 243 | void GuiMainWindow::on_checkBoxPE32_toggled(bool checked) 244 | { 245 | QSignalBlocker blocker(ui->checkBoxAllFileTypes); 246 | 247 | if (!checked) { 248 | ui->checkBoxAllFileTypes->setChecked(false); 249 | } 250 | } 251 | 252 | void GuiMainWindow::on_checkBoxPE64_toggled(bool checked) 253 | { 254 | QSignalBlocker blocker(ui->checkBoxAllFileTypes); 255 | 256 | if (!checked) { 257 | ui->checkBoxAllFileTypes->setChecked(false); 258 | } 259 | } 260 | 261 | void GuiMainWindow::on_checkBoxELF32_toggled(bool checked) 262 | { 263 | QSignalBlocker blocker(ui->checkBoxAllFileTypes); 264 | 265 | if (!checked) { 266 | ui->checkBoxAllFileTypes->setChecked(false); 267 | } 268 | } 269 | 270 | void GuiMainWindow::on_checkBoxELF64_toggled(bool checked) 271 | { 272 | QSignalBlocker blocker(ui->checkBoxAllFileTypes); 273 | 274 | if (!checked) { 275 | ui->checkBoxAllFileTypes->setChecked(false); 276 | } 277 | } 278 | 279 | void GuiMainWindow::on_checkBoxMACHO32_toggled(bool checked) 280 | { 281 | QSignalBlocker blocker(ui->checkBoxAllFileTypes); 282 | 283 | if (!checked) { 284 | ui->checkBoxAllFileTypes->setChecked(false); 285 | } 286 | } 287 | 288 | void GuiMainWindow::on_checkBoxMACHO64_toggled(bool checked) 289 | { 290 | QSignalBlocker blocker(ui->checkBoxAllFileTypes); 291 | 292 | if (!checked) { 293 | ui->checkBoxAllFileTypes->setChecked(false); 294 | } 295 | } 296 | 297 | void GuiMainWindow::on_checkBoxJAR_toggled(bool checked) 298 | { 299 | QSignalBlocker blocker(ui->checkBoxAllFileTypes); 300 | 301 | if (!checked) { 302 | ui->checkBoxAllFileTypes->setChecked(false); 303 | } 304 | } 305 | 306 | void GuiMainWindow::on_checkBoxAPK_toggled(bool checked) 307 | { 308 | QSignalBlocker blocker(ui->checkBoxAllFileTypes); 309 | 310 | if (!checked) { 311 | ui->checkBoxAllFileTypes->setChecked(false); 312 | } 313 | } 314 | 315 | void GuiMainWindow::on_checkBoxDEX_toggled(bool checked) 316 | { 317 | QSignalBlocker blocker(ui->checkBoxAllFileTypes); 318 | 319 | if (!checked) { 320 | ui->checkBoxAllFileTypes->setChecked(false); 321 | } 322 | } 323 | 324 | void GuiMainWindow::on_checkBoxAllTypes_toggled(bool checked) 325 | { 326 | ui->checkBoxAPKTool->setChecked(checked); 327 | ui->checkBoxCertificate->setChecked(checked); 328 | ui->checkBoxCompiler->setChecked(checked); 329 | ui->checkBoxConverter->setChecked(checked); 330 | ui->checkBoxDatabase->setChecked(checked); 331 | ui->checkBoxDebugData->setChecked(checked); 332 | ui->checkBoxDongleProtection->setChecked(checked); 333 | ui->checkBoxDOSExtender->setChecked(checked); 334 | ui->checkBoxFormat->setChecked(checked); 335 | ui->checkBoxGeneric->setChecked(checked); 336 | ui->checkBoxImage->setChecked(checked); 337 | ui->checkBoxInstaller->setChecked(checked); 338 | ui->checkBoxInstallerData->setChecked(checked); 339 | ui->checkBoxJoiner->setChecked(checked); 340 | ui->checkBoxLibrary->setChecked(checked); 341 | ui->checkBoxLinker->setChecked(checked); 342 | ui->checkBoxNETObfuscator->setChecked(checked); 343 | ui->checkBoxOperationSystem->setChecked(checked); 344 | ui->checkBoxPacker->setChecked(checked); 345 | ui->checkBoxPETool->setChecked(checked); 346 | ui->checkBoxProtector->setChecked(checked); 347 | ui->checkBoxProtectorData->setChecked(checked); 348 | ui->checkBoxSFX->setChecked(checked); 349 | ui->checkBoxSFXData->setChecked(checked); 350 | ui->checkBoxSignTool->setChecked(checked); 351 | ui->checkBoxSourceCode->setChecked(checked); 352 | ui->checkBoxStub->setChecked(checked); 353 | ui->checkBoxTool->setChecked(checked); 354 | } 355 | 356 | void GuiMainWindow::on_checkBoxArchive_toggled(bool checked) 357 | { 358 | QSignalBlocker blocker(ui->checkBoxAllTypes); 359 | 360 | if (!checked) { 361 | ui->checkBoxAllFileTypes->setChecked(false); 362 | } 363 | } 364 | 365 | void GuiMainWindow::on_checkBoxCertificate_toggled(bool checked) 366 | { 367 | QSignalBlocker blocker(ui->checkBoxAllTypes); 368 | 369 | if (!checked) { 370 | ui->checkBoxAllTypes->setChecked(false); 371 | } 372 | } 373 | 374 | void GuiMainWindow::on_checkBoxCompiler_toggled(bool checked) 375 | { 376 | QSignalBlocker blocker(ui->checkBoxAllTypes); 377 | 378 | if (!checked) { 379 | ui->checkBoxAllTypes->setChecked(false); 380 | } 381 | } 382 | 383 | void GuiMainWindow::on_checkBoxConverter_toggled(bool checked) 384 | { 385 | QSignalBlocker blocker(ui->checkBoxAllTypes); 386 | 387 | if (!checked) { 388 | ui->checkBoxAllTypes->setChecked(false); 389 | } 390 | } 391 | 392 | void GuiMainWindow::on_checkBoxDatabase_toggled(bool checked) 393 | { 394 | QSignalBlocker blocker(ui->checkBoxAllTypes); 395 | 396 | if (!checked) { 397 | ui->checkBoxAllTypes->setChecked(false); 398 | } 399 | } 400 | 401 | void GuiMainWindow::on_checkBoxDebugData_toggled(bool checked) 402 | { 403 | QSignalBlocker blocker(ui->checkBoxAllTypes); 404 | 405 | if (!checked) { 406 | ui->checkBoxAllTypes->setChecked(false); 407 | } 408 | } 409 | 410 | void GuiMainWindow::on_checkBoxDongleProtection_toggled(bool checked) 411 | { 412 | QSignalBlocker blocker(ui->checkBoxAllTypes); 413 | 414 | if (!checked) { 415 | ui->checkBoxAllTypes->setChecked(false); 416 | } 417 | } 418 | 419 | void GuiMainWindow::on_checkBoxDOSExtender_toggled(bool checked) 420 | { 421 | QSignalBlocker blocker(ui->checkBoxAllTypes); 422 | 423 | if (!checked) { 424 | ui->checkBoxAllTypes->setChecked(false); 425 | } 426 | } 427 | 428 | void GuiMainWindow::on_checkBoxFormat_toggled(bool checked) 429 | { 430 | QSignalBlocker blocker(ui->checkBoxAllTypes); 431 | 432 | if (!checked) { 433 | ui->checkBoxAllTypes->setChecked(false); 434 | } 435 | } 436 | 437 | void GuiMainWindow::on_checkBoxGeneric_toggled(bool checked) 438 | { 439 | QSignalBlocker blocker(ui->checkBoxAllTypes); 440 | 441 | if (!checked) { 442 | ui->checkBoxAllTypes->setChecked(false); 443 | } 444 | } 445 | 446 | void GuiMainWindow::on_checkBoxImage_toggled(bool checked) 447 | { 448 | QSignalBlocker blocker(ui->checkBoxAllTypes); 449 | 450 | if (!checked) { 451 | ui->checkBoxAllTypes->setChecked(false); 452 | } 453 | } 454 | 455 | void GuiMainWindow::on_checkBoxInstaller_toggled(bool checked) 456 | { 457 | QSignalBlocker blocker(ui->checkBoxAllTypes); 458 | 459 | if (!checked) { 460 | ui->checkBoxAllTypes->setChecked(false); 461 | } 462 | } 463 | 464 | void GuiMainWindow::on_checkBoxInstallerData_toggled(bool checked) 465 | { 466 | QSignalBlocker blocker(ui->checkBoxAllTypes); 467 | 468 | if (!checked) { 469 | ui->checkBoxAllTypes->setChecked(false); 470 | } 471 | } 472 | 473 | void GuiMainWindow::on_checkBoxLibrary_toggled(bool checked) 474 | { 475 | QSignalBlocker blocker(ui->checkBoxAllTypes); 476 | 477 | if (!checked) { 478 | ui->checkBoxAllTypes->setChecked(false); 479 | } 480 | } 481 | 482 | void GuiMainWindow::on_checkBoxLinker_toggled(bool checked) 483 | { 484 | QSignalBlocker blocker(ui->checkBoxAllTypes); 485 | 486 | if (!checked) { 487 | ui->checkBoxAllTypes->setChecked(false); 488 | } 489 | } 490 | 491 | void GuiMainWindow::on_checkBoxNETObfuscator_toggled(bool checked) 492 | { 493 | QSignalBlocker blocker(ui->checkBoxAllTypes); 494 | 495 | if (!checked) { 496 | ui->checkBoxAllTypes->setChecked(false); 497 | } 498 | } 499 | 500 | void GuiMainWindow::on_checkBoxPacker_toggled(bool checked) 501 | { 502 | QSignalBlocker blocker(ui->checkBoxAllTypes); 503 | 504 | if (!checked) { 505 | ui->checkBoxAllTypes->setChecked(false); 506 | } 507 | } 508 | 509 | void GuiMainWindow::on_checkBoxProtector_toggled(bool checked) 510 | { 511 | QSignalBlocker blocker(ui->checkBoxAllTypes); 512 | 513 | if (!checked) { 514 | ui->checkBoxAllTypes->setChecked(false); 515 | } 516 | } 517 | 518 | void GuiMainWindow::on_checkBoxProtectorData_toggled(bool checked) 519 | { 520 | QSignalBlocker blocker(ui->checkBoxAllTypes); 521 | 522 | if (!checked) { 523 | ui->checkBoxAllTypes->setChecked(false); 524 | } 525 | } 526 | 527 | void GuiMainWindow::on_checkBoxSFX_toggled(bool checked) 528 | { 529 | QSignalBlocker blocker(ui->checkBoxAllTypes); 530 | 531 | if (!checked) { 532 | ui->checkBoxAllTypes->setChecked(false); 533 | } 534 | } 535 | 536 | void GuiMainWindow::on_checkBoxSFXData_toggled(bool checked) 537 | { 538 | QSignalBlocker blocker(ui->checkBoxAllTypes); 539 | 540 | if (!checked) { 541 | ui->checkBoxAllTypes->setChecked(false); 542 | } 543 | } 544 | 545 | void GuiMainWindow::on_checkBoxSignTool_toggled(bool checked) 546 | { 547 | QSignalBlocker blocker(ui->checkBoxAllTypes); 548 | 549 | if (!checked) { 550 | ui->checkBoxAllTypes->setChecked(false); 551 | } 552 | } 553 | 554 | void GuiMainWindow::on_checkBoxSourceCode_toggled(bool checked) 555 | { 556 | QSignalBlocker blocker(ui->checkBoxAllTypes); 557 | 558 | if (!checked) { 559 | ui->checkBoxAllTypes->setChecked(false); 560 | } 561 | } 562 | 563 | void GuiMainWindow::on_checkBoxStub_toggled(bool checked) 564 | { 565 | QSignalBlocker blocker(ui->checkBoxAllTypes); 566 | 567 | if (!checked) { 568 | ui->checkBoxAllTypes->setChecked(false); 569 | } 570 | } 571 | 572 | void GuiMainWindow::on_checkBoxTool_toggled(bool checked) 573 | { 574 | QSignalBlocker blocker(ui->checkBoxAllTypes); 575 | 576 | if (!checked) { 577 | ui->checkBoxAllTypes->setChecked(false); 578 | } 579 | } 580 | 581 | void GuiMainWindow::on_pushButtonInfo_clicked() 582 | { 583 | QMessageBox::information(this, tr("Info"), tr("Bugreports: horsicq@gmail.com")); 584 | } 585 | 586 | void GuiMainWindow::on_checkBoxPETool_toggled(bool checked) 587 | { 588 | QSignalBlocker blocker(ui->checkBoxAllTypes); 589 | 590 | if (!checked) { 591 | ui->checkBoxAllTypes->setChecked(false); 592 | } 593 | } 594 | 595 | void GuiMainWindow::on_checkBoxJoiner_toggled(bool checked) 596 | { 597 | QSignalBlocker blocker(ui->checkBoxAllTypes); 598 | 599 | if (!checked) { 600 | ui->checkBoxAllTypes->setChecked(false); 601 | } 602 | } 603 | 604 | void GuiMainWindow::on_checkBoxNE_toggled(bool checked) 605 | { 606 | QSignalBlocker blocker(ui->checkBoxAllTypes); 607 | 608 | if (!checked) { 609 | ui->checkBoxAllFileTypes->setChecked(false); 610 | } 611 | } 612 | 613 | void GuiMainWindow::on_checkBoxText_toggled(bool checked) 614 | { 615 | QSignalBlocker blocker(ui->checkBoxAllTypes); 616 | 617 | if (!checked) { 618 | ui->checkBoxAllFileTypes->setChecked(false); 619 | } 620 | } 621 | 622 | void GuiMainWindow::on_checkBoxLE_toggled(bool checked) 623 | { 624 | QSignalBlocker blocker(ui->checkBoxAllTypes); 625 | 626 | if (!checked) { 627 | ui->checkBoxAllFileTypes->setChecked(false); 628 | } 629 | } 630 | 631 | void GuiMainWindow::on_checkBoxLX_toggled(bool checked) 632 | { 633 | QSignalBlocker blocker(ui->checkBoxAllTypes); 634 | 635 | if (!checked) { 636 | ui->checkBoxAllFileTypes->setChecked(false); 637 | } 638 | } 639 | 640 | void GuiMainWindow::on_checkBoxAPKTool_toggled(bool checked) 641 | { 642 | QSignalBlocker blocker(ui->checkBoxAllTypes); 643 | 644 | if (!checked) { 645 | ui->checkBoxAllTypes->setChecked(false); 646 | } 647 | } 648 | 649 | void GuiMainWindow::on_checkBoxOperationSystem_toggled(bool checked) 650 | { 651 | QSignalBlocker blocker(ui->checkBoxAllTypes); 652 | 653 | if (!checked) { 654 | ui->checkBoxAllTypes->setChecked(false); 655 | } 656 | } 657 | -------------------------------------------------------------------------------- /gui_source/guimainwindow.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | GuiMainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 1129 10 | 646 11 | 12 | 13 | 14 | GuiMainWindow 15 | 16 | 17 | 18 | 19 | 20 | 21 | Directory 22 | 23 | 24 | Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter 25 | 26 | 27 | 28 | 1 29 | 30 | 31 | 1 32 | 33 | 34 | 1 35 | 36 | 37 | 1 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | Subdirectories 50 | 51 | 52 | true 53 | 54 | 55 | 56 | 57 | 58 | 59 | Recursive 60 | 61 | 62 | true 63 | 64 | 65 | 66 | 67 | 68 | 69 | Deep Scan 70 | 71 | 72 | true 73 | 74 | 75 | 76 | 77 | 78 | 79 | Heuristic 80 | 81 | 82 | true 83 | 84 | 85 | 86 | 87 | 88 | 89 | Verbose 90 | 91 | 92 | true 93 | 94 | 95 | 96 | 97 | 98 | 99 | Qt::Horizontal 100 | 101 | 102 | 103 | 158 104 | 20 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | true 120 | 121 | 122 | 123 | ... 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | true 132 | 133 | 134 | 135 | Scan 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | File types 150 | 151 | 152 | 153 | 154 | 155 | All 156 | 157 | 158 | 159 | 160 | 161 | 162 | Binary 163 | 164 | 165 | 166 | 167 | 168 | 169 | Text 170 | 171 | 172 | 173 | 174 | 175 | 176 | MSDOS 177 | 178 | 179 | 180 | 181 | 182 | 183 | NE 184 | 185 | 186 | 187 | 188 | 189 | 190 | LE 191 | 192 | 193 | 194 | 195 | 196 | 197 | LX 198 | 199 | 200 | 201 | 202 | 203 | 204 | PE32 205 | 206 | 207 | 208 | 209 | 210 | 211 | PE64 212 | 213 | 214 | 215 | 216 | 217 | 218 | ELF32 219 | 220 | 221 | 222 | 223 | 224 | 225 | ELF64 226 | 227 | 228 | 229 | 230 | 231 | 232 | MACHO32 233 | 234 | 235 | 236 | 237 | 238 | 239 | MACHO64 240 | 241 | 242 | 243 | 244 | 245 | 246 | Archive 247 | 248 | 249 | 250 | 251 | 252 | 253 | APK 254 | 255 | 256 | 257 | 258 | 259 | 260 | JAR 261 | 262 | 263 | 264 | 265 | 266 | 267 | DEX 268 | 269 | 270 | 271 | 272 | 273 | 274 | IPA 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | Types 285 | 286 | 287 | 288 | 289 | 290 | Converter 291 | 292 | 293 | 294 | 295 | 296 | 297 | Database 298 | 299 | 300 | 301 | 302 | 303 | 304 | Certificate 305 | 306 | 307 | 308 | 309 | 310 | 311 | All 312 | 313 | 314 | 315 | 316 | 317 | 318 | DOS extender 319 | 320 | 321 | 322 | 323 | 324 | 325 | Installer data 326 | 327 | 328 | 329 | 330 | 331 | 332 | Format 333 | 334 | 335 | 336 | 337 | 338 | 339 | Image 340 | 341 | 342 | 343 | 344 | 345 | 346 | Generic 347 | 348 | 349 | 350 | 351 | 352 | 353 | Dongle protection 354 | 355 | 356 | 357 | 358 | 359 | 360 | Installer 361 | 362 | 363 | 364 | 365 | 366 | 367 | Debug data 368 | 369 | 370 | 371 | 372 | 373 | 374 | Compiler 375 | 376 | 377 | 378 | 379 | 380 | 381 | .NET obfuscator 382 | 383 | 384 | 385 | 386 | 387 | 388 | Linker 389 | 390 | 391 | 392 | 393 | 394 | 395 | Library 396 | 397 | 398 | 399 | 400 | 401 | 402 | Joiner 403 | 404 | 405 | 406 | 407 | 408 | 409 | APK tool 410 | 411 | 412 | 413 | 414 | 415 | 416 | Tool 417 | 418 | 419 | 420 | 421 | 422 | 423 | Stub 424 | 425 | 426 | 427 | 428 | 429 | 430 | Source code 431 | 432 | 433 | 434 | 435 | 436 | 437 | Sign tool 438 | 439 | 440 | 441 | 442 | 443 | 444 | SFX data 445 | 446 | 447 | 448 | 449 | 450 | 451 | SFX 452 | 453 | 454 | 455 | 456 | 457 | 458 | Protector data 459 | 460 | 461 | 462 | 463 | 464 | 465 | Protector 466 | 467 | 468 | 469 | 470 | 471 | 472 | PE tool 473 | 474 | 475 | 476 | 477 | 478 | 479 | Packer 480 | 481 | 482 | 483 | 484 | 485 | 486 | Operation system 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | Qt::Horizontal 497 | 498 | 499 | 500 | 40 501 | 20 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | Copy to 512 | 513 | 514 | 515 | 1 516 | 517 | 518 | 1 519 | 520 | 521 | 1 522 | 523 | 524 | 1 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | ... 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | Copy Count 549 | 550 | 551 | 552 | 0 553 | 554 | 555 | 0 556 | 557 | 558 | 0 559 | 560 | 561 | 0 562 | 563 | 564 | 0 565 | 566 | 567 | 568 | 569 | 1000000 570 | 571 | 572 | 50 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | Copy Format 583 | 584 | 585 | 586 | 0 587 | 588 | 589 | 0 590 | 591 | 592 | 0 593 | 594 | 595 | 0 596 | 597 | 598 | 599 | 600 | 601 | 200 602 | 0 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | Copy Type 614 | 615 | 616 | 617 | 0 618 | 619 | 620 | 0 621 | 622 | 623 | 0 624 | 625 | 626 | 0 627 | 628 | 629 | 630 | 631 | 632 | 200 633 | 0 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | File Format 645 | 646 | 647 | 648 | 0 649 | 650 | 651 | 0 652 | 653 | 654 | 0 655 | 656 | 657 | 0 658 | 659 | 660 | 661 | 662 | 663 | 200 664 | 0 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | Qt::Horizontal 676 | 677 | 678 | 679 | 40 680 | 20 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | Remove Copied 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | Qt::Vertical 698 | 699 | 700 | 701 | 20 702 | 40 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | Info 713 | 714 | 715 | 716 | 717 | 718 | 719 | Qt::Horizontal 720 | 721 | 722 | 723 | 40 724 | 20 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | Exit 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | --------------------------------------------------------------------------------