■ ■ ■ ■ ■ ■
SearchAvailableExe/SearchAvailableExe.cpp
skipped 112 lines 113 113 printf(" -w,--write: <bool> Whether to only output information about directories with write permissions, with the default value being 'no'.\n"); 114 114 printf(" -c,--count: <count> Controls the output of the number of DLLs loaded by white programs, only outputting if the count is less than or equal to a specified value. The default value is 1.\n"); 115 115 printf(" -b,--bit: <count> Select the output bitness, supporting 32, 64, and 96 bits. The default is 96 bits, while also outputting information for 32 and 64-bit white programs.\n"); 116 + printf(" -s,--save: <bool> Whether to save available files, default is not to save.\n"); 116 117 exit(0); 117 118 } 118 119 skipped 41 lines 160 161 get_opt(argc, argv, OPT_TYPE_FLAG, &c.isWrite, "w", "write", NULL); 161 162 get_opt(argc, argv, OPT_TYPE_DEC, &c.dllCount, "c", "count", validate_dllCount); 162 163 get_opt(argc, argv, OPT_TYPE_DEC, &c.bit, "b", "bit", validate_bit); 164 + get_opt(argc, argv, OPT_TYPE_FLAG, &c.isSaveFile, "s", "save", NULL); 163 165 164 166 ostream* output = &cout; 165 167 ofstream outputFile; skipped 20 lines 186 188 sort(results.begin(), results.end(), compare); 187 189 188 190 results.erase(std::remove_if(results.begin(), results.end(), isUnwanted), results.end()); 189 - 190 - *output << "dll信息统计完毕,初步符合要求的白程序有:" << results.size() << "个" << endl; 191 191 192 192 HANDLE hThread = CreateThread(NULL, 0, MonitorThread, NULL, 0, NULL); 193 193 skipped 16 lines 210 210 *output << "程序位数: " << result->bit << " 目录是否可写: " << result->isWrite << endl; 211 211 *output << "可利用DLL: " << result->exploitDllPath << endl; 212 212 213 - / * if (result->preLoadDlls.size() > 0 ) { 214 - *output << "预 加 载 DLL个 数 : " < < result - > preLoadDlls . size ( ) << endl; 215 - for (const auto & dll : result->preLoadDlls) { 216 - *output << dll << endl; 217 - delete[] dll; 213 + if (result->preLoadDlls.size() + result - >postLoadDlls . size ( ) > 1 ) { 214 + *output << "需 要 复 制 以 下 DLL: " << endl; 215 + if (result->preLoadDlls. size ( ) > 0 ) { 216 + for (const auto& dll : result->preLoadDlls) { 217 + if (result->exploitDllPath != dll) 218 + *output << dll << endl; 219 + delete[] dll; 220 + } 218 221 } 219 - } 220 222 221 - if (result->postLoadDlls.size() > 0) { 222 - *output << "动态加载DLL个数: " << result->postLoadDlls.size() << endl; 223 - for (const auto& dll : result->postLoadDlls) { 224 - *output << dll << endl; 225 - delete[] dll; 223 + if (result->postLoadDlls.size() > 0) { 224 + for (const auto& dll : result->postLoadDlls) { 225 + if (result->exploitDllPath != dll) 226 + *output << dll << endl; 227 + delete[] dll; 228 + } 226 229 } 227 - }* / 230 + } 228 231 229 232 *output << "--------------------------------------------------" << endl; 230 233 skipped 12 lines