retdec
|
Generate signatures from binary files. More...
#include <cctype>
#include <vector>
#include "retdec/fileformat/format_factory.h"
#include "retdec/utils/conversion.h"
#include "retdec/utils/string.h"
#include "retdec/utils/io/log.h"
Classes | |
struct | Options |
Functions | |
void | printUsage () |
int | printError (const std::string &message) |
void | printWarning (const std::string &message) |
std::string | getParamOrDie (std::vector< std::string > &argv, std::size_t &i) |
bool | doParams (int argc, char **_argv, Options &options) |
std::size_t | getShortestLength (const std::vector< std::string > &inputs) |
std::string | createSignature (const std::vector< std::string > &contents) |
std::string | formatToCondition (const Format &format) |
std::string | getYaraRule (const std::string &pattern, const Format &fileFormat, const Options &options) |
int | main (int argc, char **argv) |
Generate signatures from binary files.
std::string createSignature | ( | const std::vector< std::string > & | contents | ) |
Creates signature pattern from vector of strings
contents | Vector of bytes from files |
bool doParams | ( | int | argc, |
char ** | _argv, | ||
Options & | options | ||
) |
Process parameters
argc | number of program parameters |
_argv | array of program parameters |
options | structure for storing information |
true
if processing was completed successfully, false
otherwise std::string formatToCondition | ( | const Format & | format | ) |
Form entry point condition from format.
format | file format |
std::string getParamOrDie | ( | std::vector< std::string > & | argv, |
std::size_t & | i | ||
) |
Fetch parameter value or die with error message.
argv | vector with arguments |
i | index of argument |
std::size_t getShortestLength | ( | const std::vector< std::string > & | inputs | ) |
Get length of shortest string in given vector.
inputs | vector of strings |
If input vector is empty, function returns 0.
std::string getYaraRule | ( | const std::string & | pattern, |
const Format & | fileFormat, | ||
const Options & | options | ||
) |
Create YARA rule from pattern.
pattern | input pattern |
fileFormat | file format |
options | application options |
int main | ( | int | argc, |
char ** | argv | ||
) |
int printError | ( | const std::string & | message | ) |
Print error message and return non-zero value.
message | error message |
void printUsage | ( | ) |
Print usage.
void printWarning | ( | const std::string & | message | ) |
Print warning message.
message | warning message |