MCPcopy Create free account
hub / github.com/avast/retdec / unpackFile

Function unpackFile

src/unpackertool/unpacker.cpp:87–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85}
86
87ExitCode unpackFile(const std::string& inputFile, const std::string& outputFile, bool brute, const std::vector<retdec::cpdetect::DetectResult>& detectedPackers)
88{
89 Plugin::Arguments pluginArgs = { inputFile, outputFile, brute };
90
91 ExitCode ret = EXIT_CODE_NOTHING_TO_DO;
92 for (const auto& detectedPacker : detectedPackers)
93 {
94 PluginList plugins = PluginMgr::matchingPlugins(detectedPacker.name, detectedPacker.versionInfo);
95
96 if (plugins.empty())
97 {
98 Log::error() << "No matching plugins found for '" << detectedPacker.name;
99 if (detectedPacker.versionInfo != WILDCARD_ALL_VERSIONS)
100 Log::error() << " " << detectedPacker.versionInfo;
101 Log::error() << "'" << std::endl;
102 continue;
103 }
104
105 for (const auto& plugin : plugins)
106 {
107 PluginExitCode pluginExitCode = plugin->run(pluginArgs);
108 if (pluginExitCode == PLUGIN_EXIT_UNPACKED)
109 {
110 plugin->log("Successfully unpacked '", inputFile, "'!");
111 return EXIT_CODE_OK;
112 }
113 else if (pluginExitCode == PLUGIN_EXIT_FAILED)
114 ret = EXIT_CODE_UNPACKING_FAILED;
115 }
116 }
117
118 return ret;
119}
120
121ExitCode processArgs(ArgHandler& handler, char argc, char** argv)
122{

Callers 1

processArgsFunction · 0.85

Calls 3

emptyMethod · 0.45
runMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected