2#include <LIEF/errors.hpp>
3#include <LIEF/PE/signature/Signature.hpp>
7using namespace LIEF::PE;
8std::unique_ptr<const Binary>
binary;
14 binary = Parser::parse(PortableExecutablePath);
22 std::vector<std::string> results;
24 throw std::runtime_error(
"Not a PE");
27 if (
binary->imports().size() > 0) {
28 auto it_imports =
binary->imports();
29 for (LIEF::PE::Import
import : it_imports)
31 std::string moduleName =
import.name();
32 for (
auto entry :
import.entries())
34 std::string entryName = entry.name();
35 std::string entryJoined = moduleName +
"!" + entryName;
36 results.push_back(entryJoined);
47 std::vector<std::pair<std::string, double>> results;
49 throw std::runtime_error(
"Not a PE");
52 if (
binary->sections().size() > 0) {
53 for (LIEF::PE::Section section :
binary->sections())
55 std::string sectionName = section.name();
56 double sectionEntropy = section.entropy();
57 results.push_back(std::make_pair(sectionName, sectionEntropy));
68 throw std::runtime_error(
"Not a PE");
71 if (!
binary->has_signatures())
74 Signature::VERIFICATION_FLAGS sigCheck =
binary->verify_signature();
75 if (sigCheck == Signature::VERIFICATION_FLAGS::OK)
bool CheckIfSigned()
Check if the portable executable is signed.
std::vector< std::pair< std::string, double > > GetSections()
Get the sections from the portable executable.
std::vector< std::string > GetImports()
Get the imports from the portable executable.
PortableExecutable(std::string PortableExecutablePath)
Constructor for the PortableExecutable class.
std::unique_ptr< const Binary > binary