mirror of
https://github.com/openappsec/openappsec.git
synced 2025-09-29 19:24:26 +03:00
sync code
This commit is contained in:
@@ -30,6 +30,7 @@ class AgentDetailsReporter
|
||||
Singleton::Consume<I_Messaging>,
|
||||
Singleton::Consume<I_MainLoop>,
|
||||
Singleton::Consume<I_Environment>,
|
||||
Singleton::Consume<I_TimeGet>,
|
||||
Singleton::Consume<I_RestApi>
|
||||
{
|
||||
public:
|
||||
|
@@ -53,6 +53,51 @@ private:
|
||||
std::map<std::string, std::set<std::string>> set_string_attr;
|
||||
};
|
||||
|
||||
class IpAddressRange
|
||||
{
|
||||
public:
|
||||
IpAddressRange() = default;
|
||||
IpAddressRange(const std::string &min, const std::string &max) : min(min), max(max) {}
|
||||
bool operator==(const IpAddressRange &other) const { return min == other.min && max == other.max; }
|
||||
|
||||
const std::string getMin() const { return min; }
|
||||
const std::string getMax() const { return max; }
|
||||
|
||||
template <class Archive>
|
||||
void serialize(Archive &ar) {
|
||||
ar(CEREAL_NVP(max), CEREAL_NVP(min));
|
||||
}
|
||||
|
||||
private:
|
||||
std::string min;
|
||||
std::string max;
|
||||
};
|
||||
|
||||
class IpAttributes
|
||||
{
|
||||
public:
|
||||
IpAttributes() = default;
|
||||
IpAttributes & addIpv4Addresses(const std::string &val);
|
||||
IpAttributes & addIpv6Addresses(const std::string &val);
|
||||
IpAttributes & addIpv4AddressRanges(const IpAddressRange &val);
|
||||
IpAttributes & addIpv6AddressRanges(const IpAddressRange &val);
|
||||
Maybe<std::vector<std::string>, void> getIpv4Addresses() const;
|
||||
Maybe<std::vector<std::string>, void> getIpv6Addresses() const;
|
||||
Maybe<std::vector<IpAddressRange>, void> getIpv4AddressRanges() const;
|
||||
Maybe<std::vector<IpAddressRange>, void> getIpv6AddressRanges() const;
|
||||
Maybe<std::string, void> genObject() const;
|
||||
bool isEmpty() const;
|
||||
bool matches(const IpAttributes &other) const;
|
||||
void serialize(cereal::JSONInputArchive &ar);
|
||||
void performOutputingSchema(std::ostream &, int);
|
||||
|
||||
private:
|
||||
std::vector<std::string> ipv4_addresses;
|
||||
std::vector<std::string> ipv6_addresses;
|
||||
std::vector<IpAddressRange> ipv4_address_ranges;
|
||||
std::vector<IpAddressRange> ipv6_address_ranges;
|
||||
};
|
||||
|
||||
class Invalidation
|
||||
{
|
||||
public:
|
||||
@@ -60,14 +105,14 @@ public:
|
||||
|
||||
Invalidation & setClassifier(ClassifierType type, const std::string &val);
|
||||
Invalidation & addMainAttr(const StrAttributes &attr);
|
||||
Invalidation & addAttr(const StrAttributes &attr);
|
||||
Invalidation & addAttr(const IpAttributes &attr);
|
||||
Invalidation & setSourceId(const std::string &id);
|
||||
Invalidation & setObjectType(ObjectType type);
|
||||
Invalidation & setInvalidationType(InvalidationType type);
|
||||
|
||||
std::string getClassifier(ClassifierType type) const { return classifiers[type]; }
|
||||
std::vector<StrAttributes> getMainAttributes() const { return main_attributes; }
|
||||
std::vector<StrAttributes> getAttributes() const { return attributes; }
|
||||
std::vector<IpAttributes> getAttributes() const { return attributes; }
|
||||
const Maybe<std::string, void> & getSourceId() const { return source_id; }
|
||||
const Maybe<ObjectType, void> & getObjectType() const { return object_type; }
|
||||
const Maybe<InvalidationType, void> & getInvalidationType() const { return invalidation_type; }
|
||||
@@ -86,10 +131,11 @@ public:
|
||||
|
||||
private:
|
||||
bool attr_matches(const std::vector<StrAttributes> ¤t, const std::vector<StrAttributes> &other) const;
|
||||
bool attr_matches(const std::vector<IpAttributes> ¤t, const std::vector<IpAttributes> &other) const;
|
||||
|
||||
EnumArray<ClassifierType, std::string, 6> classifiers;
|
||||
std::vector<StrAttributes> main_attributes;
|
||||
std::vector<StrAttributes> attributes;
|
||||
std::vector<IpAttributes> attributes;
|
||||
Maybe<std::string, void> source_id;
|
||||
Maybe<ObjectType, void> object_type;
|
||||
Maybe<InvalidationType, void> invalidation_type;
|
||||
|
Reference in New Issue
Block a user