retdec
|
#include <signature.h>
Classes | |
class | Byte |
class | MatchSettings |
Public Member Functions | |
Signature ()=delete | |
Signature (const std::initializer_list< Signature::Byte > &initList) | |
Signature (const Signature &signature) | |
virtual | ~Signature ()=default |
uint64_t | getSize () const |
uint64_t | getCaptureSize () const |
bool | match (const MatchSettings &settings, retdec::loader::Image *file) const |
bool | match (const MatchSettings &settings, const retdec::utils::DynamicBuffer &data) const |
bool | match (const MatchSettings &settings, retdec::loader::Image *file, retdec::utils::DynamicBuffer &capturedData) const |
bool | match (const MatchSettings &settings, const retdec::utils::DynamicBuffer &data, retdec::utils::DynamicBuffer &capturedData) const |
Signature & | operator= (const std::initializer_list< Signature::Byte > &initList) |
Private Member Functions | |
Signature & | operator= (const Signature &) |
bool | searchMatchImpl (const std::vector< uint8_t > &bytesToMatch, uint64_t offset, uint64_t maxSearchDist, retdec::utils::DynamicBuffer *captureBuffer) const |
int64_t | matchImpl (const std::vector< uint8_t > &bytesToMatch, uint64_t offset, retdec::utils::DynamicBuffer *captureBuffer) const |
Private Attributes | |
std::vector< Signature::Byte > | _buffer |
Signature bytes buffer. More... | |
Class for storing the signatures that can be matched against another file or another DynamicBuffer. Signature can contains three type of bytes
Exact byte values are equal to the expected byte value that should be at the specific position in the matched data. Wildcard can specify the bytes that can have any value but are still matched as equal. Capture bytes are same as wildcard bytes but they are also put into the capture buffer and can be later obtained from the caller.
Signatures can also be specified for per-bit-matching, not only per-byte-matching. The expected value and wildcard bits are distinguished using wildcard mask in Signature::Byte class.
Signature matching on files is being done only on section or segment that contains entry point.
|
delete |
retdec::unpacker::Signature::Signature | ( | const std::initializer_list< Signature::Byte > & | initList | ) |
Initializer list constructor.
initList | Initializer list containing Signature::Byte objects. |
retdec::unpacker::Signature::Signature | ( | const Signature & | signature | ) |
Copy constructor.
signature | Another signature. |
|
virtualdefault |
uint64_t retdec::unpacker::Signature::getCaptureSize | ( | ) | const |
Returns the number of bytes in the signature that has Signature::Byte::Type::CAPTURE type.
uint64_t retdec::unpacker::Signature::getSize | ( | ) | const |
Returns the number of bytes in the signature.
bool retdec::unpacker::Signature::match | ( | const MatchSettings & | settings, |
const retdec::utils::DynamicBuffer & | data | ||
) | const |
Matches the signature against the data buffer using the specified settings.
settings | Match settings. |
data | Input data buffer. |
bool retdec::unpacker::Signature::match | ( | const MatchSettings & | settings, |
const retdec::utils::DynamicBuffer & | data, | ||
retdec::utils::DynamicBuffer & | capturedData | ||
) | const |
Matches the signature against the data buffer using the specified settings and captures all capture bytes into DynamicBuffer.
settings | Match settings. |
data | Input data buffer. |
capturedData | Buffer where to capture the capture bytes. |
bool retdec::unpacker::Signature::match | ( | const MatchSettings & | settings, |
retdec::loader::Image * | file | ||
) | const |
Matches the signature against the file using the specified settings. Matching is being done on section or segment which contains entry point.
settings | Match settings. |
file | Input file. |
bool retdec::unpacker::Signature::match | ( | const MatchSettings & | settings, |
retdec::loader::Image * | file, | ||
retdec::utils::DynamicBuffer & | capturedData | ||
) | const |
Matches the signature against the file using the specified settings and captures all capture bytes into DynamicBuffer. Matching is being done on section or segment which contains entry point.
settings | Match settings. |
file | Input file. |
capturedData | Buffer where to capture the capture bytes. |
|
private |
Signature & retdec::unpacker::Signature::operator= | ( | const std::initializer_list< Signature::Byte > & | initList | ) |
Assignment operator allowing initializer list assignment.
initList | Initializer list containing Signature::Byte objects. |
|
private |
|
private |
Signature bytes buffer.