retdec
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
retdec::cpdetect::CompilerDetector Class Reference

#include <cpdetect.h>

Inheritance diagram for retdec::cpdetect::CompilerDetector:
Inheritance graph
[legend]
Collaboration diagram for retdec::cpdetect::CompilerDetector:
Collaboration graph
[legend]

Public Member Functions

 CompilerDetector (retdec::fileformat::FileFormat &parser, DetectParams &params, ToolInformation &toolInfo)
 

Protected Member Functions

void populateInternalPaths (const fs::path &dir, const std::set< std::string > &formats, const std::set< std::string > &archs)
 

Protected Attributes

ToolInformationtoolInfo
 results - detected tools More...
 
retdec::fileformat::Architecture targetArchitecture
 
Search search
 class for signature search More...
 
std::unique_ptr< Heuristicsheuristics
 class for heuristics detections More...
 
std::vector< std::string > internalPaths
 internal rule database files More...
 
fs::path pathToShared
 path to shared folder More...
 
std::set< std::string > externalSuffixes
 external database file suffixes More...
 

Private Member Functions

External databases parsing
bool getExternalDatabases ()
 
Other methods
void removeCompilersWithLessSimilarity (double ratio)
 
void removeUnusedCompilers ()
 
- Private Member Functions inherited from retdec::utils::NonCopyable
 NonCopyable (const NonCopyable &)=delete
 
NonCopyableoperator= (const NonCopyable &)=delete
 
 NonCopyable ()=default
 
 ~NonCopyable ()=default
 

Private Attributes

retdec::fileformat::FileFormatfileParser
 
DetectParamscpParams
 
std::vector< std::string > externalDatabase
 

Detection methods

void getAllHeuristics ()
 
ReturnCode getAllSignatures ()
 
ReturnCode getAllCompilers ()
 
ReturnCode getAllInformation ()
 

Detailed Description

CompilerDetector - find information about tools

Constructor & Destructor Documentation

◆ CompilerDetector()

retdec::cpdetect::CompilerDetector::CompilerDetector ( retdec::fileformat::FileFormat parser,
DetectParams params,
ToolInformation toolInfo 
)

Constructor

Constructor in subclass must create members heuristics, internalDatabase and externalSuffixes

Member Function Documentation

◆ getAllCompilers()

ReturnCode retdec::cpdetect::CompilerDetector::getAllCompilers ( )
private

Detects all compilers (and packers) based on signatures and heuristics

Returns
Status of detection (ReturnCode::OK if all is OK)

◆ getAllHeuristics()

void retdec::cpdetect::CompilerDetector::getAllHeuristics ( )
private

Try detect used compiler (or packer) based on heuristics

◆ getAllInformation()

ReturnCode retdec::cpdetect::CompilerDetector::getAllInformation ( )

Detect all supported information about used compiler or packer

Returns
Status of detection (ReturnCode::OK if all is OK)

Compiler can be successfully detected even if is returned a value other than ReturnCode::OK

◆ getAllSignatures()

ReturnCode retdec::cpdetect::CompilerDetector::getAllSignatures ( )
private

Try detect used compiler (or packer) based on signatures

Returns
Status of detection (ReturnCode::OK if all is OK)

◆ getExternalDatabases()

bool retdec::cpdetect::CompilerDetector::getExternalDatabases ( )
private

External databases parsing

Returns
true if at least one external database was detected, false otherwise

◆ populateInternalPaths()

void retdec::cpdetect::CompilerDetector::populateInternalPaths ( const fs::path &  dir,
const std::set< std::string > &  formats,
const std::set< std::string > &  archs 
)
protected

Add all YARA files from the given dir to internal paths member. Expects dir structure like this: formats/archs/files

◆ removeCompilersWithLessSimilarity()

void retdec::cpdetect::CompilerDetector::removeCompilersWithLessSimilarity ( double  refRatio)
private

Remove every detected compiler wchich has less similarity than refRatio

Compilers which have not been detected based on signatures are not affected

Parameters
refRatioSimilarity ratio

◆ removeUnusedCompilers()

void retdec::cpdetect::CompilerDetector::removeUnusedCompilers ( )
private

Remove redundant compilers

Member Data Documentation

◆ cpParams

DetectParams& retdec::cpdetect::CompilerDetector::cpParams
private

◆ externalDatabase

std::vector<std::string> retdec::cpdetect::CompilerDetector::externalDatabase
private

◆ externalSuffixes

std::set<std::string> retdec::cpdetect::CompilerDetector::externalSuffixes
protected

external database file suffixes

◆ fileParser

retdec::fileformat::FileFormat& retdec::cpdetect::CompilerDetector::fileParser
private

◆ heuristics

std::unique_ptr<Heuristics> retdec::cpdetect::CompilerDetector::heuristics
protected

class for heuristics detections

◆ internalPaths

std::vector<std::string> retdec::cpdetect::CompilerDetector::internalPaths
protected

internal rule database files

◆ pathToShared

fs::path retdec::cpdetect::CompilerDetector::pathToShared
protected

path to shared folder

◆ search

Search retdec::cpdetect::CompilerDetector::search
protected

class for signature search

◆ targetArchitecture

retdec::fileformat::Architecture retdec::cpdetect::CompilerDetector::targetArchitecture
protected

◆ toolInfo

ToolInformation& retdec::cpdetect::CompilerDetector::toolInfo
protected

results - detected tools


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