mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-10-01 03:57:47 +03:00
Having a better organization for Variables::
This commit is contained in:
@@ -29,51 +29,7 @@ namespace modsecurity {
|
||||
class Transaction;
|
||||
namespace Variables {
|
||||
|
||||
class Args_DictElement : public Variable {
|
||||
public:
|
||||
explicit Args_DictElement(std::string dictElement)
|
||||
: Variable("ARGS" + std::string(":") + std::string(dictElement)),
|
||||
m_dictElement(dictElement) { }
|
||||
|
||||
void evaluate(Transaction *transaction,
|
||||
Rule *rule,
|
||||
std::vector<const VariableValue *> *l) override {
|
||||
transaction->m_variableArgs.resolve(m_dictElement, l);
|
||||
}
|
||||
|
||||
std::string m_dictElement;
|
||||
};
|
||||
|
||||
|
||||
class Args_NoDictElement : public Variable {
|
||||
public:
|
||||
Args_NoDictElement()
|
||||
: Variable("ARGS") { }
|
||||
|
||||
void evaluate(Transaction *transaction,
|
||||
Rule *rule,
|
||||
std::vector<const VariableValue *> *l) override {
|
||||
transaction->m_variableArgs.resolve(l, m_keyExclusion);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class Args_DictElementRegexp : public Variable {
|
||||
public:
|
||||
explicit Args_DictElementRegexp(std::string dictElement)
|
||||
: Variable("ARGS:regex(" + dictElement + ")"),
|
||||
m_r(dictElement) {
|
||||
}
|
||||
|
||||
void evaluate(Transaction *transaction,
|
||||
Rule *rule,
|
||||
std::vector<const VariableValue *> *l) override {
|
||||
transaction->m_variableArgs.resolveRegularExpression(&m_r, l,
|
||||
m_keyExclusion);
|
||||
}
|
||||
|
||||
Utils::Regex m_r;
|
||||
};
|
||||
DEFINE_VARIABLE_DICT(Args, ARGS, m_variableArgs)
|
||||
|
||||
|
||||
} // namespace Variables
|
||||
|
Reference in New Issue
Block a user