■ ■ ■ ■ ■ ■
SearchAvailableExe/Tools.cpp
| skipped 799 lines |
800 | 800 | | return exitCode; |
801 | 801 | | } |
802 | 802 | | |
803 | | - | void RunPE() { |
| 803 | + | void RunPE(PResultInfo result) { |
804 | 804 | | std::string currentPath = GetCurrentPath(); |
805 | 805 | | |
806 | | - | for (auto it = results.begin(); it != results.end();) { |
807 | | - | PResultInfo result = *it; |
| 806 | + | string folderPath = CreateRandomFolder(currentPath); |
808 | 807 | | |
809 | | - | string folderPath = CreateRandomFolder(currentPath); |
| 808 | + | string runFilePath = CopyFileToFolder(result->filePath, folderPath, result->isCreateWindow, NULL); |
810 | 809 | | |
811 | | - | string runFilePath = CopyFileToFolder(result->filePath, folderPath, result->isCreateWindow, NULL); |
| 810 | + | map<DWORD, std::string> hookDllMap; |
| 811 | + | bool flag; |
| 812 | + | DWORD exitCode = 0x22222222; |
812 | 813 | | |
813 | | - | map<DWORD, std::string> hookDllMap; |
814 | | - | bool flag; |
815 | | - | DWORD exitCode = 0x22222222; |
| 814 | + | for (const auto& dll : result->preLoadDlls) { |
| 815 | + | CopyFileToFolder(result->fileDir + dll, folderPath, true, exitCode); |
| 816 | + | hookDllMap[exitCode] = dll; |
| 817 | + | exitCode++; |
| 818 | + | } |
816 | 819 | | |
817 | | - | for (const auto& dll : result->preLoadDlls) { |
818 | | - | CopyFileToFolder(result->fileDir + dll, folderPath, true, exitCode); |
819 | | - | hookDllMap[exitCode] = dll; |
820 | | - | exitCode++; |
821 | | - | } |
822 | | - | |
823 | | - | for (const auto& dll : result->postLoadDlls) { |
824 | | - | CopyFileToFolder(result->fileDir + dll, folderPath, true, exitCode); |
825 | | - | hookDllMap[exitCode] = dll; |
826 | | - | exitCode++; |
827 | | - | } |
| 820 | + | for (const auto& dll : result->postLoadDlls) { |
| 821 | + | CopyFileToFolder(result->fileDir + dll, folderPath, true, exitCode); |
| 822 | + | hookDllMap[exitCode] = dll; |
| 823 | + | exitCode++; |
| 824 | + | } |
828 | 825 | | |
829 | | - | DWORD retExitCode = TestCreateProcess(runFilePath); |
830 | | - | result->exploitDllPath = hookDllMap[retExitCode]; |
| 826 | + | DWORD retExitCode = TestCreateProcess(runFilePath); |
| 827 | + | result->exploitDllPath = hookDllMap[retExitCode]; |
831 | 828 | | |
832 | | - | DeleteDirectory(folderPath.c_str()); |
| 829 | + | DeleteDirectory(folderPath.c_str()); |
833 | 830 | | |
834 | | - | if (result->exploitDllPath == "") |
835 | | - | it = results.erase(it); |
836 | | - | else { |
837 | | - | ++it; |
838 | | - | //DeleteDirectory(folderPath.c_str()); |
839 | | - | } |
840 | | - | } |
| 831 | + | //if (result->exploitDllPath == "") |
| 832 | + | // it = results.erase(it); |
| 833 | + | //else { |
| 834 | + | // ++it; |
| 835 | + | // //DeleteDirectory(folderPath.c_str()); |
| 836 | + | //} |
841 | 837 | | } |