Panoptes 1.0.0
Endpoint Detection and Response
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
PortableExecutable Class Reference

#include <PanoptesPE.h>

Classes

struct  PEScanData
 The data that is sent to the Panoptes Service. More...
 

Public Member Functions

 PortableExecutable (std::string PortableExecutablePath)
 Constructor for the PortableExecutable class.
 
std::vector< std::string > GetImports ()
 Get the imports from the portable executable.
 
std::vector< std::pair< std::string, double > > GetSections ()
 Get the sections from the portable executable.
 
bool CheckIfSigned ()
 Check if the portable executable is signed.
 

Detailed Description

Definition at line 8 of file PanoptesPE.h.

Constructor & Destructor Documentation

◆ PortableExecutable()

PortableExecutable::PortableExecutable ( std::string  PortableExecutablePath)

Constructor for the PortableExecutable class.

Parameters
PortableExecutablePathThe path to the portable executable to scan

Definition at line 12 of file pe-scan.cpp.

13{
14 binary = Parser::parse(PortableExecutablePath);
15 return;
16}
std::unique_ptr< const Binary > binary
Definition pe-scan.cpp:8

References binary.

Member Function Documentation

◆ CheckIfSigned()

bool PortableExecutable::CheckIfSigned ( )

Check if the portable executable is signed.

Returns
True if the portable executable is signed, false otherwise

Definition at line 65 of file pe-scan.cpp.

66{
67 if (binary == NULL) {
68 throw std::runtime_error("Not a PE");
69 }
70
71 if (!binary->has_signatures())
72 return false;
73
74 Signature::VERIFICATION_FLAGS sigCheck = binary->verify_signature();
75 if (sigCheck == Signature::VERIFICATION_FLAGS::OK)
76 return true;
77
78 return false;
79}

References binary.

Referenced by PanoEntry(), and PE::TEST().

◆ GetImports()

std::vector< std::string > PortableExecutable::GetImports ( )

Get the imports from the portable executable.

Returns
A vector of strings containing the imports

Definition at line 20 of file pe-scan.cpp.

21{
22 std::vector<std::string> results;
23 if (binary == NULL) {
24 throw std::runtime_error("Not a PE");
25 }
26
27 if (binary->imports().size() > 0) {
28 auto it_imports = binary->imports();
29 for (LIEF::PE::Import import : it_imports)
30 {
31 std::string moduleName = import.name();
32 for (auto entry : import.entries())
33 {
34 std::string entryName = entry.name();
35 std::string entryJoined = moduleName + "!" + entryName;
36 results.push_back(entryJoined);
37 }
38 }
39 }
40 return results;
41}

References binary.

Referenced by PanoEntry(), and PE::TEST().

◆ GetSections()

std::vector< std::pair< std::string, double > > PortableExecutable::GetSections ( )

Get the sections from the portable executable.

Returns
A vector of pairs containing the section name and entropy

Definition at line 45 of file pe-scan.cpp.

46{
47 std::vector<std::pair<std::string, double>> results;
48 if (binary == NULL) {
49 throw std::runtime_error("Not a PE");
50 }
51
52 if (binary->sections().size() > 0) {
53 for (LIEF::PE::Section section : binary->sections())
54 {
55 std::string sectionName = section.name();
56 double sectionEntropy = section.entropy();
57 results.push_back(std::make_pair(sectionName, sectionEntropy));
58 }
59 }
60 return results;
61}

References binary.

Referenced by PanoEntry(), and PE::TEST().


The documentation for this class was generated from the following files: