Adds t:none transformation

This commit is contained in:
Felipe Zimmerle
2015-08-05 23:53:53 -03:00
parent 522f195aa0
commit 4308ee0280
4 changed files with 148 additions and 17 deletions

View File

@@ -25,7 +25,8 @@
#include "operators/operator.h"
#include "actions/action.h"
#include "../headers/modsecurity/modsecurity.h"
#include "modsecurity/modsecurity.h"
#include "actions/transformations/none.h"
namespace ModSecurity {
@@ -33,6 +34,7 @@ namespace ModSecurity {
using operators::Operator;
using actions::Action;
using Variables::Variable;
using actions::transformations::None;
Rule::~Rule() {
delete op;
@@ -115,13 +117,25 @@ bool Rule::evaluate(Assay *assay) {
for (auto &v : e) {
std::string value = v.second;
for (Action *a :
this->actions_runtime_pre) {
value = a->evaluate(value, assay);
assay->debug(9, " T (" + \
std::to_string(transformations) + ") " + \
a->name + ": \"" + value +"\"");
transformations++;
int none = 0;
for (Action *a : this->actions_runtime_pre) {
None *z = dynamic_cast<None *>(a);
if (z != NULL) {
none++;
}
}
for (Action *a : this->actions_runtime_pre) {
None *z = dynamic_cast<None *>(a);
if (none == 0) {
value = a->evaluate(value, assay);
assay->debug(9, " T (" + \
std::to_string(transformations) + ") " + \
a->name + ": \"" + value +"\"");
transformations++;
}
if (z != NULL) {
none--;
}
}
assay->debug(9, "Target value: \"" + value + "\" (Variable: " + \