retdec
yara_rule.h
Go to the documentation of this file.
1 
7 #ifndef RETDEC_YARACPP_YARA_RULE_H
8 #define RETDEC_YARACPP_YARA_RULE_H
9 
10 #include <iosfwd>
11 #include <vector>
12 
15 
16 namespace retdec {
17 namespace yaracpp {
18 
22 class YaraRule
23 {
24  private:
25  std::string name;
26  std::vector<YaraMeta> metas;
27  std::vector<YaraMatch> matches;
28  public:
31  const std::string &getName() const;
32  const YaraMeta* getMeta(const std::string &id) const;
33  const YaraMatch* getMatch(std::size_t index) const;
34  const YaraMatch* getFirstMatch() const;
35  const std::vector<YaraMeta>& getMetas() const;
36  const std::vector<YaraMatch>& getMatches() const;
37  std::size_t getNumberOfMetas() const;
38  std::size_t getNumberOfMatches() const;
40 
43  YaraMeta* getMeta(const std::string &id);
44  YaraMatch* getMatch(std::size_t index);
47 
50  void setName(const std::string &ruleName);
52 
55  void addMeta(const YaraMeta &meta);
56  void addMatch(const YaraMatch &match);
58 
59  // @name Utility operator overloads
60  // @{
61  friend std::ostream& operator<<(std::ostream& o, const YaraRule& rule);
62  // @}
63 };
64 
65 } // namespace yaracpp
66 } // namespace retdec
67 
68 #endif
Definition: yara_match.h:20
Definition: yara_meta.h:19
Definition: yara_rule.h:23
std::size_t getNumberOfMetas() const
Definition: yara_rule.cpp:82
std::vector< YaraMeta > metas
Definition: yara_rule.h:26
std::size_t getNumberOfMatches() const
Definition: yara_rule.cpp:91
const YaraMatch * getFirstMatch() const
Definition: yara_rule.cpp:55
const std::string & getName() const
Definition: yara_rule.cpp:18
std::vector< YaraMatch > matches
Definition: yara_rule.h:27
void setName(const std::string &ruleName)
Definition: yara_rule.cpp:133
void addMatch(const YaraMatch &match)
Definition: yara_rule.cpp:151
const YaraMatch * getMatch(std::size_t index) const
Definition: yara_rule.cpp:46
std::string name
Definition: yara_rule.h:25
friend std::ostream & operator<<(std::ostream &o, const YaraRule &rule)
Definition: yara_rule.cpp:162
const std::vector< YaraMatch > & getMatches() const
Definition: yara_rule.cpp:73
const std::vector< YaraMeta > & getMetas() const
Definition: yara_rule.cpp:64
void addMeta(const YaraMeta &meta)
Definition: yara_rule.cpp:142
const YaraMeta * getMeta(const std::string &id) const
Definition: yara_rule.cpp:28
bool match(SymbolicTree &st, const Pattern &p)
Definition: symbolic_tree_match.h:28
Definition: archive_wrapper.h:19
Library representation of one YARA match.
Library representation of one YARA meta.