mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 19:24:29 +03:00
Adds variable TX and action "capture".
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include <iterator>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
|
||||
#include "operators/operator.h"
|
||||
#include "utils/acmp.h"
|
||||
@@ -68,7 +69,7 @@ bool Pm::evaluate(Assay *assay, const std::string &input) {
|
||||
|
||||
rc = acmp_process_quick(&pt, &match, input.c_str(), input.length());
|
||||
if (rc == 1) {
|
||||
// save into tx, etc...
|
||||
this->matched.push_back(std::string(match));
|
||||
}
|
||||
|
||||
return rc == 1;
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#define SRC_OPERATORS_PM_H_
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
|
||||
#include "operators/operator.h"
|
||||
#include "utils/acmp.h"
|
||||
@@ -40,6 +41,7 @@ class Pm : public Operator {
|
||||
virtual bool init(const char **error);
|
||||
void postOrderTraversal(acmp_btree_node_t *node);
|
||||
|
||||
std::list<std::string> matched;
|
||||
protected:
|
||||
ACMP *m_p;
|
||||
};
|
||||
|
@@ -16,6 +16,7 @@
|
||||
#include "operators/rx.h"
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
|
||||
#include "operators/operator.h"
|
||||
|
||||
@@ -27,6 +28,7 @@ bool Rx::evaluate(Assay *assay, const std::string& input) {
|
||||
SMatch match;
|
||||
|
||||
if (regex_search(input, &match, m_re) && match.size() >= 1) {
|
||||
this->matched.push_back(match.match);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#define SRC_OPERATORS_RX_H_
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
|
||||
#include "operators/operator.h"
|
||||
#include "utils/regex.h"
|
||||
@@ -38,6 +39,8 @@ class Rx : public Operator {
|
||||
m_re(param) { }
|
||||
|
||||
bool evaluate(Assay *assay, const std::string &input);
|
||||
|
||||
std::list<std::string> matched;
|
||||
private:
|
||||
Regex m_re;
|
||||
};
|
||||
|
Reference in New Issue
Block a user