├── README.md ├── release_version.txt ├── icons ├── main.ico └── main.icns ├── winloader_source ├── rsrc.rc └── winloader.cpp ├── DIE_sort_source.pro ├── gui_source ├── gui_source.pro ├── dialogscanprogress.h ├── dialogscanprogress.cpp ├── main_gui.cpp ├── guimainwindow.h ├── scanprogress.h ├── dialogscanprogress.ui ├── scanprogress.cpp ├── guimainwindow.cpp └── guimainwindow.ui ├── LICENSE ├── global.h ├── .gitmodules └── .github └── workflows └── builder.yml /README.md: -------------------------------------------------------------------------------- 1 | DIE-sort 2 | -------------------------------------------------------------------------------- /release_version.txt: -------------------------------------------------------------------------------- 1 | 0.02 -------------------------------------------------------------------------------- /icons/main.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horsicq/DIE-sort/master/icons/main.ico -------------------------------------------------------------------------------- /icons/main.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horsicq/DIE-sort/master/icons/main.icns -------------------------------------------------------------------------------- /winloader_source/rsrc.rc: -------------------------------------------------------------------------------- 1 | 500 ICON MOVEABLE PURE LOADONCALL DISCARDABLE "..\icons\main.ico" -------------------------------------------------------------------------------- /DIE_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 | 6 | TARGET = die-sort 7 | TEMPLATE = app 8 | 9 | XCONFIG += use_archive 10 | 11 | SOURCES += \ 12 | dialogscanprogress.cpp \ 13 | guimainwindow.cpp \ 14 | main_gui.cpp \ 15 | scanprogress.cpp 16 | 17 | HEADERS += \ 18 | dialogscanprogress.h \ 19 | guimainwindow.h \ 20 | ../global.h \ 21 | scanprogress.h 22 | 23 | FORMS += \ 24 | guimainwindow.ui 25 | 26 | !contains(XCONFIG, die_script) { 27 | XCONFIG += die_script 28 | include(../die_script/die_script.pri) 29 | } 30 | 31 | !contains(XCONFIG, xdialogprocess) { 32 | XCONFIG += xdialogprocess 33 | include(../FormatDialogs/xdialogprocess.pri) 34 | } 35 | 36 | include(../build.pri) 37 | 38 | win32 { 39 | RC_ICONS = ../icons/main.ico 40 | } 41 | 42 | macx { 43 | ICON = ../icons/main.icns 44 | } 45 | 46 | DISTFILES += \ 47 | ../build_win32.bat 48 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /global.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019-2025 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 | 22 | #ifndef GLOBAL_H 23 | #define GLOBAL_H 24 | 25 | #define X_APPLICATIONNAME "DIE-sort" 26 | #define X_APPLICATIONVERSION "0.02" 27 | #define X_ORGANIZATIONNAME "NTInfo" 28 | #define X_ORGANIZATIONDOMAIN "ntinfo.biz" 29 | 30 | #endif // GLOBAL_H 31 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "Formats"] 2 | path = Formats 3 | url = https://github.com/horsicq/Formats.git 4 | [submodule "die_script"] 5 | path = die_script 6 | url = https://github.com/horsicq/die_script.git 7 | [submodule "Detect-It-Easy"] 8 | path = Detect-It-Easy 9 | url = https://github.com/horsicq/Detect-It-Easy.git 10 | [submodule "XArchive"] 11 | path = XArchive 12 | url = https://github.com/horsicq/XArchive.git 13 | [submodule "XShortcuts"] 14 | path = XShortcuts 15 | url = https://github.com/horsicq/XShortcuts.git 16 | [submodule "XOptions"] 17 | path = XOptions 18 | url = https://github.com/horsicq/XOptions 19 | [submodule "build_tools"] 20 | path = build_tools 21 | url = https://github.com/horsicq/build_tools 22 | [submodule "XCapstone"] 23 | path = XCapstone 24 | url = https://github.com/horsicq/XCapstone 25 | [submodule "FormatDialogs"] 26 | path = FormatDialogs 27 | url = https://github.com/horsicq/FormatDialogs 28 | [submodule "XUpdate"] 29 | path = XUpdate 30 | url = https://github.com/horsicq/XUpdate 31 | [submodule "XGithub"] 32 | path = XGithub 33 | url = https://github.com/horsicq/XGithub 34 | [submodule "XDEX"] 35 | path = XDEX 36 | url = https://github.com/horsicq/XDEX 37 | [submodule "XPDF"] 38 | path = XPDF 39 | url = https://github.com/horsicq/XPDF 40 | [submodule "XExtractor"] 41 | path = XExtractor 42 | url = https://github.com/horsicq/XExtractor 43 | [submodule "XScanEngine"] 44 | path = XScanEngine 45 | url = https://github.com/horsicq/XScanEngine 46 | [submodule "XDisasmCore"] 47 | path = XDisasmCore 48 | url = https://github.com/horsicq/XDisasmCore.git 49 | -------------------------------------------------------------------------------- /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 | 22 | #ifndef DIALOGSCANPROGRESS_H 23 | #define DIALOGSCANPROGRESS_H 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "scanprogress.h" 31 | #include "xdialogprocess.h" 32 | 33 | class DialogScanProgress : public XDialogProcess { 34 | Q_OBJECT 35 | 36 | public: 37 | explicit DialogScanProgress(QWidget *pParent = 0); 38 | ~DialogScanProgress(); 39 | 40 | void setData(QString sDirectoryName, ScanProgress::SCAN_OPTIONS *pOptions); 41 | 42 | private: 43 | ScanProgress *pScan; 44 | QThread *pThread; 45 | }; 46 | 47 | #endif // DIALOGSCANPROGRESS_H 48 | -------------------------------------------------------------------------------- /gui_source/dialogscanprogress.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019-2025 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 | 22 | #include "dialogscanprogress.h" 23 | 24 | DialogScanProgress::DialogScanProgress(QWidget *pParent) : XDialogProcess(pParent) 25 | { 26 | pScan = new ScanProgress; 27 | pThread = new QThread; 28 | 29 | pScan->moveToThread(pThread); 30 | 31 | connect(pThread, SIGNAL(started()), pScan, SLOT(process())); 32 | connect(pScan, SIGNAL(completed(qint64)), this, SLOT(onCompleted(qint64))); 33 | 34 | setAdvanced(false); 35 | } 36 | 37 | DialogScanProgress::~DialogScanProgress() 38 | { 39 | stop(); 40 | 41 | pThread->quit(); 42 | pThread->wait(); 43 | 44 | delete pThread; 45 | delete pScan; 46 | } 47 | 48 | void DialogScanProgress::setData(QString sDirectoryName, ScanProgress::SCAN_OPTIONS *pOptions) 49 | { 50 | pScan->setData(sDirectoryName, pOptions, getPdStruct()); 51 | pThread->start(); 52 | } 53 | -------------------------------------------------------------------------------- /gui_source/main_gui.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019-2025 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 | 22 | #include 23 | #include 24 | 25 | #include "guimainwindow.h" 26 | 27 | int main(int argc, char *argv[]) 28 | { 29 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 30 | #ifdef Q_OS_MAC 31 | #ifndef QT_DEBUG 32 | QString sLibraryPath = QString(argv[0]); 33 | sLibraryPath = sLibraryPath.remove("MacOS/die-sort") + "PlugIns"; 34 | QCoreApplication::setLibraryPaths(QStringList(sLibraryPath)); 35 | #endif 36 | #endif 37 | 38 | QCoreApplication::setOrganizationName(X_ORGANIZATIONNAME); 39 | QCoreApplication::setOrganizationDomain(X_ORGANIZATIONDOMAIN); 40 | QCoreApplication::setApplicationName(X_APPLICATIONNAME); 41 | QCoreApplication::setApplicationVersion(X_APPLICATIONVERSION); 42 | 43 | QApplication a(argc, argv); 44 | QApplication::setStyle(QStyleFactory::create("Fusion")); 45 | 46 | GuiMainWindow w; 47 | w.show(); 48 | 49 | return a.exec(); 50 | } 51 | -------------------------------------------------------------------------------- /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 | 22 | #ifndef GUIMAINWINDOW_H 23 | #define GUIMAINWINDOW_H 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "../global.h" 31 | #include "dialogscanprogress.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 | void _appendType(QString sType); 51 | 52 | void on_checkBoxAllFileTypes_toggled(bool checked); 53 | void on_checkBoxAllTypes_toggled(bool checked); 54 | 55 | void on_pushButtonInfo_clicked(); 56 | 57 | void onFileTypeToggled(bool checked); 58 | void onTypeToggled(bool checked); 59 | void on_pushButtonSignatures_clicked(); 60 | 61 | void on_doubleSpinBoxEntropy_valueChanged(double arg1); 62 | void on_pushButtonSignaturesCustom_clicked(); 63 | void on_pushButtonSignaturesExtra_clicked(); 64 | 65 | void loadSettings(); 66 | void saveSettings(); 67 | 68 | void on_pushButtonLog_clicked(); 69 | 70 | private: 71 | Ui::GuiMainWindow *ui; 72 | 73 | ScanProgress::SCAN_OPTIONS options; 74 | }; 75 | 76 | #endif // GUIMAINWINDOW_H 77 | -------------------------------------------------------------------------------- /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\\die-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 | -------------------------------------------------------------------------------- /.github/workflows/builder.yml: -------------------------------------------------------------------------------- 1 | name: Build DIE-sort 2 | 3 | on: 4 | workflow_dispatch: 5 | release: 6 | types: [created] 7 | schedule: 8 | - cron: '0 0 * * MON' 9 | 10 | env: 11 | SRC_PATH: ${{ github.workspace }}/src 12 | SRC_PATH_WIN: ${{ github.workspace }}\src 13 | RELEASE_PATH: ${{ github.workspace }}/src/release 14 | 15 | jobs: 16 | build-windows-32: 17 | runs-on: windows-2022 18 | steps: 19 | - uses: actions/checkout@v4 20 | with: 21 | submodules: 'recursive' 22 | path: ${{ env.SRC_PATH }} 23 | 24 | - name: Setup MSVC 25 | uses: ilammy/msvc-dev-cmd@v1 26 | with: 27 | arch: x86 28 | 29 | - name: Install Qt 30 | uses: jurplel/install-qt-action@v4 31 | with: 32 | version: '5.15.2' 33 | host: 'windows' 34 | target: 'desktop' 35 | arch: 'win32_msvc2019' 36 | dir: ${{ github.workspace }} 37 | modules: qtscript 38 | 39 | - name: Build 40 | shell: cmd 41 | working-directory: ${{ env.SRC_PATH }} 42 | run: | 43 | echo on 44 | set VSVARS_PATH="C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars32.bat" 45 | set QMAKE_PATH="${{ github.workspace }}\Qt\5.15.2\msvc2019\bin\qmake.exe" 46 | set SEVENZIP_PATH="C:\Program Files\7-Zip\7z.exe" 47 | set X_BUILD_NAME=diesort_win32_portable 48 | set X_SOURCE_PATH=${{ env.SRC_PATH_WIN }} 49 | for /f "delims=" %%x in ('type "%X_SOURCE_PATH%\release_version.txt"') do set X_RELEASE_VERSION=%%x 50 | 51 | rem call %X_SOURCE_PATH%\build_tools\windows.cmd check_file %VSVARS_PATH% 52 | rem call %X_SOURCE_PATH%\build_tools\windows.cmd check_file %QMAKE_PATH% 53 | rem call %X_SOURCE_PATH%\build_tools\windows.cmd check_file %SEVENZIP_PATH% 54 | 55 | IF NOT [%X_ERROR%] == [] goto exit 56 | 57 | call %X_SOURCE_PATH%\build_tools\windows.cmd make_init 58 | call %X_SOURCE_PATH%\build_tools\windows.cmd make_build %X_SOURCE_PATH%\DIE_sort_source.pro 59 | 60 | rem call %X_SOURCE_PATH%\build_tools\windows.cmd check_file %X_SOURCE_PATH%\build\release\die-sort.exe 61 | 62 | IF NOT [%X_ERROR%] == [] goto exit 63 | 64 | copy %X_SOURCE_PATH%\build\release\die-sort.exe %X_SOURCE_PATH%\release\%X_BUILD_NAME%\ 65 | xcopy %X_SOURCE_PATH%\Detect-It-Easy\db %X_SOURCE_PATH%\release\%X_BUILD_NAME%\db /E /I 66 | xcopy %X_SOURCE_PATH%\Detect-It-Easy\db_extra %X_SOURCE_PATH%\release\%X_BUILD_NAME%\db_extra /E /I 67 | xcopy %X_SOURCE_PATH%\Detect-It-Easy\db_custom %X_SOURCE_PATH%\release\%X_BUILD_NAME%\db_custom /E /I 68 | 69 | call %X_SOURCE_PATH%\build_tools\windows.cmd deploy_qt_library Qt5Widgets 70 | call %X_SOURCE_PATH%\build_tools\windows.cmd deploy_qt_library Qt5Gui 71 | call %X_SOURCE_PATH%\build_tools\windows.cmd deploy_qt_library Qt5Core 72 | call %X_SOURCE_PATH%\build_tools\windows.cmd deploy_qt_library Qt5Widgets 73 | call %X_SOURCE_PATH%\build_tools\windows.cmd deploy_qt_library Qt5Script 74 | call %X_SOURCE_PATH%\build_tools\windows.cmd deploy_qt_library Qt5Sql 75 | call %X_SOURCE_PATH%\build_tools\windows.cmd deploy_qt_plugin platforms qwindows 76 | call %X_SOURCE_PATH%\build_tools\windows.cmd deploy_qt_plugin sqldrivers qsqlite 77 | call %X_SOURCE_PATH%\build_tools\windows.cmd deploy_vc_redist 78 | 79 | call %X_SOURCE_PATH%\build_tools\windows.cmd make_release 80 | 81 | :exit 82 | call %X_SOURCE_PATH%\build_tools\windows.cmd make_clear 83 | 84 | - name: Upload Release as Download 85 | uses: softprops/action-gh-release@v2 86 | env: 87 | RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }} 88 | with: 89 | tag_name: Beta 90 | draft: false 91 | prerelease: true 92 | files: | 93 | ${{ env.RELEASE_PATH }}/*.zip 94 | 95 | -------------------------------------------------------------------------------- /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 | 22 | #ifndef SCANPROGRESS_H 23 | #define SCANPROGRESS_H 24 | 25 | #include "die_script.h" 26 | #include "xcapstone.h" 27 | 28 | class ScanProgress : public QObject { 29 | Q_OBJECT 30 | 31 | public: 32 | enum CF { 33 | CF_FT_TYPE_NAME = 0, 34 | CF_ARCH_FT_TYPE_NAME, 35 | CF_FT_ARCH_TYPE_NAME, 36 | CF_FT_TYPE_NAME_EPBYTES, 37 | CF_ARCH_FT_TYPE_NAME_EPBYTES, 38 | CF_FT_ARCH_TYPE_NAME_EPBYTES, 39 | CF_FT_TYPE_NAME_EPSIG, 40 | CF_ARCH_FT_TYPE_NAME_EPSIG, 41 | CF_FT_ARCH_TYPE_NAME_EPSIG, 42 | CF_FT_TYPE_NAME_EPSIGREL, 43 | CF_ARCH_FT_TYPE_NAME_EPSIGREL, 44 | CF_FT_ARCH_TYPE_NAME_EPSIGREL, 45 | CF_FT_ARCH_TYPE_NAME_IMPORT, 46 | }; 47 | 48 | enum CT { 49 | CT_IDENT = 0, 50 | CT_IDENT_UNK, 51 | CT_UNK 52 | }; 53 | 54 | enum UP { 55 | UP_NONE = 0, 56 | UP_EP_BYTES, 57 | UP_HEADER_BYTES, 58 | UP_OVERLAY_BYTES, 59 | UP_OPCODES, 60 | UP_OPCODES_REL, 61 | }; 62 | 63 | enum FF { 64 | FF_ORIGINAL = 0, 65 | FF_MD5, 66 | FF_MD5_ORIGINAL, 67 | FF_ENTROPY, 68 | FF_ENTROPY_ORIGINAL, 69 | FF_ENTROPYPERCENTAGE, 70 | FF_ENTROPYPERCENTAGE_ORIGINAL, 71 | }; 72 | 73 | enum OVERLAY { 74 | OVERLAY_NONE = 0, 75 | OVERLAY_PRESENT, 76 | OVERLAY_NOTPRESENT 77 | }; 78 | 79 | enum ENTROPY { 80 | ENTROPY_NONE = 0, 81 | ENTROPY_MORETHAN, 82 | ENTROPY_LESSTHAN 83 | }; 84 | 85 | struct SCAN_OPTIONS { 86 | bool bIsRecursive; 87 | bool bIsDeepScan; 88 | bool bIsHeuristicScan; 89 | bool bIsVerbose; 90 | bool bIsAggressive; 91 | bool bSubdirectories; 92 | bool bShowVersion; 93 | bool bShowInfo; 94 | bool bIsSort; 95 | bool bAllFileTypes; 96 | QSet stFileTypes; 97 | bool bAllTypes; 98 | QSet stTypes; 99 | qint32 nCopyCount; 100 | QString sCopyDirectory; 101 | QString sSignatures; 102 | QString sSignaturesExtra; 103 | QString sSignaturesCustom; 104 | bool bSignaturesExtraUse; 105 | bool bSignaturesCustomUse; 106 | bool bDebug; 107 | bool bIsCopyEnable; 108 | bool bIsLogEnable; 109 | CF copyFormat; 110 | CT copyType; 111 | UP unknownPrefix; 112 | FF fileFormat; 113 | OVERLAY overlay; 114 | ENTROPY entropy; 115 | double dEntropyValue; 116 | qint64 nUnknownCount; 117 | bool bRemoveCopied; 118 | bool bCopyTheFirstOnly; 119 | bool bValidOnly; 120 | QString sLogDirectory; 121 | }; 122 | 123 | struct STATS { 124 | qint32 nTotal; 125 | qint32 nCurrent; 126 | qint64 nElapsed; 127 | QString sStatus; 128 | qint32 nNumberOfThreads; 129 | QSet stFiles; 130 | }; 131 | 132 | explicit ScanProgress(QObject *pParent = nullptr); 133 | 134 | void setData(QString sDirectoryName, ScanProgress::SCAN_OPTIONS *pOptions, XBinary::PDSTRUCT *pPdStruct); 135 | 136 | void findFiles(qint64 *pnNumberOfFiles, QString sDirectoryName); 137 | void scanFiles(qint64 *pnNumberOfFiles, QString sDirectoryName); 138 | 139 | void _processFile(QString sFileName); 140 | 141 | static QString createPath(CF copyFormat, XScanEngine::SCANID scanID); 142 | 143 | signals: 144 | void completed(qint64 nElapsedTime); 145 | 146 | public slots: 147 | void process(); 148 | 149 | private: 150 | // #ifdef QT_DEBUG 151 | // const int N_MAXNUMBEROFTHREADS=8; 152 | // #else 153 | // const int N_MAXNUMBEROFTHREADS=8; 154 | // #endif 155 | QString _sDirectoryName; 156 | SCAN_OPTIONS *_pOptions; 157 | DiE_Script m_dieScript; 158 | qint32 g_nFreeIndex; 159 | XBinary::PDSTRUCT *g_pPdStruct; 160 | }; 161 | 162 | #endif // SCANPROGRESS_H 163 | -------------------------------------------------------------------------------- /gui_source/dialogscanprogress.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | DialogScanProgress 4 | 5 | 6 | 7 | 0 8 | 0 9 | 747 10 | 357 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 | Total 61 | 62 | 63 | 64 | 0 65 | 66 | 67 | 0 68 | 69 | 70 | 0 71 | 72 | 73 | 0 74 | 75 | 76 | 77 | 78 | 79 | 70 80 | 0 81 | 82 | 83 | 84 | 85 | 70 86 | 16777215 87 | 88 | 89 | 90 | QFrame::NoFrame 91 | 92 | 93 | 94 | 95 | 96 | Qt::AlignCenter 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | Current 107 | 108 | 109 | 110 | 0 111 | 112 | 113 | 0 114 | 115 | 116 | 0 117 | 118 | 119 | 0 120 | 121 | 122 | 123 | 124 | 125 | 70 126 | 0 127 | 128 | 129 | 130 | 131 | 70 132 | 16777215 133 | 134 | 135 | 136 | QFrame::NoFrame 137 | 138 | 139 | 140 | 141 | 142 | Qt::AlignCenter 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | Threads 153 | 154 | 155 | 156 | 0 157 | 158 | 159 | 0 160 | 161 | 162 | 0 163 | 164 | 165 | 0 166 | 167 | 168 | 169 | 170 | 171 | 70 172 | 0 173 | 174 | 175 | 176 | 177 | 70 178 | 16777215 179 | 180 | 181 | 182 | QFrame::NoFrame 183 | 184 | 185 | 186 | 187 | 188 | Qt::AlignCenter 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | QFrame::NoFrame 201 | 202 | 203 | QFrame::Plain 204 | 205 | 206 | 207 | 208 | 209 | Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter 210 | 211 | 212 | 213 | 214 | 215 | 216 | true 217 | 218 | 219 | 220 | 221 | 222 | 223 | Qt::Vertical 224 | 225 | 226 | 227 | 20 228 | 40 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 0 237 | 238 | 239 | 0 240 | 241 | 242 | Qt::AlignCenter 243 | 244 | 245 | %v/%m 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | Qt::Horizontal 255 | 256 | 257 | 258 | 40 259 | 20 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | Cancel 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | -------------------------------------------------------------------------------- /gui_source/scanprogress.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019-2025 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 | 22 | #include "scanprogress.h" 23 | 24 | ScanProgress::ScanProgress(QObject *pParent) : QObject(pParent) 25 | { 26 | _pOptions = nullptr; 27 | g_pPdStruct = nullptr; 28 | g_nFreeIndex = 0; 29 | } 30 | 31 | void ScanProgress::setData(QString sDirectoryName, ScanProgress::SCAN_OPTIONS *pOptions, XBinary::PDSTRUCT *pPdStruct) 32 | { 33 | this->_sDirectoryName = sDirectoryName; 34 | this->_pOptions = pOptions; 35 | this->g_pPdStruct = pPdStruct; 36 | } 37 | 38 | void ScanProgress::findFiles(qint64 *pnNumberOfFiles, QString sDirectoryName) 39 | { 40 | if (!(g_pPdStruct->bIsStop)) { 41 | XBinary::setPdStructStatus(g_pPdStruct, g_nFreeIndex, sDirectoryName); 42 | 43 | QFileInfo fi(sDirectoryName); 44 | 45 | if (fi.isFile()) { 46 | // g_pPdStruct->pdRecordFiles.nTotal++; 47 | (*pnNumberOfFiles)++; 48 | } else if (fi.isDir() && (_pOptions->bSubdirectories)) { 49 | QDir dir(sDirectoryName); 50 | 51 | QFileInfoList eil = dir.entryInfoList(); 52 | 53 | int nCount = eil.count(); 54 | 55 | XBinary::setPdStructCurrent(g_pPdStruct, g_nFreeIndex, nCount); 56 | 57 | for (int i = 0; (i < nCount) && (!(g_pPdStruct->bIsStop)); i++) { 58 | QString sFN = eil.at(i).fileName(); 59 | 60 | if ((sFN != ".") && (sFN != "..")) { 61 | findFiles(pnNumberOfFiles, eil.at(i).absoluteFilePath()); 62 | } 63 | } 64 | } 65 | } 66 | } 67 | 68 | void ScanProgress::scanFiles(qint64 *pnNumberOfFiles, QString sDirectoryName) 69 | { 70 | if (!(g_pPdStruct->bIsStop)) { 71 | QFileInfo fi(sDirectoryName); 72 | 73 | if (fi.isFile()) { 74 | // g_pPdStruct->pdRecordFiles.nTotal++; 75 | QString sFileName = fi.absoluteFilePath(); 76 | XBinary::setPdStructStatus(g_pPdStruct, g_nFreeIndex, sFileName); 77 | 78 | if (_pOptions->bIsLogEnable) { 79 | QSettings curSettings(_pOptions->sLogDirectory + QDir::separator() + "current.ini", QSettings::IniFormat); 80 | 81 | curSettings.setValue("CurrentFile", sFileName); 82 | curSettings.setValue("Count", (*pnNumberOfFiles)); 83 | } 84 | 85 | _processFile(sFileName); 86 | (*pnNumberOfFiles)++; 87 | XBinary::setPdStructCurrent(g_pPdStruct, g_nFreeIndex, *pnNumberOfFiles); 88 | 89 | } else if (fi.isDir() && (_pOptions->bSubdirectories)) { 90 | QDir dir(sDirectoryName); 91 | 92 | QFileInfoList eil = dir.entryInfoList(); 93 | 94 | int nCount = eil.count(); 95 | 96 | for (int i = 0; (i < nCount) && (!(g_pPdStruct->bIsStop)); i++) { 97 | QString sFN = eil.at(i).fileName(); 98 | 99 | if ((sFN != ".") && (sFN != "..")) { 100 | scanFiles(pnNumberOfFiles, eil.at(i).absoluteFilePath()); 101 | } 102 | } 103 | } 104 | } 105 | } 106 | 107 | void ScanProgress::_processFile(QString sFileName) 108 | { 109 | if (sFileName != "") { 110 | DiE_Script dieScript = m_dieScript; 111 | 112 | QSet fileTypes = XFormats::getFileTypes(sFileName, true, g_pPdStruct); 113 | 114 | XBinary::FT ftPref = XBinary::_getPrefFileType(&fileTypes); 115 | 116 | bool bProcess = _pOptions->stFileTypes.contains(ftPref) || (_pOptions->bAllFileTypes); 117 | bool bIsOverlayPresent = false; 118 | bool bIsValid = true; 119 | 120 | if (bProcess) { 121 | QFile file; 122 | 123 | file.setFileName(sFileName); 124 | 125 | if (file.open(QIODevice::ReadOnly)) { 126 | if ((ftPref == XBinary::FT_PE32) || (ftPref == XBinary::FT_PE64)) { 127 | XPE pe(&file); 128 | 129 | bIsOverlayPresent = pe.isOverlayPresent(); 130 | bIsValid = pe.isFileFormatValid(false, g_pPdStruct); 131 | } else if ((ftPref == XBinary::FT_ELF32) || (ftPref == XBinary::FT_ELF64)) { 132 | XELF elf(&file); 133 | 134 | bIsOverlayPresent = elf.isOverlayPresent(); 135 | bIsValid = elf.isFileFormatValid(false, g_pPdStruct); 136 | } else if ((ftPref == XBinary::FT_MACHO32) || (ftPref == XBinary::FT_MACHO64)) { 137 | XMACH mach(&file); 138 | 139 | bIsOverlayPresent = mach.isOverlayPresent(); 140 | bIsValid = mach.isFileFormatValid(false, g_pPdStruct); 141 | } else if ((ftPref == XBinary::FT_LE) || (ftPref == XBinary::FT_LX)) { 142 | XLE le(&file); 143 | 144 | bIsOverlayPresent = le.isOverlayPresent(); 145 | bIsValid = le.isFileFormatValid(false, g_pPdStruct); 146 | } else if (ftPref == XBinary::FT_NE) { 147 | XNE ne(&file); 148 | 149 | bIsOverlayPresent = ne.isOverlayPresent(); 150 | bIsValid = ne.isFileFormatValid(false, g_pPdStruct); 151 | } else if (ftPref == XBinary::FT_MSDOS) { 152 | XMSDOS msdos(&file); 153 | 154 | bIsOverlayPresent = msdos.isOverlayPresent(); 155 | bIsValid = msdos.isFileFormatValid(false, g_pPdStruct); 156 | } else { 157 | XBinary binary(&file); 158 | 159 | bIsOverlayPresent = binary.isOverlayPresent(); 160 | bIsValid = binary.isFileFormatValid(false, g_pPdStruct); 161 | } 162 | } 163 | } 164 | 165 | if (bProcess && (_pOptions->bValidOnly)) { 166 | bProcess = bIsValid; 167 | } 168 | 169 | if (_pOptions->overlay == OVERLAY_PRESENT) { 170 | if (bProcess) { 171 | bProcess = (bIsOverlayPresent); 172 | } 173 | } else if (_pOptions->overlay == OVERLAY_NOTPRESENT) { 174 | if (bProcess) { 175 | bProcess = (!bIsOverlayPresent); 176 | } 177 | } 178 | 179 | if (_pOptions->entropy == ENTROPY_MORETHAN) { 180 | if (bProcess) { 181 | bProcess = (XBinary::getEntropy(sFileName) >= _pOptions->dEntropyValue); 182 | } 183 | } else if (_pOptions->entropy == ENTROPY_LESSTHAN) { 184 | if (bProcess) { 185 | bProcess = (XBinary::getEntropy(sFileName) <= _pOptions->dEntropyValue); 186 | } 187 | } 188 | 189 | if (bProcess) { 190 | QString sTempFile; 191 | 192 | if ((_pOptions->bDebug) && (_pOptions->bIsCopyEnable)) { 193 | sTempFile = _pOptions->sCopyDirectory; 194 | 195 | XBinary::createDirectory(sTempFile); 196 | 197 | sTempFile += QDir::separator() + QFileInfo(sFileName).fileName(); 198 | 199 | XBinary::copyFile(sFileName, sTempFile); 200 | } 201 | 202 | XScanEngine::SCAN_OPTIONS scanOptions = {}; 203 | 204 | scanOptions.bIsDeepScan = _pOptions->bIsDeepScan; 205 | scanOptions.bIsVerbose = _pOptions->bIsVerbose; 206 | scanOptions.bIsRecursiveScan = _pOptions->bIsRecursive; 207 | scanOptions.bIsHeuristicScan = _pOptions->bIsHeuristicScan; 208 | scanOptions.bIsAggressiveScan = _pOptions->bIsAggressive; 209 | scanOptions.bShowType = true; 210 | scanOptions.bShowVersion = _pOptions->bShowVersion; 211 | scanOptions.bShowInfo = _pOptions->bShowInfo; 212 | scanOptions.bIsSort = _pOptions->bIsSort; 213 | scanOptions.nBufferSize = 8 * 1024 * 1024; 214 | scanOptions.bUseExtraDatabase = _pOptions->bSignaturesExtraUse; 215 | scanOptions.bUseCustomDatabase = _pOptions->bSignaturesCustomUse; 216 | scanOptions.fileType = ftPref; 217 | // scanOptions.bShowUnknown = false; 218 | 219 | DiE_Script::SCAN_RESULT scanResult = dieScript.scanFile(sFileName, &scanOptions, g_pPdStruct); 220 | 221 | if (_pOptions->bIsLogEnable) { 222 | int nCount = scanResult.listRecords.count(); 223 | 224 | for (int i = 0; i < nCount; i++) { 225 | const XScanEngine::SCANSTRUCT &ss = scanResult.listRecords.at(i); 226 | 227 | QString sScanResult = XBinary::fileTypeIdToString(ss.id.fileType); 228 | QString sScanResultTmp = XScanEngine::createResultStringEx(&scanOptions, &ss); 229 | 230 | if (sScanResultTmp != "") { 231 | sScanResult += "." + sScanResultTmp; 232 | } 233 | 234 | sScanResult += ".txt"; 235 | 236 | sScanResult = XBinary::convertFileNameSymbols(sScanResult); 237 | 238 | QString sFileNameStat = _pOptions->sLogDirectory + QDir::separator() + "stats" + QDir::separator() + sScanResult; 239 | 240 | XBinary::appendToFile(sFileNameStat, sFileName); 241 | } 242 | } 243 | 244 | QString _sBaseFileName = QFileInfo(scanResult.sFileName).fileName(); 245 | bool bGlobalCopy = false; 246 | if (_pOptions->bIsCopyEnable) { 247 | if ((_pOptions->fileFormat == FF_MD5) || (_pOptions->fileFormat == FF_MD5_ORIGINAL)) { 248 | QString sMD5 = XBinary::getHash(XBinary::HASH_MD5, scanResult.sFileName, g_pPdStruct); 249 | 250 | if (_pOptions->fileFormat == FF_MD5) { 251 | _sBaseFileName = sMD5; 252 | } else if (_pOptions->fileFormat == FF_MD5_ORIGINAL) { 253 | _sBaseFileName = sMD5 + "_" + _sBaseFileName; 254 | } 255 | } else if ((_pOptions->fileFormat == FF_ENTROPY) || (_pOptions->fileFormat == FF_ENTROPY_ORIGINAL)) { 256 | QString sEntropy = QString::number(XBinary::getEntropy(scanResult.sFileName, g_pPdStruct), 'f', 2); 257 | 258 | if (_pOptions->fileFormat == FF_ENTROPY) { 259 | _sBaseFileName = sEntropy; 260 | } else if (_pOptions->fileFormat == FF_ENTROPY_ORIGINAL) { 261 | _sBaseFileName = sEntropy + "_" + _sBaseFileName; 262 | } 263 | } else if ((_pOptions->fileFormat == FF_ENTROPYPERCENTAGE) || (_pOptions->fileFormat == FF_ENTROPYPERCENTAGE_ORIGINAL)) { 264 | double dEntropy = XBinary::getEntropy(scanResult.sFileName, g_pPdStruct); 265 | qint32 nEntropy = (dEntropy * 100.0) / 8.0; 266 | 267 | if (nEntropy == 100) { 268 | nEntropy = 99; 269 | } 270 | 271 | QString sEntropy = QString("%1").arg(nEntropy, 2, 10, QChar('0')); 272 | 273 | if (_pOptions->fileFormat == FF_ENTROPYPERCENTAGE) { 274 | _sBaseFileName = sEntropy; 275 | } else if (_pOptions->fileFormat == FF_ENTROPYPERCENTAGE_ORIGINAL) { 276 | _sBaseFileName = sEntropy + "_" + _sBaseFileName; 277 | } 278 | } 279 | 280 | int nCount = scanResult.listRecords.count(); 281 | 282 | bool bIdentified = false; 283 | bool bCopyTheFirstOnly = false; 284 | 285 | QString sEPBytes; 286 | QString sEP; 287 | QString sEPREL; 288 | QString sImport; 289 | 290 | XScanEngine::SCANID _id = {}; 291 | 292 | if (nCount) { 293 | _id = scanResult.listRecords.at(0).id; 294 | 295 | for (int i = 0; (i < nCount) && (!(g_pPdStruct->bIsStop)); i++) { 296 | XScanEngine::SCANSTRUCT ss = scanResult.listRecords.at(i); 297 | 298 | if ((_pOptions->stFileTypes.contains(ss.id.fileType) || (_pOptions->bAllFileTypes)) && (ss.sName != "") && (!ss.bIsUnknown)) { 299 | if ((_pOptions->copyFormat == ScanProgress::CF_ARCH_FT_TYPE_NAME_EPBYTES) || 300 | (_pOptions->copyFormat == ScanProgress::CF_FT_ARCH_TYPE_NAME_EPBYTES) || 301 | (_pOptions->copyFormat == ScanProgress::CF_FT_TYPE_NAME_EPBYTES) || (_pOptions->copyFormat == ScanProgress::CF_ARCH_FT_TYPE_NAME_EPSIG) || 302 | (_pOptions->copyFormat == ScanProgress::CF_FT_ARCH_TYPE_NAME_EPSIG) || (_pOptions->copyFormat == ScanProgress::CF_FT_TYPE_NAME_EPSIG) || 303 | (_pOptions->copyFormat == ScanProgress::CF_ARCH_FT_TYPE_NAME_EPSIGREL) || 304 | (_pOptions->copyFormat == ScanProgress::CF_FT_ARCH_TYPE_NAME_EPSIGREL) || 305 | (_pOptions->copyFormat == ScanProgress::CF_FT_TYPE_NAME_EPSIGREL)) { 306 | QFile _file; 307 | _file.setFileName(sFileName); 308 | 309 | if (_file.open(QIODevice::ReadOnly)) { 310 | XBinary::_MEMORY_MAP memoryMap = XFormats::getMemoryMap(ss.id.fileType, XBinary::MAPMODE_UNKNOWN, &_file, g_pPdStruct); 311 | qint64 nEPAddress = XFormats::getEntryPointAddress(ss.id.fileType, &_file); 312 | qint64 nEPOffset = XFormats::getEntryPointOffset(ss.id.fileType, &_file); 313 | 314 | XDisasmCore disasmCore; 315 | disasmCore.setMode(XBinary::getDisasmMode(&memoryMap)); 316 | 317 | sEPBytes = XBinary::getSignature(&_file, nEPOffset, 20); 318 | sEP = disasmCore.getSignature(&_file, &memoryMap, nEPAddress, XDisasmCore::ST_MASK, 10).replace(".", "_"); 319 | sEPREL = disasmCore.getSignature(&_file, &memoryMap, nEPAddress, XDisasmCore::ST_REL, 10).replace(".", "_"); 320 | 321 | _file.close(); 322 | } 323 | } else if (_pOptions->copyFormat == ScanProgress::CF_FT_ARCH_TYPE_NAME_IMPORT) { 324 | sImport = ""; 325 | 326 | if ((_id.fileType == XBinary::FT_PE32) || (_id.fileType == XBinary::FT_PE64)) { 327 | QFile _file; 328 | _file.setFileName(sFileName); 329 | 330 | if (_file.open(QIODevice::ReadOnly)) { 331 | XPE pe(&_file); 332 | 333 | if (pe.isValid()) { 334 | QList listImportHashes = pe.getImportPositionHashes(); 335 | 336 | if (listImportHashes.count()) { 337 | sImport += XBinary::valueToHex(listImportHashes.at(0)); 338 | sImport += "_"; 339 | } 340 | 341 | QList listImportRecords = pe.getImportRecords(); 342 | 343 | sImport += XBinary::valueToHex(pe.getImportHash32(&listImportRecords)); 344 | sImport += "_"; 345 | sImport += XBinary::valueToHex(pe.getImportHash64(&listImportRecords)); 346 | } 347 | 348 | _file.close(); 349 | } 350 | } 351 | } 352 | 353 | if (((_pOptions->stTypes.contains(ss.sType.toLower())) || (_pOptions->bAllTypes)) && (!ss.bIsUnknown)) { 354 | bIdentified = true; 355 | 356 | if ((_pOptions->copyType == CT_IDENT) || (_pOptions->copyType == CT_IDENT_UNK)) { 357 | XScanEngine::SCAN_OPTIONS _scanOptions = scanOptions; 358 | _scanOptions.bShowType = false; 359 | QString sResult = XScanEngine::createResultStringEx(&_scanOptions, &ss); 360 | 361 | sResult = XBinary::convertFileNameSymbols(sResult); 362 | 363 | // quint32 nCRC = XBinary::getStringCustomCRC32(XBinary::fileTypeIdToString(ss.id.fileType) + ss.id.sArch + ss.sType + sResult); 364 | 365 | bool bCopy = true; 366 | 367 | int nCurrentCount = 0; // TODO 368 | 369 | if (_pOptions->nCopyCount) { 370 | if (nCurrentCount >= _pOptions->nCopyCount) { 371 | bCopy = false; 372 | } 373 | } 374 | 375 | if (_pOptions->bCopyTheFirstOnly) { 376 | if (!bCopyTheFirstOnly) { 377 | bCopyTheFirstOnly = true; 378 | } else { 379 | bCopy = false; 380 | } 381 | } 382 | 383 | if (bCopy) { 384 | QString _sFileName = _pOptions->sCopyDirectory + QDir::separator() + createPath(_pOptions->copyFormat, ss.id) + 385 | QDir::separator() + ss.sType + QDir::separator() + sResult; 386 | 387 | if ((_pOptions->copyFormat == ScanProgress::CF_ARCH_FT_TYPE_NAME_EPBYTES) || 388 | (_pOptions->copyFormat == ScanProgress::CF_FT_ARCH_TYPE_NAME_EPBYTES) || 389 | (_pOptions->copyFormat == ScanProgress::CF_FT_TYPE_NAME_EPBYTES)) { 390 | _sFileName += QDir::separator() + sEPBytes; 391 | } else if ((_pOptions->copyFormat == ScanProgress::CF_ARCH_FT_TYPE_NAME_EPSIG) || 392 | (_pOptions->copyFormat == ScanProgress::CF_FT_ARCH_TYPE_NAME_EPSIG) || 393 | (_pOptions->copyFormat == ScanProgress::CF_FT_TYPE_NAME_EPSIG)) { 394 | _sFileName += QDir::separator() + sEP; 395 | } else if ((_pOptions->copyFormat == ScanProgress::CF_ARCH_FT_TYPE_NAME_EPSIGREL) || 396 | (_pOptions->copyFormat == ScanProgress::CF_FT_ARCH_TYPE_NAME_EPSIGREL) || 397 | (_pOptions->copyFormat == ScanProgress::CF_FT_TYPE_NAME_EPSIGREL)) { 398 | _sFileName += QDir::separator() + sEPREL; 399 | } else if (_pOptions->copyFormat == ScanProgress::CF_FT_ARCH_TYPE_NAME_IMPORT) { 400 | if (sImport != "") { 401 | _sFileName += QDir::separator() + sImport; 402 | } 403 | } 404 | 405 | XBinary::createDirectory(_sFileName); 406 | 407 | _sFileName += QDir::separator() + _sBaseFileName; 408 | 409 | if (XBinary::copyFile(scanResult.sFileName, _sFileName)) { 410 | bGlobalCopy = true; 411 | } 412 | } 413 | } 414 | } else { 415 | #ifdef QT_DEBUG 416 | qDebug("Missed %s", ss.sType.toLower().toLatin1().data()); 417 | #endif 418 | } 419 | } 420 | } 421 | } 422 | 423 | if ((!bIdentified) && ((_pOptions->copyType == CT_IDENT_UNK) || (_pOptions->copyType == CT_UNK))) { 424 | if (_pOptions->stFileTypes.contains(_id.fileType) || (_pOptions->bAllFileTypes)) { 425 | // quint32 nCRC = XBinary::getStringCustomCRC32(XBinary::fileTypeIdToString(_id.fileType) + _id.sArch + "__UNKNOWN"); 426 | 427 | bool bCopy = true; 428 | 429 | int nCurrentCount = 0; // TODO 430 | 431 | if (_pOptions->nCopyCount) { 432 | if (nCurrentCount >= _pOptions->nCopyCount) { 433 | bCopy = false; 434 | } 435 | } 436 | 437 | if (bCopy) { 438 | QString _sFileName = _pOptions->sCopyDirectory + QDir::separator() + createPath(_pOptions->copyFormat, _id) + QDir::separator() + "__UNKNOWN"; 439 | 440 | if ((_pOptions->copyFormat == ScanProgress::CF_ARCH_FT_TYPE_NAME_EPBYTES) || 441 | (_pOptions->copyFormat == ScanProgress::CF_FT_ARCH_TYPE_NAME_EPBYTES) || 442 | (_pOptions->copyFormat == ScanProgress::CF_FT_TYPE_NAME_EPBYTES)) { 443 | _sFileName += QDir::separator() + sEPBytes; 444 | } else if ((_pOptions->copyFormat == ScanProgress::CF_ARCH_FT_TYPE_NAME_EPSIG) || 445 | (_pOptions->copyFormat == ScanProgress::CF_FT_ARCH_TYPE_NAME_EPSIG) || 446 | (_pOptions->copyFormat == ScanProgress::CF_FT_TYPE_NAME_EPSIG)) { 447 | _sFileName += QDir::separator() + sEP; 448 | } else if ((_pOptions->copyFormat == ScanProgress::CF_ARCH_FT_TYPE_NAME_EPSIGREL) || 449 | (_pOptions->copyFormat == ScanProgress::CF_FT_ARCH_TYPE_NAME_EPSIGREL) || 450 | (_pOptions->copyFormat == ScanProgress::CF_FT_TYPE_NAME_EPSIGREL)) { 451 | _sFileName += QDir::separator() + sEPREL; 452 | } else if (_pOptions->copyFormat == ScanProgress::CF_FT_ARCH_TYPE_NAME_IMPORT) { 453 | if (sImport != "") { 454 | _sFileName += QDir::separator() + sImport; 455 | } 456 | } 457 | 458 | if (_pOptions->unknownPrefix != UP_NONE) { 459 | QString sFolderName; 460 | qint32 nUnknownCount = _pOptions->nUnknownCount; 461 | 462 | QFile file; 463 | 464 | file.setFileName(scanResult.sFileName); 465 | 466 | if (file.open(QIODevice::ReadOnly)) { 467 | if ((_id.fileType == XBinary::FT_PE32) || (_id.fileType == XBinary::FT_PE64)) { 468 | XPE pe(&file); 469 | 470 | if (_pOptions->unknownPrefix == UP_EP_BYTES) { 471 | sFolderName = pe.getSignature(pe._getEntryPointOffset(), nUnknownCount); 472 | } else if (_pOptions->unknownPrefix == UP_OVERLAY_BYTES) { 473 | if (bIsOverlayPresent) { 474 | sFolderName = pe.getSignature(pe.getOverlayOffset(), nUnknownCount); 475 | } 476 | } else if (_pOptions->unknownPrefix == UP_HEADER_BYTES) { 477 | sFolderName = pe.getSignature(0, nUnknownCount); 478 | } 479 | } else if ((_id.fileType == XBinary::FT_ELF32) || (_id.fileType == XBinary::FT_ELF64)) { 480 | XELF elf(&file); 481 | 482 | if (_pOptions->unknownPrefix == UP_EP_BYTES) { 483 | sFolderName = elf.getSignature(elf._getEntryPointOffset(), nUnknownCount); 484 | } else if (_pOptions->unknownPrefix == UP_OVERLAY_BYTES) { 485 | if (bIsOverlayPresent) { 486 | sFolderName = elf.getSignature(elf.getOverlayOffset(), nUnknownCount); 487 | } 488 | } else if (_pOptions->unknownPrefix == UP_HEADER_BYTES) { 489 | sFolderName = elf.getSignature(0, nUnknownCount); 490 | } 491 | } else if ((_id.fileType == XBinary::FT_MACHO32) || (_id.fileType == XBinary::FT_MACHO64)) { 492 | XMACH mach(&file); 493 | 494 | if (_pOptions->unknownPrefix == UP_EP_BYTES) { 495 | sFolderName = mach.getSignature(mach._getEntryPointOffset(), nUnknownCount); 496 | } else if (_pOptions->unknownPrefix == UP_OVERLAY_BYTES) { 497 | if (bIsOverlayPresent) { 498 | sFolderName = mach.getSignature(mach.getOverlayOffset(), nUnknownCount); 499 | } 500 | } else if (_pOptions->unknownPrefix == UP_HEADER_BYTES) { 501 | sFolderName = mach.getSignature(0, nUnknownCount); 502 | } 503 | } else if ((_id.fileType == XBinary::FT_LE) || (_id.fileType == XBinary::FT_LX)) { 504 | XLE le(&file); 505 | 506 | if (_pOptions->unknownPrefix == UP_EP_BYTES) { 507 | sFolderName = le.getSignature(le._getEntryPointOffset(), nUnknownCount); 508 | } else if (_pOptions->unknownPrefix == UP_OVERLAY_BYTES) { 509 | if (bIsOverlayPresent) { 510 | sFolderName = le.getSignature(le.getOverlayOffset(), nUnknownCount); 511 | } 512 | } else if (_pOptions->unknownPrefix == UP_HEADER_BYTES) { 513 | sFolderName = le.getSignature(0, nUnknownCount); 514 | } 515 | } else if (_id.fileType == XBinary::FT_NE) { 516 | XNE ne(&file); 517 | 518 | if (_pOptions->unknownPrefix == UP_EP_BYTES) { 519 | sFolderName = ne.getSignature(ne._getEntryPointOffset(), nUnknownCount); 520 | } else if (_pOptions->unknownPrefix == UP_OVERLAY_BYTES) { 521 | if (bIsOverlayPresent) { 522 | sFolderName = ne.getSignature(ne.getOverlayOffset(), nUnknownCount); 523 | } 524 | } else if (_pOptions->unknownPrefix == UP_HEADER_BYTES) { 525 | sFolderName = ne.getSignature(0, nUnknownCount); 526 | } 527 | } else if (_id.fileType == XBinary::FT_MSDOS) { 528 | XMSDOS msdos(&file); 529 | 530 | if (_pOptions->unknownPrefix == UP_EP_BYTES) { 531 | sFolderName = msdos.getSignature(msdos._getEntryPointOffset(), nUnknownCount); 532 | } else if (_pOptions->unknownPrefix == UP_OVERLAY_BYTES) { 533 | if (bIsOverlayPresent) { 534 | sFolderName = msdos.getSignature(msdos.getOverlayOffset(), nUnknownCount); 535 | } 536 | } else if (_pOptions->unknownPrefix == UP_HEADER_BYTES) { 537 | sFolderName = msdos.getSignature(0, nUnknownCount); 538 | } 539 | } else { 540 | XBinary binary(&file); 541 | 542 | if (_pOptions->unknownPrefix == UP_EP_BYTES) { 543 | sFolderName = binary.getSignature(binary._getEntryPointOffset(), nUnknownCount); 544 | } else if (_pOptions->unknownPrefix == UP_OVERLAY_BYTES) { 545 | if (bIsOverlayPresent) { 546 | sFolderName = binary.getSignature(binary.getOverlayOffset(), nUnknownCount); 547 | } 548 | } else if (_pOptions->unknownPrefix == UP_HEADER_BYTES) { 549 | sFolderName = binary.getSignature(0, nUnknownCount); 550 | } 551 | } 552 | 553 | if (_pOptions->unknownPrefix == UP_OPCODES) { 554 | XBinary::_MEMORY_MAP memoryMap = XFormats::getMemoryMap(_id.fileType, XBinary::MAPMODE_UNKNOWN, &file); 555 | qint64 nEntryPointAddress = XFormats::getEntryPointAddress(_id.fileType, &file); 556 | 557 | XDisasmCore disasmCore; 558 | disasmCore.setMode(XBinary::getDisasmMode(&memoryMap)); 559 | 560 | sFolderName = disasmCore.getSignature(&file, &memoryMap, nEntryPointAddress, XDisasmCore::ST_MASK, nUnknownCount); 561 | } else if (_pOptions->unknownPrefix == UP_OPCODES_REL) { 562 | XBinary::_MEMORY_MAP memoryMap = XFormats::getMemoryMap(_id.fileType, XBinary::MAPMODE_UNKNOWN, &file); 563 | qint64 nEntryPointAddress = XFormats::getEntryPointAddress(_id.fileType, &file); 564 | 565 | XDisasmCore disasmCore; 566 | disasmCore.setMode(XBinary::getDisasmMode(&memoryMap)); 567 | 568 | sFolderName = disasmCore.getSignature(&file, &memoryMap, nEntryPointAddress, XDisasmCore::ST_REL, nUnknownCount); 569 | } 570 | 571 | file.close(); 572 | } 573 | 574 | sFolderName = sFolderName.replace(".", "_"); 575 | 576 | if (sFolderName != "") { 577 | _sFileName += QDir::separator() + sFolderName; 578 | } 579 | } 580 | 581 | XBinary::createDirectory(_sFileName); 582 | 583 | _sFileName += QDir::separator() + _sBaseFileName; 584 | 585 | if (XBinary::copyFile(scanResult.sFileName, _sFileName)) { 586 | bGlobalCopy = true; 587 | } else { 588 | #ifdef QT_DEBUG 589 | qDebug("%s", _sFileName.toUtf8().data()); 590 | #endif 591 | } 592 | } 593 | } 594 | } 595 | } 596 | 597 | if (scanResult.listErrors.count()) { 598 | if (_pOptions->bIsCopyEnable) { 599 | QString _sFileName = _pOptions->sCopyDirectory; 600 | _sFileName = XBinary::convertFileName(_sFileName); 601 | XBinary::createDirectory(_sFileName); 602 | _sFileName += QDir::separator() + QString("__ERRORS"); 603 | _sFileName = XBinary::convertFileName(_sFileName); 604 | XBinary::createDirectory(_sFileName); 605 | _sFileName += QDir::separator() + QFileInfo(sFileName).fileName(); 606 | 607 | XBinary::copyFile(scanResult.sFileName, _sFileName); 608 | } 609 | 610 | if (_pOptions->bIsLogEnable) { 611 | QString sErrorString = 612 | QString("%1 : %2 : %3").arg(scanResult.sFileName, scanResult.listErrors.at(0).sScript, scanResult.listErrors.at(0).sErrorString); 613 | XBinary::appendToFile(_pOptions->sLogDirectory + QDir::separator() + "errors.txt", sErrorString); 614 | } 615 | } 616 | 617 | if ((_pOptions->bDebug) && (_pOptions->bIsCopyEnable)) { 618 | XBinary::removeFile(sTempFile); 619 | } 620 | 621 | if ((_pOptions->bRemoveCopied) && bGlobalCopy && (_pOptions->bIsCopyEnable)) { 622 | XBinary::removeFile(scanResult.sFileName); 623 | } 624 | } else if ((_pOptions->bValidOnly) && (!bIsValid) && (_pOptions->bIsCopyEnable)) { 625 | QString sTempFile = 626 | _pOptions->sCopyDirectory + QDir::separator() + XBinary::convertFileNameSymbols(XBinary::fileTypeIdToString(ftPref)) + QDir::separator() + "__BROKEN"; 627 | 628 | XBinary::createDirectory(sTempFile); 629 | 630 | sTempFile += QDir::separator() + QFileInfo(sFileName).fileName(); 631 | 632 | XBinary::copyFile(sFileName, sTempFile); 633 | 634 | if (_pOptions->bRemoveCopied) { 635 | XBinary::removeFile(sFileName); 636 | } 637 | } 638 | } 639 | } 640 | 641 | QString ScanProgress::createPath(ScanProgress::CF copyFormat, XScanEngine::SCANID scanID) 642 | { 643 | QString sResult; 644 | 645 | if ((copyFormat == ScanProgress::CF_FT_TYPE_NAME) || (copyFormat == ScanProgress::CF_FT_TYPE_NAME_EPSIG) || (copyFormat == ScanProgress::CF_FT_TYPE_NAME_EPSIGREL)) { 646 | sResult = XBinary::convertFileNameSymbols(XBinary::fileTypeIdToString(scanID.fileType)); 647 | } else if ((copyFormat == ScanProgress::CF_FT_ARCH_TYPE_NAME) || (copyFormat == ScanProgress::CF_FT_ARCH_TYPE_NAME_EPSIG) || 648 | (copyFormat == ScanProgress::CF_FT_ARCH_TYPE_NAME_EPSIGREL) || (copyFormat == ScanProgress::CF_FT_ARCH_TYPE_NAME_IMPORT)) { 649 | sResult = XBinary::convertFileNameSymbols(XBinary::fileTypeIdToString(scanID.fileType)) + QDir::separator() + scanID.sArch; 650 | } else if ((copyFormat == ScanProgress::CF_ARCH_FT_TYPE_NAME) || (copyFormat == ScanProgress::CF_ARCH_FT_TYPE_NAME_EPSIG) || 651 | (copyFormat == ScanProgress::CF_ARCH_FT_TYPE_NAME_EPSIGREL)) { 652 | sResult = scanID.sArch + QDir::separator() + XBinary::convertFileNameSymbols(XBinary::fileTypeIdToString(scanID.fileType)); 653 | } 654 | 655 | // TODO 656 | 657 | // CF_FT_TYPE_NAME_EP, 658 | // CF_ARCH_FT_TYPE_NAME_EP, 659 | // CF_FT_ARCH_TYPE_NAME_EP, 660 | // CF_FT_TYPE_NAME_EPREL, 661 | // CF_ARCH_FT_TYPE_NAME_EPREL, 662 | // CF_FT_ARCH_TYPE_NAME_EPREL 663 | 664 | return sResult; 665 | } 666 | 667 | void ScanProgress::process() 668 | { 669 | QElapsedTimer scanTimer; 670 | scanTimer.start(); 671 | 672 | qint64 nNumberOfFiles = 0; 673 | 674 | { 675 | g_nFreeIndex = XBinary::getFreeIndex(g_pPdStruct); 676 | XBinary::setPdStructInit(g_pPdStruct, g_nFreeIndex, 0); 677 | 678 | findFiles(&nNumberOfFiles, _sDirectoryName); 679 | 680 | XBinary::setPdStructFinished(g_pPdStruct, g_nFreeIndex); 681 | } 682 | 683 | m_dieScript.loadDatabase(_pOptions->sSignatures, DiE_ScriptEngine::DT_MAIN, g_pPdStruct); 684 | m_dieScript.loadDatabase(_pOptions->sSignaturesExtra, DiE_ScriptEngine::DT_EXTRA, g_pPdStruct); 685 | m_dieScript.loadDatabase(_pOptions->sSignaturesCustom, DiE_ScriptEngine::DT_CUSTOM, g_pPdStruct); 686 | 687 | { 688 | g_nFreeIndex = XBinary::getFreeIndex(g_pPdStruct); 689 | XBinary::setPdStructInit(g_pPdStruct, g_nFreeIndex, nNumberOfFiles); 690 | 691 | qint64 nCurrentCount = 0; 692 | 693 | if (_pOptions->bIsLogEnable) { 694 | XBinary::createDirectory(_pOptions->sLogDirectory); 695 | XBinary::createDirectory(_pOptions->sLogDirectory + QDir::separator() + "stats"); 696 | } 697 | if (_pOptions->bIsCopyEnable) { 698 | XBinary::createDirectory(_pOptions->sCopyDirectory); 699 | } 700 | 701 | scanFiles(&nCurrentCount, _sDirectoryName); 702 | 703 | XBinary::setPdStructFinished(g_pPdStruct, g_nFreeIndex); 704 | } 705 | 706 | emit completed(scanTimer.elapsed()); 707 | } 708 | -------------------------------------------------------------------------------- /gui_source/guimainwindow.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019-2025 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 | 22 | #include "guimainwindow.h" 23 | 24 | #include "ui_guimainwindow.h" 25 | 26 | GuiMainWindow::GuiMainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::GuiMainWindow) 27 | { 28 | ui->setupUi(this); 29 | 30 | setWindowTitle(QString("%1 v%2").arg(X_APPLICATIONNAME, X_APPLICATIONVERSION)); 31 | 32 | options = {0}; 33 | 34 | connect(ui->checkBoxBinary, SIGNAL(toggled(bool)), this, SLOT(onFileTypeToggled(bool))); 35 | connect(ui->checkBoxCOM, SIGNAL(toggled(bool)), this, SLOT(onFileTypeToggled(bool))); 36 | connect(ui->checkBoxMSDOS, SIGNAL(toggled(bool)), this, SLOT(onFileTypeToggled(bool))); 37 | connect(ui->checkBoxDOS16M, SIGNAL(toggled(bool)), this, SLOT(onFileTypeToggled(bool))); 38 | connect(ui->checkBoxDOS4G, SIGNAL(toggled(bool)), this, SLOT(onFileTypeToggled(bool))); 39 | connect(ui->checkBoxNE, SIGNAL(toggled(bool)), this, SLOT(onFileTypeToggled(bool))); 40 | connect(ui->checkBoxLE, SIGNAL(toggled(bool)), this, SLOT(onFileTypeToggled(bool))); 41 | connect(ui->checkBoxLX, SIGNAL(toggled(bool)), this, SLOT(onFileTypeToggled(bool))); 42 | connect(ui->checkBoxPE32, SIGNAL(toggled(bool)), this, SLOT(onFileTypeToggled(bool))); 43 | connect(ui->checkBoxPE64, SIGNAL(toggled(bool)), this, SLOT(onFileTypeToggled(bool))); 44 | connect(ui->checkBoxELF32, SIGNAL(toggled(bool)), this, SLOT(onFileTypeToggled(bool))); 45 | connect(ui->checkBoxELF64, SIGNAL(toggled(bool)), this, SLOT(onFileTypeToggled(bool))); 46 | connect(ui->checkBoxMACHO32, SIGNAL(toggled(bool)), this, SLOT(onFileTypeToggled(bool))); 47 | connect(ui->checkBoxMACHO64, SIGNAL(toggled(bool)), this, SLOT(onFileTypeToggled(bool))); 48 | connect(ui->checkBoxZIP, SIGNAL(toggled(bool)), this, SLOT(onFileTypeToggled(bool))); 49 | connect(ui->checkBoxJAR, SIGNAL(toggled(bool)), this, SLOT(onFileTypeToggled(bool))); 50 | connect(ui->checkBoxAPK, SIGNAL(toggled(bool)), this, SLOT(onFileTypeToggled(bool))); 51 | connect(ui->checkBoxMACHOFAT, SIGNAL(toggled(bool)), this, SLOT(onFileTypeToggled(bool))); 52 | connect(ui->checkBoxNPM, SIGNAL(toggled(bool)), this, SLOT(onFileTypeToggled(bool))); 53 | connect(ui->checkBoxPDF, SIGNAL(toggled(bool)), this, SLOT(onFileTypeToggled(bool))); 54 | connect(ui->checkBoxDEX, SIGNAL(toggled(bool)), this, SLOT(onFileTypeToggled(bool))); 55 | connect(ui->checkBoxRAR, SIGNAL(toggled(bool)), this, SLOT(onFileTypeToggled(bool))); 56 | connect(ui->checkBoxAmiga, SIGNAL(toggled(bool)), this, SLOT(onFileTypeToggled(bool))); 57 | connect(ui->checkBoxJavaClass, SIGNAL(toggled(bool)), this, SLOT(onFileTypeToggled(bool))); 58 | connect(ui->checkBoxIPA, SIGNAL(toggled(bool)), this, SLOT(onFileTypeToggled(bool))); 59 | connect(ui->checkBoxCFBF, SIGNAL(toggled(bool)), this, SLOT(onFileTypeToggled(bool))); 60 | connect(ui->checkBoxJpeg, SIGNAL(toggled(bool)), this, SLOT(onFileTypeToggled(bool))); 61 | connect(ui->checkBoxPNG, SIGNAL(toggled(bool)), this, SLOT(onFileTypeToggled(bool))); 62 | connect(ui->checkBoxAtariST, SIGNAL(toggled(bool)), this, SLOT(onFileTypeToggled(bool))); 63 | 64 | connect(ui->checkBox_archive, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 65 | connect(ui->checkBox_audio, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 66 | connect(ui->checkBox_boot, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 67 | connect(ui->checkBox_compiler, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 68 | connect(ui->checkBox_converter, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 69 | connect(ui->checkBox_driver, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 70 | connect(ui->checkBox_emulator, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 71 | connect(ui->checkBox_extender, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 72 | connect(ui->checkBox_format, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 73 | connect(ui->checkBox_framework, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 74 | connect(ui->checkBox_image, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 75 | connect(ui->checkBox_immunizer, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 76 | connect(ui->checkBox_installer, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 77 | connect(ui->checkBox_joiner, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 78 | connect(ui->checkBox_keygen, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 79 | connect(ui->checkBox_library, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 80 | connect(ui->checkBox_linker, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 81 | connect(ui->checkBox_loader, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 82 | connect(ui->checkBox_other, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 83 | connect(ui->checkBox_overlay, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 84 | connect(ui->checkBox_packer, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 85 | connect(ui->checkBox_patcher, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 86 | connect(ui->checkBox_player, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 87 | connect(ui->checkBox_protection, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 88 | connect(ui->checkBox_protector, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 89 | connect(ui->checkBox_script, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 90 | connect(ui->checkBox_self_displayer, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 91 | connect(ui->checkBox_sfx, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 92 | connect(ui->checkBox_source, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 93 | connect(ui->checkBox_system, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 94 | connect(ui->checkBox_type, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 95 | connect(ui->checkBox_operation_system, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 96 | connect(ui->checkBox_cryptor, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 97 | connect(ui->checkBox_crypter, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 98 | connect(ui->checkBox_licensing, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 99 | connect(ui->checkBox_language, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 100 | connect(ui->checkBox_tool, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 101 | connect(ui->checkBox_dos_extender, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 102 | connect(ui->checkBox_sign_tool, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 103 | connect(ui->checkBox_virtual_machine, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 104 | connect(ui->checkBox_malware, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 105 | connect(ui->checkBox_virus, SIGNAL(toggled(bool)), this, SLOT(onTypeToggled(bool))); 106 | 107 | ui->checkBoxAllFileTypes->setChecked(true); 108 | ui->checkBoxAllTypes->setChecked(true); 109 | 110 | ui->comboBoxCopyFormat->addItem("FileType/Type/Name"); 111 | ui->comboBoxCopyFormat->addItem("Arch/FileType/Type/Name"); 112 | ui->comboBoxCopyFormat->addItem("FileType/Arch/Type/Name"); 113 | ui->comboBoxCopyFormat->addItem("FileType/Type/Name/EP bytes"); 114 | ui->comboBoxCopyFormat->addItem("Arch/FileType/Type/Name/EP bytes"); 115 | ui->comboBoxCopyFormat->addItem("FileType/Arch/Type/Name/EP bytes"); 116 | ui->comboBoxCopyFormat->addItem("FileType/Type/Name/EP signature"); 117 | ui->comboBoxCopyFormat->addItem("Arch/FileType/Type/Name/EP signature"); 118 | ui->comboBoxCopyFormat->addItem("FileType/Arch/Type/Name/EP signature"); 119 | ui->comboBoxCopyFormat->addItem("FileType/Type/Name/EP signature(rel)"); 120 | ui->comboBoxCopyFormat->addItem("Arch/FileType/Type/Name/EP signature(rel)"); 121 | ui->comboBoxCopyFormat->addItem("FileType/Arch/Type/Name/EP signature(rel)"); 122 | ui->comboBoxCopyFormat->addItem("FileType/Arch/Type/Name/Import"); 123 | 124 | ui->comboBoxCopyType->addItem("Identified"); 125 | ui->comboBoxCopyType->addItem("Identified/Unknown"); 126 | ui->comboBoxCopyType->addItem("Unknown"); 127 | 128 | ui->comboBoxFileNameFormat->addItem("Original"); 129 | ui->comboBoxFileNameFormat->addItem("MD5"); 130 | ui->comboBoxFileNameFormat->addItem("MD5+Original"); 131 | ui->comboBoxFileNameFormat->addItem("Entropy"); 132 | ui->comboBoxFileNameFormat->addItem("Entropy+Original"); 133 | ui->comboBoxFileNameFormat->addItem("EntropyPercentage"); 134 | ui->comboBoxFileNameFormat->addItem("EntropyPercentage+Original"); 135 | 136 | ui->comboBoxUnknownPrefix->addItem("NONE"); 137 | ui->comboBoxUnknownPrefix->addItem("EP Bytes"); 138 | ui->comboBoxUnknownPrefix->addItem("Header Bytes"); 139 | ui->comboBoxUnknownPrefix->addItem("Overlay Bytes"); 140 | ui->comboBoxUnknownPrefix->addItem("Opcodes"); 141 | ui->comboBoxUnknownPrefix->addItem("Rel Opcodes"); 142 | 143 | ui->comboBoxOverlay->addItem(""); 144 | ui->comboBoxOverlay->addItem("Present"); 145 | ui->comboBoxOverlay->addItem("Not present"); 146 | 147 | ui->comboBoxEntropy->addItem(""); 148 | ui->comboBoxEntropy->addItem("More than"); 149 | ui->comboBoxEntropy->addItem("Less than"); 150 | 151 | loadSettings(); 152 | } 153 | 154 | GuiMainWindow::~GuiMainWindow() 155 | { 156 | delete ui; 157 | } 158 | 159 | void GuiMainWindow::on_pushButtonExit_clicked() 160 | { 161 | this->close(); 162 | } 163 | 164 | void GuiMainWindow::on_pushButtonOpenDirectory_clicked() 165 | { 166 | QString sInitDirectory = ui->lineEditDirectoryName->text(); 167 | 168 | QString sDirectoryName = QFileDialog::getExistingDirectory(this, tr("Open directory..."), sInitDirectory, QFileDialog::ShowDirsOnly); 169 | 170 | if (!sDirectoryName.isEmpty()) { 171 | ui->lineEditDirectoryName->setText(sDirectoryName); 172 | } 173 | } 174 | 175 | void GuiMainWindow::on_pushButtonOut_clicked() 176 | { 177 | QString sInitDirectory = ui->lineEditOut->text(); 178 | 179 | QString sDirectoryName = QFileDialog::getExistingDirectory(this, tr("Open directory..."), sInitDirectory, QFileDialog::ShowDirsOnly); 180 | 181 | if (!sDirectoryName.isEmpty()) { 182 | ui->lineEditOut->setText(sDirectoryName); 183 | } 184 | } 185 | 186 | void GuiMainWindow::on_pushButtonScan_clicked() 187 | { 188 | saveSettings(); 189 | _scan(); 190 | } 191 | 192 | void GuiMainWindow::_scan() 193 | { 194 | options.nCopyCount = ui->spinBoxCopyCount->value(); 195 | options.sCopyDirectory = ui->lineEditOut->text(); 196 | options.sLogDirectory = ui->lineEditLog->text(); 197 | 198 | options.stFileTypes.clear(); 199 | 200 | options.bAllFileTypes = ui->checkBoxAllFileTypes->isChecked(); 201 | 202 | if (ui->checkBoxBinary->isChecked()) options.stFileTypes.insert(XBinary::FT_BINARY); 203 | if (ui->checkBoxCOM->isChecked()) options.stFileTypes.insert(XBinary::FT_COM); 204 | if (ui->checkBoxMSDOS->isChecked()) options.stFileTypes.insert(XBinary::FT_MSDOS); 205 | if (ui->checkBoxDOS16M->isChecked()) options.stFileTypes.insert(XBinary::FT_DOS16M); 206 | if (ui->checkBoxDOS4G->isChecked()) options.stFileTypes.insert(XBinary::FT_DOS4G); 207 | if (ui->checkBoxNE->isChecked()) options.stFileTypes.insert(XBinary::FT_NE); 208 | if (ui->checkBoxLE->isChecked()) options.stFileTypes.insert(XBinary::FT_LE); 209 | if (ui->checkBoxLX->isChecked()) options.stFileTypes.insert(XBinary::FT_LX); 210 | if (ui->checkBoxPE32->isChecked()) options.stFileTypes.insert(XBinary::FT_PE32); 211 | if (ui->checkBoxPE64->isChecked()) options.stFileTypes.insert(XBinary::FT_PE64); 212 | if (ui->checkBoxELF32->isChecked()) options.stFileTypes.insert(XBinary::FT_ELF32); 213 | if (ui->checkBoxELF64->isChecked()) options.stFileTypes.insert(XBinary::FT_ELF64); 214 | if (ui->checkBoxMACHO32->isChecked()) options.stFileTypes.insert(XBinary::FT_MACHO32); 215 | if (ui->checkBoxMACHO64->isChecked()) options.stFileTypes.insert(XBinary::FT_MACHO64); 216 | if (ui->checkBoxZIP->isChecked()) options.stFileTypes.insert(XBinary::FT_ZIP); 217 | if (ui->checkBoxJAR->isChecked()) options.stFileTypes.insert(XBinary::FT_JAR); 218 | if (ui->checkBoxAPK->isChecked()) options.stFileTypes.insert(XBinary::FT_APK); 219 | if (ui->checkBoxMACHOFAT->isChecked()) options.stFileTypes.insert(XBinary::FT_MACHOFAT); 220 | if (ui->checkBoxNPM->isChecked()) options.stFileTypes.insert(XBinary::FT_NPM); 221 | if (ui->checkBoxPDF->isChecked()) options.stFileTypes.insert(XBinary::FT_PDF); 222 | if (ui->checkBoxDEX->isChecked()) options.stFileTypes.insert(XBinary::FT_DEX); 223 | if (ui->checkBoxRAR->isChecked()) options.stFileTypes.insert(XBinary::FT_RAR); 224 | if (ui->checkBoxAmiga->isChecked()) options.stFileTypes.insert(XBinary::FT_AMIGAHUNK); 225 | if (ui->checkBoxJavaClass->isChecked()) options.stFileTypes.insert(XBinary::FT_JAVACLASS); 226 | if (ui->checkBoxIPA->isChecked()) options.stFileTypes.insert(XBinary::FT_IPA); 227 | if (ui->checkBoxCFBF->isChecked()) options.stFileTypes.insert(XBinary::FT_CFBF); 228 | if (ui->checkBoxJpeg->isChecked()) options.stFileTypes.insert(XBinary::FT_JPEG); 229 | if (ui->checkBoxPNG->isChecked()) options.stFileTypes.insert(XBinary::FT_PNG); 230 | if (ui->checkBoxAtariST->isChecked()) options.stFileTypes.insert(XBinary::FT_ATARIST); 231 | 232 | options.stTypes.clear(); 233 | 234 | options.bAllTypes = ui->checkBoxAllTypes->isChecked(); 235 | 236 | if (ui->checkBox_archive->isChecked()) _appendType("archive"); 237 | if (ui->checkBox_audio->isChecked()) _appendType("audio"); 238 | if (ui->checkBox_boot->isChecked()) _appendType("boot"); 239 | if (ui->checkBox_compiler->isChecked()) _appendType("compiler"); 240 | if (ui->checkBox_converter->isChecked()) _appendType("converter"); 241 | if (ui->checkBox_driver->isChecked()) _appendType("driver"); 242 | if (ui->checkBox_emulator->isChecked()) _appendType("emulator"); 243 | if (ui->checkBox_extender->isChecked()) _appendType("extender"); 244 | if (ui->checkBox_format->isChecked()) _appendType("format"); 245 | if (ui->checkBox_framework->isChecked()) _appendType("framework"); 246 | if (ui->checkBox_image->isChecked()) _appendType("image"); 247 | if (ui->checkBox_immunizer->isChecked()) _appendType("immunizer"); 248 | if (ui->checkBox_installer->isChecked()) _appendType("installer"); 249 | if (ui->checkBox_joiner->isChecked()) _appendType("joiner"); 250 | if (ui->checkBox_keygen->isChecked()) _appendType("keygen"); 251 | if (ui->checkBox_library->isChecked()) _appendType("library"); 252 | if (ui->checkBox_linker->isChecked()) _appendType("linker"); 253 | if (ui->checkBox_loader->isChecked()) _appendType("loader"); 254 | if (ui->checkBox_other->isChecked()) _appendType("other"); 255 | if (ui->checkBox_overlay->isChecked()) _appendType("overlay"); 256 | if (ui->checkBox_packer->isChecked()) _appendType("packer"); 257 | if (ui->checkBox_patcher->isChecked()) _appendType("patcher"); 258 | if (ui->checkBox_player->isChecked()) _appendType("player"); 259 | if (ui->checkBox_protection->isChecked()) _appendType("protection"); 260 | if (ui->checkBox_protector->isChecked()) _appendType("protector"); 261 | if (ui->checkBox_script->isChecked()) _appendType("script"); 262 | if (ui->checkBox_self_displayer->isChecked()) _appendType("self-displayer"); 263 | if (ui->checkBox_sfx->isChecked()) _appendType("sfx"); 264 | if (ui->checkBox_source->isChecked()) _appendType("source"); 265 | if (ui->checkBox_system->isChecked()) _appendType("system"); 266 | if (ui->checkBox_type->isChecked()) _appendType("type"); 267 | if (ui->checkBox_operation_system->isChecked()) _appendType("operation system"); 268 | if (ui->checkBox_cryptor->isChecked()) _appendType("cryptor"); 269 | if (ui->checkBox_crypter->isChecked()) _appendType("crypter"); 270 | if (ui->checkBox_licensing->isChecked()) _appendType("licensing"); 271 | if (ui->checkBox_language->isChecked()) _appendType("language"); 272 | if (ui->checkBox_tool->isChecked()) _appendType("tool"); 273 | if (ui->checkBox_dos_extender->isChecked()) _appendType("dos extender"); 274 | if (ui->checkBox_sign_tool->isChecked()) _appendType("sign tool"); 275 | if (ui->checkBox_virtual_machine->isChecked()) _appendType("virtual machine"); 276 | if (ui->checkBox_malware->isChecked()) _appendType("malware"); 277 | if (ui->checkBox_virus->isChecked()) _appendType("virus"); 278 | 279 | options.bIsCopyEnable = ui->groupBoxCopy->isChecked(); 280 | options.bIsLogEnable = ui->groupBoxLog->isChecked(); 281 | options.bIsRecursive = ui->checkBoxRecursive->isChecked(); 282 | options.bIsDeepScan = ui->checkBoxDeepScan->isChecked(); 283 | options.bIsVerbose = ui->checkBoxVerbose->isChecked(); 284 | options.bIsHeuristicScan = ui->checkBoxHeuristicScan->isChecked(); 285 | options.bIsAggressive = ui->checkBoxAggressive->isChecked(); 286 | options.bShowVersion = ui->checkBoxShowVersion->isChecked(); 287 | options.bShowInfo = ui->checkBoxShowInfo->isChecked(); 288 | options.bIsSort = ui->checkBoxSort->isChecked(); 289 | options.bSubdirectories = ui->checkBoxScanSubdirectories->isChecked(); 290 | options.sSignatures = ui->lineEditSignatures->text(); 291 | options.sSignaturesExtra = ui->lineEditSignaturesExtra->text(); 292 | options.sSignaturesCustom = ui->lineEditSignaturesCustom->text(); 293 | options.bSignaturesExtraUse = ui->groupBoxSignaturesExtra->isChecked(); 294 | options.bSignaturesCustomUse = ui->groupBoxSignaturesCustom->isChecked(); 295 | 296 | options.copyFormat = (ScanProgress::CF)ui->comboBoxCopyFormat->currentIndex(); 297 | options.copyType = (ScanProgress::CT)ui->comboBoxCopyType->currentIndex(); 298 | options.bRemoveCopied = ui->checkBoxRemoveCopied->isChecked(); 299 | options.bCopyTheFirstOnly = ui->checkBoxCopyTheFirstOnly->isChecked(); 300 | options.bValidOnly = ui->checkBoxValidOnly->isChecked(); 301 | 302 | options.unknownPrefix = (ScanProgress::UP)ui->comboBoxUnknownPrefix->currentIndex(); 303 | options.nUnknownCount = ui->spinBoxUnknownCount->value(); 304 | 305 | options.fileFormat = (ScanProgress::FF)ui->comboBoxFileNameFormat->currentIndex(); 306 | options.overlay = (ScanProgress::OVERLAY)ui->comboBoxOverlay->currentIndex(); 307 | options.entropy = (ScanProgress::ENTROPY)ui->comboBoxEntropy->currentIndex(); 308 | options.dEntropyValue = ui->doubleSpinBoxEntropy->value(); 309 | // options.nThreads = ui->spinBoxThreads->value(); 310 | 311 | DialogScanProgress ds(this); 312 | 313 | ds.setData(ui->lineEditDirectoryName->text(), &options); 314 | 315 | ds.exec(); 316 | 317 | // DialogStaticScan ds(this); 318 | // connect(&ds, SIGNAL(scanFileStarted(QString)),this,SLOT(scanFileStarted(QString)),Qt::DirectConnection); 319 | // connect(&ds, SIGNAL(scanResult(SpecAbstract::SCAN_RESULT)),this,SLOT(scanResult(SpecAbstract::SCAN_RESULT)),Qt::DirectConnection); 320 | // ds.setData(ui->lineEditDirectoryName->text(),&options); 321 | // ds.exec(); 322 | } 323 | 324 | void GuiMainWindow::_appendType(QString sType) 325 | { 326 | options.stTypes.insert(sType); 327 | options.stTypes.insert("(heur)" + sType); 328 | } 329 | 330 | void GuiMainWindow::on_checkBoxAllFileTypes_toggled(bool checked) 331 | { 332 | ui->checkBoxBinary->setChecked(checked); 333 | ui->checkBoxCOM->setChecked(checked); 334 | ui->checkBoxMSDOS->setChecked(checked); 335 | ui->checkBoxDOS16M->setChecked(checked); 336 | ui->checkBoxDOS4G->setChecked(checked); 337 | ui->checkBoxNE->setChecked(checked); 338 | ui->checkBoxLE->setChecked(checked); 339 | ui->checkBoxLX->setChecked(checked); 340 | ui->checkBoxPE32->setChecked(checked); 341 | ui->checkBoxPE64->setChecked(checked); 342 | ui->checkBoxELF32->setChecked(checked); 343 | ui->checkBoxELF64->setChecked(checked); 344 | ui->checkBoxMACHO32->setChecked(checked); 345 | ui->checkBoxMACHO64->setChecked(checked); 346 | ui->checkBoxZIP->setChecked(checked); 347 | ui->checkBoxJAR->setChecked(checked); 348 | ui->checkBoxAPK->setChecked(checked); 349 | ui->checkBoxMACHOFAT->setChecked(checked); 350 | ui->checkBoxNPM->setChecked(checked); 351 | ui->checkBoxPDF->setChecked(checked); 352 | ui->checkBoxDEX->setChecked(checked); 353 | ui->checkBoxRAR->setChecked(checked); 354 | ui->checkBoxAmiga->setChecked(checked); 355 | ui->checkBoxJavaClass->setChecked(checked); 356 | ui->checkBoxIPA->setChecked(checked); 357 | ui->checkBoxCFBF->setChecked(checked); 358 | ui->checkBoxJpeg->setChecked(checked); 359 | ui->checkBoxPNG->setChecked(checked); 360 | ui->checkBoxAtariST->setChecked(checked); 361 | } 362 | 363 | // void GuiMainWindow::on_checkBoxBinary_toggled(bool checked) 364 | //{ 365 | // QSignalBlocker blocker(ui->checkBoxAllFileTypes); 366 | 367 | // if(!checked) 368 | // { 369 | // ui->checkBoxAllFileTypes->setChecked(false); 370 | // } 371 | //} 372 | 373 | void GuiMainWindow::on_checkBoxAllTypes_toggled(bool checked) 374 | { 375 | ui->checkBox_archive->setChecked(checked); 376 | ui->checkBox_audio->setChecked(checked); 377 | ui->checkBox_boot->setChecked(checked); 378 | ui->checkBox_compiler->setChecked(checked); 379 | ui->checkBox_converter->setChecked(checked); 380 | ui->checkBox_driver->setChecked(checked); 381 | ui->checkBox_emulator->setChecked(checked); 382 | ui->checkBox_extender->setChecked(checked); 383 | ui->checkBox_format->setChecked(checked); 384 | ui->checkBox_framework->setChecked(checked); 385 | ui->checkBox_image->setChecked(checked); 386 | ui->checkBox_immunizer->setChecked(checked); 387 | ui->checkBox_installer->setChecked(checked); 388 | ui->checkBox_joiner->setChecked(checked); 389 | ui->checkBox_keygen->setChecked(checked); 390 | ui->checkBox_library->setChecked(checked); 391 | ui->checkBox_linker->setChecked(checked); 392 | ui->checkBox_loader->setChecked(checked); 393 | ui->checkBox_other->setChecked(checked); 394 | ui->checkBox_overlay->setChecked(checked); 395 | ui->checkBox_packer->setChecked(checked); 396 | ui->checkBox_patcher->setChecked(checked); 397 | ui->checkBox_player->setChecked(checked); 398 | ui->checkBox_protection->setChecked(checked); 399 | ui->checkBox_protector->setChecked(checked); 400 | ui->checkBox_script->setChecked(checked); 401 | ui->checkBox_self_displayer->setChecked(checked); 402 | ui->checkBox_sfx->setChecked(checked); 403 | ui->checkBox_source->setChecked(checked); 404 | ui->checkBox_system->setChecked(checked); 405 | ui->checkBox_type->setChecked(checked); 406 | ui->checkBox_operation_system->setChecked(checked); 407 | ui->checkBox_crypter->setChecked(checked); 408 | ui->checkBox_cryptor->setChecked(checked); 409 | ui->checkBox_licensing->setChecked(checked); 410 | ui->checkBox_language->setChecked(checked); 411 | ui->checkBox_tool->setChecked(checked); 412 | ui->checkBox_dos_extender->setChecked(checked); 413 | ui->checkBox_sign_tool->setChecked(checked); 414 | ui->checkBox_virtual_machine->setChecked(checked); 415 | ui->checkBox_malware->setChecked(checked); 416 | ui->checkBox_virus->setChecked(checked); 417 | } 418 | 419 | void GuiMainWindow::on_pushButtonInfo_clicked() 420 | { 421 | QMessageBox::information(this, tr("Info"), tr("Bugreports: horsicq@gmail.com")); 422 | } 423 | 424 | void GuiMainWindow::onFileTypeToggled(bool checked) 425 | { 426 | QSignalBlocker blocker(ui->checkBoxAllFileTypes); 427 | 428 | if (!checked) { 429 | ui->checkBoxAllFileTypes->setChecked(false); 430 | } 431 | } 432 | 433 | void GuiMainWindow::onTypeToggled(bool checked) 434 | { 435 | QSignalBlocker blocker(ui->checkBoxAllTypes); 436 | 437 | if (!checked) { 438 | ui->checkBoxAllTypes->setChecked(false); 439 | } 440 | } 441 | 442 | void GuiMainWindow::on_pushButtonSignatures_clicked() 443 | { 444 | QString sInitDirectory = XBinary::convertPathName(ui->lineEditSignatures->text()); 445 | 446 | QString sDirectoryName = QFileDialog::getExistingDirectory(this, tr("Open directory..."), sInitDirectory, QFileDialog::ShowDirsOnly); 447 | 448 | if (!sDirectoryName.isEmpty()) { 449 | ui->lineEditSignatures->setText(sDirectoryName); 450 | } 451 | } 452 | 453 | void GuiMainWindow::on_doubleSpinBoxEntropy_valueChanged(double arg1) 454 | { 455 | Q_UNUSED(arg1) 456 | 457 | double dEntropy = ui->doubleSpinBoxEntropy->value(); 458 | double dPercentage = (dEntropy / 8) * 100; 459 | ui->lineEditEntropy->setText(QString::number(dPercentage, 'f', 2)); 460 | } 461 | 462 | void GuiMainWindow::on_pushButtonSignaturesCustom_clicked() 463 | { 464 | QString sInitDirectory = XBinary::convertPathName(ui->lineEditSignaturesCustom->text()); 465 | 466 | QString sDirectoryName = QFileDialog::getExistingDirectory(this, tr("Open directory..."), sInitDirectory, QFileDialog::ShowDirsOnly); 467 | 468 | if (!sDirectoryName.isEmpty()) { 469 | ui->lineEditSignaturesCustom->setText(sDirectoryName); 470 | } 471 | } 472 | 473 | void GuiMainWindow::on_pushButtonSignaturesExtra_clicked() 474 | { 475 | QString sInitDirectory = XBinary::convertPathName(ui->lineEditSignaturesExtra->text()); 476 | 477 | QString sDirectoryName = QFileDialog::getExistingDirectory(this, tr("Open directory..."), sInitDirectory, QFileDialog::ShowDirsOnly); 478 | 479 | if (!sDirectoryName.isEmpty()) { 480 | ui->lineEditSignaturesExtra->setText(sDirectoryName); 481 | } 482 | } 483 | 484 | void GuiMainWindow::loadSettings() 485 | { 486 | QString sSettingsFile = QApplication::applicationDirPath() + QDir::separator(); 487 | #ifdef Q_OS_LINUX 488 | sSettingsFile += QString("Linux."); 489 | #endif 490 | sSettingsFile += QString("%1.ini").arg(X_APPLICATIONNAME); 491 | 492 | QSettings settings(sSettingsFile, QSettings::IniFormat); 493 | 494 | ui->comboBoxCopyFormat->setCurrentIndex(settings.value("CopyFormat", 0).toInt()); 495 | ui->comboBoxCopyType->setCurrentIndex(settings.value("CopyType", 0).toInt()); 496 | ui->comboBoxFileNameFormat->setCurrentIndex(settings.value("FileFormat", 0).toInt()); 497 | ui->comboBoxUnknownPrefix->setCurrentIndex(settings.value("UnknownPrefix", 0).toInt()); 498 | ui->comboBoxOverlay->setCurrentIndex(settings.value("Overlay", 0).toInt()); 499 | ui->comboBoxEntropy->setCurrentIndex(settings.value("Entropy", 0).toInt()); 500 | 501 | ui->spinBoxUnknownCount->setValue(settings.value("UnknownCount", 10).toInt()); 502 | ui->doubleSpinBoxEntropy->setValue(settings.value("EntropyValue", 6.5).toDouble()); 503 | 504 | ui->lineEditDirectoryName->setText(settings.value("DirectoryName", QDir::currentPath()).toString()); 505 | ui->lineEditSignatures->setText(settings.value("Signatures", "$app/db").toString()); 506 | ui->lineEditSignaturesExtra->setText(settings.value("SignaturesExtra", "$app/db_extra").toString()); 507 | ui->lineEditSignaturesCustom->setText(settings.value("SignaturesCustom", "$app/db_custom").toString()); 508 | ui->groupBoxSignaturesExtra->setChecked(settings.value("SignaturesExtraEnable", true).toBool()); 509 | ui->groupBoxSignaturesCustom->setChecked(settings.value("SignaturesCustomEnable", true).toBool()); 510 | ui->lineEditOut->setText(settings.value("ResultName", QDir::currentPath() + QDir::separator() + "out").toString()); 511 | ui->lineEditLog->setText(settings.value("LogName", QDir::currentPath() + QDir::separator() + "log").toString()); 512 | 513 | ui->spinBoxCopyCount->setValue(settings.value("CopyCount", 0).toInt()); 514 | 515 | ui->checkBoxRemoveCopied->setChecked(settings.value("RemoveCopied", false).toBool()); 516 | ui->checkBoxCopyTheFirstOnly->setChecked(settings.value("CopyTheFirstOnly", false).toBool()); 517 | 518 | ui->checkBoxAllFileTypes->setChecked(settings.value("AllFileTypes", true).toBool()); 519 | ui->checkBoxBinary->setChecked(settings.value("FT_Binary", true).toBool()); 520 | ui->checkBoxCOM->setChecked(settings.value("FT_COM", true).toBool()); 521 | ui->checkBoxMSDOS->setChecked(settings.value("FT_MSDOS", true).toBool()); 522 | ui->checkBoxDOS16M->setChecked(settings.value("FT_DOS16M", true).toBool()); 523 | ui->checkBoxDOS4G->setChecked(settings.value("FT_DOS4G", true).toBool()); 524 | ui->checkBoxNE->setChecked(settings.value("FT_NE", true).toBool()); 525 | ui->checkBoxLE->setChecked(settings.value("FT_LE", true).toBool()); 526 | ui->checkBoxLX->setChecked(settings.value("FT_LX", true).toBool()); 527 | ui->checkBoxPE32->setChecked(settings.value("FT_PE32", true).toBool()); 528 | ui->checkBoxPE64->setChecked(settings.value("FT_PE64", true).toBool()); 529 | ui->checkBoxELF32->setChecked(settings.value("FT_ELF32", true).toBool()); 530 | ui->checkBoxELF64->setChecked(settings.value("FT_ELF64", true).toBool()); 531 | ui->checkBoxMACHO32->setChecked(settings.value("FT_MACHO32", true).toBool()); 532 | ui->checkBoxMACHO64->setChecked(settings.value("FT_MACHO64", true).toBool()); 533 | ui->checkBoxZIP->setChecked(settings.value("FT_ZIP", true).toBool()); 534 | ui->checkBoxJAR->setChecked(settings.value("FT_JAR", true).toBool()); 535 | ui->checkBoxAPK->setChecked(settings.value("FT_APK", true).toBool()); 536 | ui->checkBoxMACHOFAT->setChecked(settings.value("FT_MACHOFAT", true).toBool()); 537 | ui->checkBoxNPM->setChecked(settings.value("FT_NPM", true).toBool()); 538 | ui->checkBoxPDF->setChecked(settings.value("FT_PDF", true).toBool()); 539 | ui->checkBoxDEX->setChecked(settings.value("FT_DEX", true).toBool()); 540 | ui->checkBoxRAR->setChecked(settings.value("FT_RAR", true).toBool()); 541 | ui->checkBoxAmiga->setChecked(settings.value("FT_AMIGAHUNK", true).toBool()); 542 | ui->checkBoxJavaClass->setChecked(settings.value("FT_JAVACLASS", true).toBool()); 543 | ui->checkBoxIPA->setChecked(settings.value("FT_IPA", true).toBool()); 544 | ui->checkBoxCFBF->setChecked(settings.value("FT_CFBF", true).toBool()); 545 | ui->checkBoxJpeg->setChecked(settings.value("FT_JPEG", true).toBool()); 546 | ui->checkBoxPNG->setChecked(settings.value("FT_PNG", true).toBool()); 547 | ui->checkBoxAtariST->setChecked(settings.value("FT_ATARIST", true).toBool()); 548 | 549 | ui->checkBoxAllTypes->setChecked(settings.value("AllTypes", true).toBool()); 550 | ui->checkBox_archive->setChecked(settings.value("type_archive", true).toBool()); 551 | ui->checkBox_audio->setChecked(settings.value("type_audio", true).toBool()); 552 | ui->checkBox_boot->setChecked(settings.value("type_boot", true).toBool()); 553 | ui->checkBox_compiler->setChecked(settings.value("type_compiler", true).toBool()); 554 | ui->checkBox_converter->setChecked(settings.value("type_converter", true).toBool()); 555 | ui->checkBox_driver->setChecked(settings.value("type_driver", true).toBool()); 556 | ui->checkBox_emulator->setChecked(settings.value("type_emulator", true).toBool()); 557 | ui->checkBox_extender->setChecked(settings.value("type_extender", true).toBool()); 558 | ui->checkBox_format->setChecked(settings.value("type_format", true).toBool()); 559 | ui->checkBox_framework->setChecked(settings.value("type_framework", true).toBool()); 560 | ui->checkBox_image->setChecked(settings.value("type_image", true).toBool()); 561 | ui->checkBox_immunizer->setChecked(settings.value("type_immunizer", true).toBool()); 562 | ui->checkBox_installer->setChecked(settings.value("type_installer", true).toBool()); 563 | ui->checkBox_joiner->setChecked(settings.value("type_joiner", true).toBool()); 564 | ui->checkBox_keygen->setChecked(settings.value("type_keygen", true).toBool()); 565 | ui->checkBox_library->setChecked(settings.value("type_library", true).toBool()); 566 | ui->checkBox_linker->setChecked(settings.value("type_linker", true).toBool()); 567 | ui->checkBox_loader->setChecked(settings.value("type_loader", true).toBool()); 568 | ui->checkBox_other->setChecked(settings.value("type_other", true).toBool()); 569 | ui->checkBox_overlay->setChecked(settings.value("type_overlay", true).toBool()); 570 | ui->checkBox_packer->setChecked(settings.value("type_packer", true).toBool()); 571 | ui->checkBox_patcher->setChecked(settings.value("type_patcher", true).toBool()); 572 | ui->checkBox_player->setChecked(settings.value("type_player", true).toBool()); 573 | ui->checkBox_protection->setChecked(settings.value("type_protection", true).toBool()); 574 | ui->checkBox_protector->setChecked(settings.value("type_protector", true).toBool()); 575 | ui->checkBox_script->setChecked(settings.value("type_script", true).toBool()); 576 | ui->checkBox_self_displayer->setChecked(settings.value("type_self_displayer", true).toBool()); 577 | ui->checkBox_sfx->setChecked(settings.value("type_sfx", true).toBool()); 578 | ui->checkBox_source->setChecked(settings.value("type_source", true).toBool()); 579 | ui->checkBox_system->setChecked(settings.value("type_system", true).toBool()); 580 | ui->checkBox_type->setChecked(settings.value("type_type", true).toBool()); 581 | ui->checkBox_operation_system->setChecked(settings.value("type_operation_system", true).toBool()); 582 | ui->checkBox_cryptor->setChecked(settings.value("type_cryptor", true).toBool()); 583 | ui->checkBox_crypter->setChecked(settings.value("type_crypter", true).toBool()); 584 | ui->checkBox_licensing->setChecked(settings.value("type_licensing", true).toBool()); 585 | ui->checkBox_language->setChecked(settings.value("type_language", true).toBool()); 586 | ui->checkBox_tool->setChecked(settings.value("type_tool", true).toBool()); 587 | ui->checkBox_dos_extender->setChecked(settings.value("type_dos_extender", true).toBool()); 588 | ui->checkBox_sign_tool->setChecked(settings.value("type_sign_tool", true).toBool()); 589 | ui->checkBox_virtual_machine->setChecked(settings.value("type_virtual_machine", true).toBool()); 590 | ui->checkBox_malware->setChecked(settings.value("type_malware", true).toBool()); 591 | ui->checkBox_virus->setChecked(settings.value("type_virus", true).toBool()); 592 | 593 | ui->checkBoxRecursive->setChecked(settings.value("Recursive", true).toBool()); 594 | ui->checkBoxDeepScan->setChecked(settings.value("DeepScan", true).toBool()); 595 | ui->checkBoxVerbose->setChecked(settings.value("Verbose", true).toBool()); 596 | ui->checkBoxHeuristicScan->setChecked(settings.value("HeuristicScan", true).toBool()); 597 | ui->checkBoxAggressive->setChecked(settings.value("Aggressive", true).toBool()); 598 | ui->checkBoxShowVersion->setChecked(settings.value("ShowVersion", true).toBool()); 599 | ui->checkBoxShowInfo->setChecked(settings.value("ShowInfo", true).toBool()); 600 | ui->checkBoxSort->setChecked(settings.value("Sort", true).toBool()); 601 | ui->checkBoxScanSubdirectories->setChecked(settings.value("ScanSubdirectories", true).toBool()); 602 | ui->checkBoxValidOnly->setChecked(settings.value("ValidOnly", true).toBool()); 603 | 604 | // ui->spinBoxThreads->setValue(settings.value("Threads", 1).toInt()); 605 | 606 | options.bDebug = settings.value("Debug", false).toBool(); 607 | 608 | #ifdef QT_DEBUG 609 | options.bDebug = true; 610 | #endif 611 | } 612 | 613 | void GuiMainWindow::saveSettings() 614 | { 615 | QString sSettingsFile = QApplication::applicationDirPath() + QDir::separator(); 616 | #ifdef Q_OS_LINUX 617 | sSettingsFile += QString("Linux."); 618 | #endif 619 | sSettingsFile += QString("%1.ini").arg(X_APPLICATIONNAME); 620 | QSettings settings(sSettingsFile, QSettings::IniFormat); 621 | 622 | settings.setValue("DirectoryName", ui->lineEditDirectoryName->text()); 623 | settings.setValue("ResultName", ui->lineEditOut->text()); 624 | settings.setValue("LogName", ui->lineEditLog->text()); 625 | settings.setValue("Signatures", ui->lineEditSignatures->text()); 626 | settings.setValue("SignaturesExtra", ui->lineEditSignaturesExtra->text()); 627 | settings.setValue("SignaturesCustom", ui->lineEditSignaturesCustom->text()); 628 | settings.setValue("SignaturesExtraEnable", ui->groupBoxSignaturesExtra->isChecked()); 629 | settings.setValue("SignaturesCustomEnable", ui->groupBoxSignaturesCustom->isChecked()); 630 | settings.setValue("CopyCount", ui->spinBoxCopyCount->value()); 631 | settings.setValue("CopyFormat", ui->comboBoxCopyFormat->currentIndex()); 632 | settings.setValue("CopyType", ui->comboBoxCopyType->currentIndex()); 633 | settings.setValue("FileFormat", ui->comboBoxFileNameFormat->currentIndex()); 634 | settings.setValue("RemoveCopied", ui->checkBoxRemoveCopied->isChecked()); 635 | settings.setValue("CopyTheFirstOnly", ui->checkBoxCopyTheFirstOnly->isChecked()); 636 | settings.setValue("Copy", ui->groupBoxCopy->isChecked()); 637 | settings.setValue("Log", ui->groupBoxLog->isChecked()); 638 | 639 | settings.setValue("AllFileTypes", ui->checkBoxAllFileTypes->isChecked()); 640 | settings.setValue("FT_Binary", ui->checkBoxBinary->isChecked()); 641 | settings.setValue("FT_COM", ui->checkBoxCOM->isChecked()); 642 | settings.setValue("FT_MSDOS", ui->checkBoxMSDOS->isChecked()); 643 | settings.setValue("FT_DOS16M", ui->checkBoxDOS16M->isChecked()); 644 | settings.setValue("FT_DOS4G", ui->checkBoxDOS4G->isChecked()); 645 | settings.setValue("FT_NE", ui->checkBoxNE->isChecked()); 646 | settings.setValue("FT_LE", ui->checkBoxLE->isChecked()); 647 | settings.setValue("FT_LX", ui->checkBoxLX->isChecked()); 648 | settings.setValue("FT_PE32", ui->checkBoxPE32->isChecked()); 649 | settings.setValue("FT_PE64", ui->checkBoxPE64->isChecked()); 650 | settings.setValue("FT_ELF32", ui->checkBoxELF32->isChecked()); 651 | settings.setValue("FT_ELF64", ui->checkBoxELF64->isChecked()); 652 | settings.setValue("FT_MACHO32", ui->checkBoxMACHO32->isChecked()); 653 | settings.setValue("FT_MACHO64", ui->checkBoxMACHO64->isChecked()); 654 | settings.setValue("FT_ZIP", ui->checkBoxZIP->isChecked()); 655 | settings.setValue("FT_JAR", ui->checkBoxJAR->isChecked()); 656 | settings.setValue("FT_APK", ui->checkBoxAPK->isChecked()); 657 | settings.setValue("FT_MACHOFAT", ui->checkBoxMACHOFAT->isChecked()); 658 | settings.setValue("FT_NPM", ui->checkBoxNPM->isChecked()); 659 | settings.setValue("FT_PDF", ui->checkBoxPDF->isChecked()); 660 | settings.setValue("FT_DEX", ui->checkBoxDEX->isChecked()); 661 | settings.setValue("FT_RAR", ui->checkBoxRAR->isChecked()); 662 | settings.setValue("FT_AMIGAHUNK", ui->checkBoxAmiga->isChecked()); 663 | settings.setValue("FT_JAVACLASS", ui->checkBoxJavaClass->isChecked()); 664 | settings.setValue("FT_IPA", ui->checkBoxIPA->isChecked()); 665 | settings.setValue("FT_CFBF", ui->checkBoxCFBF->isChecked()); 666 | settings.setValue("FT_JPEG", ui->checkBoxJpeg->isChecked()); 667 | settings.setValue("FT_PNG", ui->checkBoxPNG->isChecked()); 668 | settings.setValue("FT_ATARIST", ui->checkBoxAtariST->isChecked()); 669 | 670 | settings.setValue("AllTypes", ui->checkBoxAllTypes->isChecked()); 671 | settings.setValue("type_archive", ui->checkBox_archive->isChecked()); 672 | settings.setValue("type_audio", ui->checkBox_audio->isChecked()); 673 | settings.setValue("type_boot", ui->checkBox_boot->isChecked()); 674 | settings.setValue("type_compiler", ui->checkBox_compiler->isChecked()); 675 | settings.setValue("type_converter", ui->checkBox_converter->isChecked()); 676 | settings.setValue("type_driver", ui->checkBox_driver->isChecked()); 677 | settings.setValue("type_emulator", ui->checkBox_emulator->isChecked()); 678 | settings.setValue("type_extender", ui->checkBox_extender->isChecked()); 679 | settings.setValue("type_format", ui->checkBox_format->isChecked()); 680 | settings.setValue("type_framework", ui->checkBox_framework->isChecked()); 681 | settings.setValue("type_image", ui->checkBox_image->isChecked()); 682 | settings.setValue("type_immunizer", ui->checkBox_immunizer->isChecked()); 683 | settings.setValue("type_installer", ui->checkBox_installer->isChecked()); 684 | settings.setValue("type_joiner", ui->checkBox_joiner->isChecked()); 685 | settings.setValue("type_keygen", ui->checkBox_keygen->isChecked()); 686 | settings.setValue("type_library", ui->checkBox_library->isChecked()); 687 | settings.setValue("type_linker", ui->checkBox_linker->isChecked()); 688 | settings.setValue("type_loader", ui->checkBox_loader->isChecked()); 689 | settings.setValue("type_other", ui->checkBox_other->isChecked()); 690 | settings.setValue("type_overlay", ui->checkBox_overlay->isChecked()); 691 | settings.setValue("type_packer", ui->checkBox_packer->isChecked()); 692 | settings.setValue("type_patcher", ui->checkBox_patcher->isChecked()); 693 | settings.setValue("type_player", ui->checkBox_player->isChecked()); 694 | settings.setValue("type_protection", ui->checkBox_protection->isChecked()); 695 | settings.setValue("type_protector", ui->checkBox_protector->isChecked()); 696 | settings.setValue("type_script", ui->checkBox_script->isChecked()); 697 | settings.setValue("type_self_displayer", ui->checkBox_self_displayer->isChecked()); 698 | settings.setValue("type_sfx", ui->checkBox_sfx->isChecked()); 699 | settings.setValue("type_source", ui->checkBox_source->isChecked()); 700 | settings.setValue("type_system", ui->checkBox_system->isChecked()); 701 | settings.setValue("type_type", ui->checkBox_type->isChecked()); 702 | settings.setValue("type_operation_system", ui->checkBox_operation_system->isChecked()); 703 | settings.setValue("type_cryptor", ui->checkBox_cryptor->isChecked()); 704 | settings.setValue("type_crypter", ui->checkBox_crypter->isChecked()); 705 | settings.setValue("type_licensing", ui->checkBox_licensing->isChecked()); 706 | settings.setValue("type_language", ui->checkBox_language->isChecked()); 707 | settings.setValue("type_tool", ui->checkBox_tool->isChecked()); 708 | settings.setValue("type_dos_extender", ui->checkBox_dos_extender->isChecked()); 709 | settings.setValue("type_sign_tool", ui->checkBox_sign_tool->isChecked()); 710 | settings.setValue("type_virtual_machine", ui->checkBox_virtual_machine->isChecked()); 711 | settings.setValue("type_malware", ui->checkBox_malware->isChecked()); 712 | settings.setValue("type_virus", ui->checkBox_virus->isChecked()); 713 | 714 | settings.setValue("Recursive", ui->checkBoxRecursive->isChecked()); 715 | settings.setValue("DeepScan", ui->checkBoxDeepScan->isChecked()); 716 | settings.setValue("Verbose", ui->checkBoxVerbose->isChecked()); 717 | settings.setValue("HeuristicScan", ui->checkBoxHeuristicScan->isChecked()); 718 | settings.setValue("Aggressive", ui->checkBoxAggressive->isChecked()); 719 | settings.setValue("ShowVersion", ui->checkBoxShowVersion->isChecked()); 720 | settings.setValue("ShowInfo", ui->checkBoxShowInfo->isChecked()); 721 | settings.setValue("Sort", ui->checkBoxSort->isChecked()); 722 | settings.setValue("ScanSubdirectories", ui->checkBoxScanSubdirectories->isChecked()); 723 | settings.setValue("ValidOnly", ui->checkBoxValidOnly->isChecked()); 724 | 725 | settings.setValue("UnknownPrefix", ui->comboBoxUnknownPrefix->currentIndex()); 726 | settings.setValue("UnknownCount", ui->spinBoxUnknownCount->value()); 727 | 728 | settings.setValue("Overlay", ui->comboBoxOverlay->currentIndex()); 729 | settings.setValue("Entropy", ui->comboBoxEntropy->currentIndex()); 730 | settings.setValue("EntropyValue", ui->doubleSpinBoxEntropy->value()); 731 | // settings.setValue("Threads", ui->spinBoxThreads->value()); 732 | } 733 | 734 | void GuiMainWindow::on_pushButtonLog_clicked() 735 | { 736 | QString sInitDirectory = ui->lineEditLog->text(); 737 | 738 | QString sDirectoryName = QFileDialog::getExistingDirectory(this, tr("Open directory..."), sInitDirectory, QFileDialog::ShowDirsOnly); 739 | 740 | if (!sDirectoryName.isEmpty()) { 741 | ui->lineEditLog->setText(sDirectoryName); 742 | } 743 | } 744 | -------------------------------------------------------------------------------- /gui_source/guimainwindow.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | GuiMainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 1055 10 | 860 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 | false 63 | 64 | 65 | 66 | 67 | 68 | 69 | Deep Scan 70 | 71 | 72 | true 73 | 74 | 75 | 76 | 77 | 78 | 79 | Heuristic Scan 80 | 81 | 82 | true 83 | 84 | 85 | 86 | 87 | 88 | 89 | Verbose 90 | 91 | 92 | true 93 | 94 | 95 | 96 | 97 | 98 | 99 | Aggressive 100 | 101 | 102 | true 103 | 104 | 105 | 106 | 107 | 108 | 109 | Qt::Horizontal 110 | 111 | 112 | 113 | 40 114 | 20 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | Show version 123 | 124 | 125 | true 126 | 127 | 128 | 129 | 130 | 131 | 132 | Show info 133 | 134 | 135 | true 136 | 137 | 138 | 139 | 140 | 141 | 142 | Qt::Horizontal 143 | 144 | 145 | 146 | 158 147 | 20 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | Sort 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | true 170 | 171 | 172 | 173 | ... 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | true 182 | 183 | 184 | 185 | Scan 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | Signatures 198 | 199 | 200 | 201 | 1 202 | 203 | 204 | 1 205 | 206 | 207 | 1 208 | 209 | 210 | 1 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | ... 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | Extra Signatures 235 | 236 | 237 | true 238 | 239 | 240 | 241 | 1 242 | 243 | 244 | 1 245 | 246 | 247 | 1 248 | 249 | 250 | 1 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | ... 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | Custom Signatures 273 | 274 | 275 | true 276 | 277 | 278 | 279 | 1 280 | 281 | 282 | 1 283 | 284 | 285 | 1 286 | 287 | 288 | 1 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | ... 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 0 314 | 0 315 | 316 | 317 | 318 | Copy 319 | 320 | 321 | true 322 | 323 | 324 | true 325 | 326 | 327 | 328 | 0 329 | 330 | 331 | 0 332 | 333 | 334 | 0 335 | 336 | 337 | 0 338 | 339 | 340 | 0 341 | 342 | 343 | 344 | 345 | Copy to 346 | 347 | 348 | 349 | 0 350 | 351 | 352 | 0 353 | 354 | 355 | 0 356 | 357 | 358 | 0 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | ... 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | Copy Count 379 | 380 | 381 | 382 | 0 383 | 384 | 385 | 0 386 | 387 | 388 | 0 389 | 390 | 391 | 0 392 | 393 | 394 | 0 395 | 396 | 397 | 398 | 399 | 1000000 400 | 401 | 402 | 0 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | Copy Format 413 | 414 | 415 | 416 | 0 417 | 418 | 419 | 0 420 | 421 | 422 | 0 423 | 424 | 425 | 0 426 | 427 | 428 | 429 | 430 | 431 | 200 432 | 0 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | Copy Type 444 | 445 | 446 | 447 | 0 448 | 449 | 450 | 0 451 | 452 | 453 | 0 454 | 455 | 456 | 0 457 | 458 | 459 | 460 | 461 | 462 | 200 463 | 0 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | File Name Format 475 | 476 | 477 | 478 | 0 479 | 480 | 481 | 0 482 | 483 | 484 | 0 485 | 486 | 487 | 0 488 | 489 | 490 | 491 | 492 | 493 | 200 494 | 0 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | Qt::Horizontal 506 | 507 | 508 | 509 | 40 510 | 20 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | Unknown Prefix 523 | 524 | 525 | 526 | 0 527 | 528 | 529 | 0 530 | 531 | 532 | 0 533 | 534 | 535 | 0 536 | 537 | 538 | 539 | 540 | 541 | 200 542 | 0 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | Count 554 | 555 | 556 | 557 | 0 558 | 559 | 560 | 0 561 | 562 | 563 | 0 564 | 565 | 566 | 0 567 | 568 | 569 | 0 570 | 571 | 572 | 573 | 574 | 1 575 | 576 | 577 | 100 578 | 579 | 580 | 10 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | Qt::Horizontal 591 | 592 | 593 | 594 | 40 595 | 20 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | Valid only 604 | 605 | 606 | 607 | 608 | 609 | 610 | Remove Copied 611 | 612 | 613 | 614 | 615 | 616 | 617 | Copy the first only 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 0 631 | 0 632 | 633 | 634 | 635 | Log 636 | 637 | 638 | true 639 | 640 | 641 | true 642 | 643 | 644 | 645 | 0 646 | 647 | 648 | 0 649 | 650 | 651 | 0 652 | 653 | 654 | 0 655 | 656 | 657 | 0 658 | 659 | 660 | 661 | 662 | Log to 663 | 664 | 665 | 666 | 0 667 | 668 | 669 | 0 670 | 671 | 672 | 0 673 | 674 | 675 | 0 676 | 677 | 678 | 0 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | ... 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | File types 702 | 703 | 704 | 705 | 0 706 | 707 | 708 | 0 709 | 710 | 711 | 0 712 | 713 | 714 | 0 715 | 716 | 717 | 0 718 | 719 | 720 | 721 | 722 | PDF 723 | 724 | 725 | 726 | 727 | 728 | 729 | ZIP 730 | 731 | 732 | 733 | 734 | 735 | 736 | DEX 737 | 738 | 739 | 740 | 741 | 742 | 743 | IPA 744 | 745 | 746 | 747 | 748 | 749 | 750 | LX 751 | 752 | 753 | 754 | 755 | 756 | 757 | MSDOS 758 | 759 | 760 | 761 | 762 | 763 | 764 | ELF64 765 | 766 | 767 | 768 | 769 | 770 | 771 | JAR 772 | 773 | 774 | 775 | 776 | 777 | 778 | CFBF 779 | 780 | 781 | 782 | 783 | 784 | 785 | COM 786 | 787 | 788 | 789 | 790 | 791 | 792 | APK 793 | 794 | 795 | 796 | 797 | 798 | 799 | MACHO32 800 | 801 | 802 | 803 | 804 | 805 | 806 | ELF32 807 | 808 | 809 | 810 | 811 | 812 | 813 | LE 814 | 815 | 816 | 817 | 818 | 819 | 820 | DOS4G 821 | 822 | 823 | 824 | 825 | 826 | 827 | RAR 828 | 829 | 830 | 831 | 832 | 833 | 834 | Binary 835 | 836 | 837 | 838 | 839 | 840 | 841 | Jpeg 842 | 843 | 844 | 845 | 846 | 847 | 848 | Amiga 849 | 850 | 851 | 852 | 853 | 854 | 855 | JavaClass 856 | 857 | 858 | 859 | 860 | 861 | 862 | MACHO64 863 | 864 | 865 | 866 | 867 | 868 | 869 | All 870 | 871 | 872 | 873 | 874 | 875 | 876 | PE32 877 | 878 | 879 | 880 | 881 | 882 | 883 | PNG 884 | 885 | 886 | 887 | 888 | 889 | 890 | DOS16M 891 | 892 | 893 | 894 | 895 | 896 | 897 | NPM 898 | 899 | 900 | 901 | 902 | 903 | 904 | MACHOFAT 905 | 906 | 907 | 908 | 909 | 910 | 911 | NE 912 | 913 | 914 | 915 | 916 | 917 | 918 | PE64 919 | 920 | 921 | 922 | 923 | 924 | 925 | Atari ST 926 | 927 | 928 | 929 | 930 | 931 | 932 | 933 | 934 | 935 | Types 936 | 937 | 938 | 939 | 0 940 | 941 | 942 | 0 943 | 944 | 945 | 0 946 | 947 | 948 | 0 949 | 950 | 951 | 0 952 | 953 | 954 | 955 | 956 | dos extender 957 | 958 | 959 | 960 | 961 | 962 | 963 | self-displayer 964 | 965 | 966 | 967 | 968 | 969 | 970 | type 971 | 972 | 973 | 974 | 975 | 976 | 977 | other 978 | 979 | 980 | 981 | 982 | 983 | 984 | converter 985 | 986 | 987 | 988 | 989 | 990 | 991 | packer 992 | 993 | 994 | 995 | 996 | 997 | 998 | All 999 | 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | crypter 1006 | 1007 | 1008 | 1009 | 1010 | 1011 | 1012 | language 1013 | 1014 | 1015 | 1016 | 1017 | 1018 | 1019 | overlay 1020 | 1021 | 1022 | 1023 | 1024 | 1025 | 1026 | boot 1027 | 1028 | 1029 | 1030 | 1031 | 1032 | 1033 | driver 1034 | 1035 | 1036 | 1037 | 1038 | 1039 | 1040 | script 1041 | 1042 | 1043 | 1044 | 1045 | 1046 | 1047 | audio 1048 | 1049 | 1050 | 1051 | 1052 | 1053 | 1054 | system 1055 | 1056 | 1057 | 1058 | 1059 | 1060 | 1061 | image 1062 | 1063 | 1064 | 1065 | 1066 | 1067 | 1068 | immunizer 1069 | 1070 | 1071 | 1072 | 1073 | 1074 | 1075 | cryptor 1076 | 1077 | 1078 | 1079 | 1080 | 1081 | 1082 | tool 1083 | 1084 | 1085 | 1086 | 1087 | 1088 | 1089 | player 1090 | 1091 | 1092 | 1093 | 1094 | 1095 | 1096 | loader 1097 | 1098 | 1099 | 1100 | 1101 | 1102 | 1103 | keygen 1104 | 1105 | 1106 | 1107 | 1108 | 1109 | 1110 | sfx 1111 | 1112 | 1113 | 1114 | 1115 | 1116 | 1117 | source 1118 | 1119 | 1120 | 1121 | 1122 | 1123 | 1124 | format 1125 | 1126 | 1127 | 1128 | 1129 | 1130 | 1131 | patcher 1132 | 1133 | 1134 | 1135 | 1136 | 1137 | 1138 | protector 1139 | 1140 | 1141 | 1142 | 1143 | 1144 | 1145 | installer 1146 | 1147 | 1148 | 1149 | 1150 | 1151 | 1152 | framework 1153 | 1154 | 1155 | 1156 | 1157 | 1158 | 1159 | joiner 1160 | 1161 | 1162 | 1163 | 1164 | 1165 | 1166 | licensing 1167 | 1168 | 1169 | 1170 | 1171 | 1172 | 1173 | emulator 1174 | 1175 | 1176 | 1177 | 1178 | 1179 | 1180 | linker 1181 | 1182 | 1183 | 1184 | 1185 | 1186 | 1187 | compiler 1188 | 1189 | 1190 | 1191 | 1192 | 1193 | 1194 | sign tool 1195 | 1196 | 1197 | 1198 | 1199 | 1200 | 1201 | archive 1202 | 1203 | 1204 | 1205 | 1206 | 1207 | 1208 | extender 1209 | 1210 | 1211 | 1212 | 1213 | 1214 | 1215 | library 1216 | 1217 | 1218 | 1219 | 1220 | 1221 | 1222 | protection 1223 | 1224 | 1225 | 1226 | 1227 | 1228 | 1229 | operation system 1230 | 1231 | 1232 | 1233 | 1234 | 1235 | 1236 | virtual machine 1237 | 1238 | 1239 | 1240 | 1241 | 1242 | 1243 | malware 1244 | 1245 | 1246 | 1247 | 1248 | 1249 | 1250 | virus 1251 | 1252 | 1253 | 1254 | 1255 | 1256 | 1257 | 1258 | 1259 | 1260 | Qt::Horizontal 1261 | 1262 | 1263 | 1264 | 40 1265 | 20 1266 | 1267 | 1268 | 1269 | 1270 | 1271 | 1272 | 1273 | 1274 | 1275 | Scan if 1276 | 1277 | 1278 | 1279 | 0 1280 | 1281 | 1282 | 0 1283 | 1284 | 1285 | 0 1286 | 1287 | 1288 | 0 1289 | 1290 | 1291 | 0 1292 | 1293 | 1294 | 1295 | 1296 | Overlay 1297 | 1298 | 1299 | 1300 | 0 1301 | 1302 | 1303 | 0 1304 | 1305 | 1306 | 0 1307 | 1308 | 1309 | 0 1310 | 1311 | 1312 | 1313 | 1314 | 1315 | 150 1316 | 0 1317 | 1318 | 1319 | 1320 | 1321 | 1322 | 1323 | 1324 | 1325 | 1326 | 1327 | Entropy 1328 | 1329 | 1330 | 1331 | 0 1332 | 1333 | 1334 | 0 1335 | 1336 | 1337 | 0 1338 | 1339 | 1340 | 0 1341 | 1342 | 1343 | 1344 | 1345 | 1346 | 150 1347 | 16777215 1348 | 1349 | 1350 | 1351 | 1352 | 1353 | 1354 | 1355 | 1356 | 50 1357 | 16777215 1358 | 1359 | 1360 | 1361 | 8.000000000000000 1362 | 1363 | 1364 | 1365 | 1366 | 1367 | 1368 | false 1369 | 1370 | 1371 | 1372 | 50 1373 | 16777215 1374 | 1375 | 1376 | 1377 | 1378 | 1379 | 1380 | 1381 | 1382 | 1383 | 1384 | Qt::Horizontal 1385 | 1386 | 1387 | 1388 | 40 1389 | 20 1390 | 1391 | 1392 | 1393 | 1394 | 1395 | 1396 | 1397 | Qt::Horizontal 1398 | 1399 | 1400 | 1401 | 236 1402 | 20 1403 | 1404 | 1405 | 1406 | 1407 | 1408 | 1409 | 1410 | 1411 | 1412 | 1413 | Qt::Vertical 1414 | 1415 | 1416 | 1417 | 20 1418 | 40 1419 | 1420 | 1421 | 1422 | 1423 | 1424 | 1425 | 1426 | 1427 | 1428 | Info 1429 | 1430 | 1431 | 1432 | 1433 | 1434 | 1435 | Qt::Horizontal 1436 | 1437 | 1438 | 1439 | 40 1440 | 20 1441 | 1442 | 1443 | 1444 | 1445 | 1446 | 1447 | 1448 | Exit 1449 | 1450 | 1451 | 1452 | 1453 | 1454 | 1455 | 1456 | 1457 | 1458 | 1459 | 1460 | 1461 | --------------------------------------------------------------------------------