Adds partial support to UpdateActionById

This commit is contained in:
Felipe Zimmerle
2018-09-26 15:57:02 -03:00
parent 68398a51f3
commit 74841779f8
16 changed files with 922 additions and 712 deletions

View File

@@ -41,7 +41,7 @@ bool DetectSQLi::evaluate(Transaction *t, Rule *rule,
input + "'");
#endif
if (rule && t
&& rule->getActionsByName("capture").size() > 0) {
&& rule->getActionsByName("capture", t).size() > 0) {
t->m_collections.m_tx_collection->storeOrUpdateFirst(
"0", std::string(fingerprint));
#ifndef NO_LOGS

View File

@@ -37,7 +37,7 @@ bool DetectXSS::evaluate(Transaction *t, Rule *rule,
t->debug(5, "detected XSS using libinjection.");
#endif
if (rule && t
&& rule->getActionsByName("capture").size() > 0) {
&& rule->getActionsByName("capture", t).size() > 0) {
t->m_collections.m_tx_collection->storeOrUpdateFirst(
"0", std::string(input));
#ifndef NO_LOGS

View File

@@ -96,7 +96,8 @@ bool Pm::evaluate(Transaction *transaction, Rule *rule,
#ifdef MODSEC_MUTEX_ON_PM
pthread_mutex_unlock(&m_lock);
#endif
bool capture = rule && rule->getActionsByName("capture").size() > 0;
bool capture = rule && rule->getActionsByName("capture",
transaction).size() > 0;
if (rc > 0 && transaction) {
std::string match_(match);

View File

@@ -223,7 +223,7 @@ bool Rbl::evaluate(Transaction *t, Rule *rule,
freeaddrinfo(info);
if (rule && t
&& rule->getActionsByName("capture").size() > 0) {
&& rule->getActionsByName("capture", t).size() > 0) {
t->m_collections.m_tx_collection->storeOrUpdateFirst(
"0", std::string(ipStr));
#ifndef NO_LOGS

View File

@@ -54,7 +54,8 @@ bool Rx::evaluate(Transaction *transaction, Rule *rule,
}
matches = re->searchAll(input);
if (rule && rule->getActionsByName("capture").size() > 0 && transaction) {
if (rule && rule->getActionsByName("capture",
transaction).size() > 0 && transaction) {
int i = 0;
matches.reverse();
for (const SMatch& a : matches) {

View File

@@ -143,7 +143,7 @@ bool VerifyCC::evaluate(Transaction *t, Rule *rule,
if (is_cc) {
if (t) {
if (rule && t
&& rule->getActionsByName("capture").size() > 0) {
&& rule->getActionsByName("capture", t).size() > 0) {
t->m_collections.m_tx_collection->storeOrUpdateFirst(
"0", std::string(match));
#ifndef NO_LOGS

View File

@@ -134,7 +134,7 @@ bool VerifyCPF::evaluate(Transaction *t, Rule *rule,
if (is_cpf) {
logOffset(ruleMessage, i.m_offset, i.m_length);
if (rule && t
&& rule->getActionsByName("capture").size() > 0) {
&& rule->getActionsByName("capture", t).size() > 0) {
t->m_collections.m_tx_collection->storeOrUpdateFirst(
"0", std::string(i.match));
#ifndef NO_LOGS

View File

@@ -125,7 +125,7 @@ bool VerifySSN::evaluate(Transaction *t, Rule *rule,
if (is_ssn) {
logOffset(ruleMessage, i.m_offset, i.m_length);
if (rule && t
&& rule->getActionsByName("capture").size() > 0) {
&& rule->getActionsByName("capture", t).size() > 0) {
t->m_collections.m_tx_collection->storeOrUpdateFirst(
"0", std::string(i.match));
#ifndef NO_LOGS