diff --git a/headers/modsecurity/actions/action.h b/headers/modsecurity/actions/action.h index bd348aec..4d08a54b 100644 --- a/headers/modsecurity/actions/action.h +++ b/headers/modsecurity/actions/action.h @@ -47,7 +47,7 @@ class Action { m_parser_payload("") { set_name_and_payload(_action); } - explicit Action(const std::string& _action, int kind) + Action(const std::string& _action, int kind) : m_isNone(false), temporaryAction(false), action_kind(kind), @@ -65,12 +65,12 @@ class Action { virtual ~Action() { } - virtual std::string evaluate(const std::string &exp, + virtual std::string execute(const std::string &exp, Transaction *transaction); - virtual bool evaluate(RuleWithActions *rule, Transaction *transaction); - virtual bool evaluate(RuleWithActions *rule, Transaction *transaction, + virtual bool execute(RuleWithActions *rule, Transaction *transaction); + virtual bool execute(RuleWithActions *rule, Transaction *transaction, RuleMessage &ruleMessage) { - return evaluate(rule, transaction); + return execute(rule, transaction); } virtual bool init(std::string *error) { return true; } virtual bool isDisruptive() { return false; } diff --git a/src/actions/accuracy.cc b/src/actions/accuracy.cc index 7db62c21..7fcd44bc 100644 --- a/src/actions/accuracy.cc +++ b/src/actions/accuracy.cc @@ -39,7 +39,8 @@ bool Accuracy::init(std::string *error) { } -bool Accuracy::evaluate(RuleWithActions *rule, Transaction *transaction) { +bool Accuracy::execute(RuleWithActions *rule, Transaction *transaction) { + rule->setAccuracy(m_accuracy); return true; } diff --git a/src/actions/accuracy.h b/src/actions/accuracy.h index 179f4d7d..03279610 100644 --- a/src/actions/accuracy.h +++ b/src/actions/accuracy.h @@ -33,7 +33,7 @@ class Accuracy : public Action { : Action(action, ConfigurationKind), m_accuracy(0) { } - bool evaluate(RuleWithActions *rule, Transaction *transaction) override; + bool execute(RuleWithActions *rule, Transaction *transaction) override; bool init(std::string *error) override; int getAccuracy() const { return m_accuracy; } diff --git a/src/actions/action.cc b/src/actions/action.cc index 8a2409d1..51621cab 100644 --- a/src/actions/action.cc +++ b/src/actions/action.cc @@ -45,13 +45,13 @@ namespace modsecurity { namespace actions { -std::string Action::evaluate(const std::string &value, +std::string Action::execute(const std::string &value, Transaction *transaction) { return value; } -bool Action::evaluate(RuleWithActions *rule, Transaction *transaction) { +bool Action::execute(RuleWithActions *rule, Transaction *transaction) { return true; } diff --git a/src/actions/audit_log.cc b/src/actions/audit_log.cc index 4588d960..91dbc408 100644 --- a/src/actions/audit_log.cc +++ b/src/actions/audit_log.cc @@ -27,7 +27,7 @@ namespace modsecurity { namespace actions { -bool AuditLog::evaluate(RuleWithActions *rule, Transaction *transaction, +bool AuditLog::execute(RuleWithActions *rule, Transaction *transaction, RuleMessage &rm) { transaction->messageSetNoAuditLog(false); return true; diff --git a/src/actions/audit_log.h b/src/actions/audit_log.h index bc314219..9a5093ca 100644 --- a/src/actions/audit_log.h +++ b/src/actions/audit_log.h @@ -35,7 +35,7 @@ class AuditLog : public Action { explicit AuditLog(const std::string &action) : Action(action, RunTimeOnlyIfMatchKind) { } - bool evaluate(RuleWithActions *rule, Transaction *transaction, + bool execute(RuleWithActions *rule, Transaction *transaction, RuleMessage &rm) override; }; diff --git a/src/actions/block.cc b/src/actions/block.cc index 25a9a403..74d1d757 100644 --- a/src/actions/block.cc +++ b/src/actions/block.cc @@ -29,7 +29,7 @@ namespace modsecurity { namespace actions { -bool Block::evaluate(RuleWithActions *rule, Transaction *transaction, +bool Block::execute(RuleWithActions *rule, Transaction *transaction, RuleMessage &rm) { ms_dbg_a(transaction, 8, "Marking request as disruptive."); return true; diff --git a/src/actions/block.h b/src/actions/block.h index e1a856dd..11acac54 100644 --- a/src/actions/block.h +++ b/src/actions/block.h @@ -35,7 +35,7 @@ class Block : public Action { public: explicit Block(const std::string &action) : Action(action) { } - bool evaluate(RuleWithActions *rule, Transaction *transaction, + bool execute(RuleWithActions *rule, Transaction *transaction, RuleMessage &rm) override; }; diff --git a/src/actions/capture.cc b/src/actions/capture.cc index 966b240d..dd164f28 100644 --- a/src/actions/capture.cc +++ b/src/actions/capture.cc @@ -32,7 +32,7 @@ namespace modsecurity { namespace actions { -bool Capture::evaluate(RuleWithActions *rule, Transaction *transaction) { +bool Capture::execute(RuleWithActions *rule, Transaction *transaction) { return true; } diff --git a/src/actions/capture.h b/src/actions/capture.h index 841d1ecb..cbc2369e 100644 --- a/src/actions/capture.h +++ b/src/actions/capture.h @@ -31,7 +31,7 @@ class Capture : public Action { explicit Capture(const std::string &action) : Action(action, RunTimeOnlyIfMatchKind) { } - bool evaluate(RuleWithActions *rule, Transaction *transaction) override; + bool execute(RuleWithActions *rule, Transaction *transaction) override; }; diff --git a/src/actions/chain.cc b/src/actions/chain.cc index 8b230dde..bcd27a74 100644 --- a/src/actions/chain.cc +++ b/src/actions/chain.cc @@ -25,7 +25,7 @@ namespace modsecurity { namespace actions { -bool Chain::evaluate(RuleWithActions *rule, Transaction *transaction) { +bool Chain::execute(RuleWithActions *rule, Transaction *transaction) { rule->setHasChainAction(true); return true; } diff --git a/src/actions/chain.h b/src/actions/chain.h index 6a1532d2..cafb64f2 100644 --- a/src/actions/chain.h +++ b/src/actions/chain.h @@ -35,7 +35,7 @@ class Chain : public Action { explicit Chain(const std::string &action) : Action(action, ConfigurationKind) { } - bool evaluate(RuleWithActions *rule, Transaction *transaction) override; + bool execute(RuleWithActions *rule, Transaction *transaction) override; }; } // namespace actions diff --git a/src/actions/ctl/audit_log_parts.cc b/src/actions/ctl/audit_log_parts.cc index 2a8d7f01..cfe62638 100644 --- a/src/actions/ctl/audit_log_parts.cc +++ b/src/actions/ctl/audit_log_parts.cc @@ -38,7 +38,7 @@ bool AuditLogParts::init(std::string *error) { return true; } -bool AuditLogParts::evaluate(RuleWithActions *rule, Transaction *transaction) { +bool AuditLogParts::execute(RuleWithActions *rule, Transaction *transaction) { transaction->m_auditLogModifier.push_back( std::make_pair(mPartsAction, mParts)); return true; diff --git a/src/actions/ctl/audit_log_parts.h b/src/actions/ctl/audit_log_parts.h index 6638fa0f..ea9572ae 100644 --- a/src/actions/ctl/audit_log_parts.h +++ b/src/actions/ctl/audit_log_parts.h @@ -33,7 +33,7 @@ class AuditLogParts : public Action { mPartsAction(0), mParts("") { } - bool evaluate(RuleWithActions *rule, Transaction *transaction) override; + bool execute(RuleWithActions *rule, Transaction *transaction) override; bool init(std::string *error) override; protected: diff --git a/src/actions/ctl/request_body_access.cc b/src/actions/ctl/request_body_access.cc index 5f7edc25..8634deb5 100644 --- a/src/actions/ctl/request_body_access.cc +++ b/src/actions/ctl/request_body_access.cc @@ -42,7 +42,7 @@ bool RequestBodyAccess::init(std::string *error) { return true; } -bool RequestBodyAccess::evaluate(RuleWithActions *rule, Transaction *transaction) { +bool RequestBodyAccess::execute(RuleWithActions *rule, Transaction *transaction) { if (m_request_body_access) { transaction->m_requestBodyAccess = RulesSetProperties::TrueConfigBoolean; } else { diff --git a/src/actions/ctl/request_body_access.h b/src/actions/ctl/request_body_access.h index 4bbd8f68..ddc5e20f 100644 --- a/src/actions/ctl/request_body_access.h +++ b/src/actions/ctl/request_body_access.h @@ -34,7 +34,7 @@ class RequestBodyAccess : public Action { m_request_body_access(false) { } bool init(std::string *error) override; - bool evaluate(RuleWithActions *rule, Transaction *transaction) override; + bool execute(RuleWithActions *rule, Transaction *transaction) override; bool m_request_body_access; }; diff --git a/src/actions/ctl/request_body_processor_json.cc b/src/actions/ctl/request_body_processor_json.cc index a80c4ede..14d7fa8a 100644 --- a/src/actions/ctl/request_body_processor_json.cc +++ b/src/actions/ctl/request_body_processor_json.cc @@ -25,7 +25,7 @@ namespace actions { namespace ctl { -bool RequestBodyProcessorJSON::evaluate(RuleWithActions *rule, +bool RequestBodyProcessorJSON::execute(RuleWithActions *rule, Transaction *transaction) { transaction->m_requestBodyProcessor = Transaction::JSONRequestBody; transaction->m_variableReqbodyProcessor.set("JSON", diff --git a/src/actions/ctl/request_body_processor_json.h b/src/actions/ctl/request_body_processor_json.h index 42a63723..846eb89b 100644 --- a/src/actions/ctl/request_body_processor_json.h +++ b/src/actions/ctl/request_body_processor_json.h @@ -31,7 +31,7 @@ class RequestBodyProcessorJSON : public Action { explicit RequestBodyProcessorJSON(const std::string &action) : Action(action, RunTimeOnlyIfMatchKind) { } - bool evaluate(RuleWithActions *rule, Transaction *transaction) override; + bool execute(RuleWithActions *rule, Transaction *transaction) override; }; diff --git a/src/actions/ctl/request_body_processor_urlencoded.cc b/src/actions/ctl/request_body_processor_urlencoded.cc index 222970e7..433a9530 100644 --- a/src/actions/ctl/request_body_processor_urlencoded.cc +++ b/src/actions/ctl/request_body_processor_urlencoded.cc @@ -25,7 +25,7 @@ namespace actions { namespace ctl { -bool RequestBodyProcessorURLENCODED::evaluate(RuleWithActions *rule, +bool RequestBodyProcessorURLENCODED::execute(RuleWithActions *rule, Transaction *transaction) { transaction->m_requestBodyType = Transaction::WWWFormUrlEncoded; transaction->m_variableReqbodyProcessor.set("URLENCODED", diff --git a/src/actions/ctl/request_body_processor_urlencoded.h b/src/actions/ctl/request_body_processor_urlencoded.h index 05648815..e437961e 100644 --- a/src/actions/ctl/request_body_processor_urlencoded.h +++ b/src/actions/ctl/request_body_processor_urlencoded.h @@ -31,7 +31,7 @@ class RequestBodyProcessorURLENCODED : public Action { explicit RequestBodyProcessorURLENCODED(const std::string &action) : Action(action, RunTimeOnlyIfMatchKind) { } - bool evaluate(RuleWithActions *rule, Transaction *transaction) override; + bool execute(RuleWithActions *rule, Transaction *transaction) override; }; diff --git a/src/actions/ctl/request_body_processor_xml.cc b/src/actions/ctl/request_body_processor_xml.cc index 4876c20b..d2a32d38 100644 --- a/src/actions/ctl/request_body_processor_xml.cc +++ b/src/actions/ctl/request_body_processor_xml.cc @@ -25,7 +25,7 @@ namespace actions { namespace ctl { -bool RequestBodyProcessorXML::evaluate(RuleWithActions *rule, +bool RequestBodyProcessorXML::execute(RuleWithActions *rule, Transaction *transaction) { transaction->m_requestBodyProcessor = Transaction::XMLRequestBody; transaction->m_variableReqbodyProcessor.set("XML", diff --git a/src/actions/ctl/request_body_processor_xml.h b/src/actions/ctl/request_body_processor_xml.h index 509c0f74..0d1b678c 100644 --- a/src/actions/ctl/request_body_processor_xml.h +++ b/src/actions/ctl/request_body_processor_xml.h @@ -31,7 +31,7 @@ class RequestBodyProcessorXML : public Action { explicit RequestBodyProcessorXML(const std::string &action) : Action(action, RunTimeOnlyIfMatchKind) { } - bool evaluate(RuleWithActions *rule, Transaction *transaction) override; + bool execute(RuleWithActions *rule, Transaction *transaction) override; }; diff --git a/src/actions/ctl/rule_engine.cc b/src/actions/ctl/rule_engine.cc index 10f1b2e8..54e58159 100644 --- a/src/actions/ctl/rule_engine.cc +++ b/src/actions/ctl/rule_engine.cc @@ -45,7 +45,7 @@ bool RuleEngine::init(std::string *error) { return true; } -bool RuleEngine::evaluate(RuleWithActions *rule, Transaction *transaction) { +bool RuleEngine::execute(RuleWithActions *rule, Transaction *transaction) { std::stringstream a; a << "Setting SecRuleEngine to "; a << modsecurity::RulesSetProperties::ruleEngineStateString(m_ruleEngine); diff --git a/src/actions/ctl/rule_engine.h b/src/actions/ctl/rule_engine.h index 304389bd..a95be7eb 100644 --- a/src/actions/ctl/rule_engine.h +++ b/src/actions/ctl/rule_engine.h @@ -35,7 +35,7 @@ class RuleEngine : public Action { m_ruleEngine(RulesSetProperties::PropertyNotSetRuleEngine) { } bool init(std::string *error) override; - bool evaluate(RuleWithActions *rule, Transaction *transaction) override; + bool execute(RuleWithActions *rule, Transaction *transaction) override; RulesSetProperties::RuleEngine m_ruleEngine; }; diff --git a/src/actions/ctl/rule_remove_by_id.cc b/src/actions/ctl/rule_remove_by_id.cc index 431a7a9c..43382733 100644 --- a/src/actions/ctl/rule_remove_by_id.cc +++ b/src/actions/ctl/rule_remove_by_id.cc @@ -83,7 +83,7 @@ bool RuleRemoveById::init(std::string *error) { return false; } -bool RuleRemoveById::evaluate(RuleWithActions *rule, Transaction *transaction) { +bool RuleRemoveById::execute(RuleWithActions *rule, Transaction *transaction) { for (auto &i : m_ids) { transaction->m_ruleRemoveById.push_back(i); } diff --git a/src/actions/ctl/rule_remove_by_id.h b/src/actions/ctl/rule_remove_by_id.h index 7af416a6..56ef7f41 100644 --- a/src/actions/ctl/rule_remove_by_id.h +++ b/src/actions/ctl/rule_remove_by_id.h @@ -33,7 +33,7 @@ class RuleRemoveById : public Action { : Action(action, RunTimeOnlyIfMatchKind) { } bool init(std::string *error) override; - bool evaluate(RuleWithActions *rule, Transaction *transaction) override; + bool execute(RuleWithActions *rule, Transaction *transaction) override; std::list > m_ranges; std::list m_ids; diff --git a/src/actions/ctl/rule_remove_by_tag.cc b/src/actions/ctl/rule_remove_by_tag.cc index c6c9ffe0..44ea217a 100644 --- a/src/actions/ctl/rule_remove_by_tag.cc +++ b/src/actions/ctl/rule_remove_by_tag.cc @@ -32,7 +32,7 @@ bool RuleRemoveByTag::init(std::string *error) { return true; } -bool RuleRemoveByTag::evaluate(RuleWithActions *rule, Transaction *transaction) { +bool RuleRemoveByTag::execute(RuleWithActions *rule, Transaction *transaction) { transaction->m_ruleRemoveByTag.push_back(m_tag); return true; } diff --git a/src/actions/ctl/rule_remove_by_tag.h b/src/actions/ctl/rule_remove_by_tag.h index bd38ec03..4d072bc6 100644 --- a/src/actions/ctl/rule_remove_by_tag.h +++ b/src/actions/ctl/rule_remove_by_tag.h @@ -34,7 +34,7 @@ class RuleRemoveByTag : public Action { m_tag("") { } bool init(std::string *error) override; - bool evaluate(RuleWithActions *rule, Transaction *transaction) override; + bool execute(RuleWithActions *rule, Transaction *transaction) override; std::string m_tag; }; diff --git a/src/actions/ctl/rule_remove_target_by_id.cc b/src/actions/ctl/rule_remove_target_by_id.cc index 233a0ae0..e82257f2 100644 --- a/src/actions/ctl/rule_remove_target_by_id.cc +++ b/src/actions/ctl/rule_remove_target_by_id.cc @@ -51,7 +51,7 @@ bool RuleRemoveTargetById::init(std::string *error) { return true; } -bool RuleRemoveTargetById::evaluate(RuleWithActions *rule, Transaction *transaction) { +bool RuleRemoveTargetById::execute(RuleWithActions *rule, Transaction *transaction) { transaction->m_ruleRemoveTargetById.push_back( std::make_pair(m_id, m_target)); return true; diff --git a/src/actions/ctl/rule_remove_target_by_id.h b/src/actions/ctl/rule_remove_target_by_id.h index e001c288..6e8b927c 100644 --- a/src/actions/ctl/rule_remove_target_by_id.h +++ b/src/actions/ctl/rule_remove_target_by_id.h @@ -35,7 +35,7 @@ class RuleRemoveTargetById : public Action { m_target("") { } bool init(std::string *error) override; - bool evaluate(RuleWithActions *rule, Transaction *transaction) override; + bool execute(RuleWithActions *rule, Transaction *transaction) override; int m_id; std::string m_target; diff --git a/src/actions/ctl/rule_remove_target_by_tag.cc b/src/actions/ctl/rule_remove_target_by_tag.cc index 25ec2ca8..57ebd4bc 100644 --- a/src/actions/ctl/rule_remove_target_by_tag.cc +++ b/src/actions/ctl/rule_remove_target_by_tag.cc @@ -44,7 +44,7 @@ bool RuleRemoveTargetByTag::init(std::string *error) { return true; } -bool RuleRemoveTargetByTag::evaluate(RuleWithActions *rule, Transaction *transaction) { +bool RuleRemoveTargetByTag::execute(RuleWithActions *rule, Transaction *transaction) { transaction->m_ruleRemoveTargetByTag.push_back( std::make_pair(m_tag, m_target)); return true; diff --git a/src/actions/ctl/rule_remove_target_by_tag.h b/src/actions/ctl/rule_remove_target_by_tag.h index 2a23a34e..0d8a7aa4 100644 --- a/src/actions/ctl/rule_remove_target_by_tag.h +++ b/src/actions/ctl/rule_remove_target_by_tag.h @@ -33,7 +33,7 @@ class RuleRemoveTargetByTag : public Action { : Action(action, RunTimeOnlyIfMatchKind) { } bool init(std::string *error) override; - bool evaluate(RuleWithActions *rule, Transaction *transaction) override; + bool execute(RuleWithActions *rule, Transaction *transaction) override; std::string m_tag; std::string m_target; diff --git a/src/actions/data/status.cc b/src/actions/data/status.cc index 187be4a2..fdc043a3 100644 --- a/src/actions/data/status.cc +++ b/src/actions/data/status.cc @@ -38,7 +38,7 @@ bool Status::init(std::string *error) { } -bool Status::evaluate(RuleWithActions *rule, Transaction *transaction, +bool Status::execute(RuleWithActions *rule, Transaction *transaction, RuleMessage &rm) { transaction->m_it.status = m_status; return true; diff --git a/src/actions/data/status.h b/src/actions/data/status.h index 3fd5293c..34840062 100644 --- a/src/actions/data/status.h +++ b/src/actions/data/status.h @@ -37,7 +37,7 @@ class Status : public Action { m_status(0) { } bool init(std::string *error) override; - bool evaluate(RuleWithActions *rule, Transaction *transaction, + bool execute(RuleWithActions *rule, Transaction *transaction, RuleMessage &rm) override; int m_status; diff --git a/src/actions/disruptive/allow.cc b/src/actions/disruptive/allow.cc index 3a360b55..ae22ddbf 100644 --- a/src/actions/disruptive/allow.cc +++ b/src/actions/disruptive/allow.cc @@ -49,7 +49,7 @@ bool Allow::init(std::string *error) { } -bool Allow::evaluate(RuleWithActions *rule, Transaction *transaction) { +bool Allow::execute(RuleWithActions *rule, Transaction *transaction) { ms_dbg_a(transaction, 4, "Dropping the evaluation of upcoming rules " \ "in favor of an `allow' action of type: " \ + allowTypeToName(m_allowType)); diff --git a/src/actions/disruptive/allow.h b/src/actions/disruptive/allow.h index de79b205..49776066 100644 --- a/src/actions/disruptive/allow.h +++ b/src/actions/disruptive/allow.h @@ -59,7 +59,7 @@ class Allow : public Action { bool init(std::string *error) override; - bool evaluate(RuleWithActions *rule, Transaction *transaction) override; + bool execute(RuleWithActions *rule, Transaction *transaction) override; bool isDisruptive() override { return true; } AllowType m_allowType; diff --git a/src/actions/disruptive/deny.cc b/src/actions/disruptive/deny.cc index 1376d285..450e699e 100644 --- a/src/actions/disruptive/deny.cc +++ b/src/actions/disruptive/deny.cc @@ -28,7 +28,7 @@ namespace actions { namespace disruptive { -bool Deny::evaluate(RuleWithActions *rule, Transaction *transaction, +bool Deny::execute(RuleWithActions *rule, Transaction *transaction, RuleMessage &rm) { ms_dbg_a(transaction, 8, "Running action deny"); diff --git a/src/actions/disruptive/deny.h b/src/actions/disruptive/deny.h index 085b7db7..44b7fb0f 100644 --- a/src/actions/disruptive/deny.h +++ b/src/actions/disruptive/deny.h @@ -33,7 +33,7 @@ class Deny : public Action { public: explicit Deny(const std::string &action) : Action(action) { } - bool evaluate(RuleWithActions *rule, Transaction *transaction, + bool execute(RuleWithActions *rule, Transaction *transaction, RuleMessage &rm) override; bool isDisruptive() override { return true; } }; diff --git a/src/actions/disruptive/drop.cc b/src/actions/disruptive/drop.cc index da7e2d75..f5e3ff0f 100644 --- a/src/actions/disruptive/drop.cc +++ b/src/actions/disruptive/drop.cc @@ -32,7 +32,7 @@ namespace actions { namespace disruptive { -bool Drop::evaluate(RuleWithActions *rule, Transaction *transaction, +bool Drop::execute(RuleWithActions *rule, Transaction *transaction, RuleMessage &rm) { ms_dbg_a(transaction, 8, "Running action drop " \ "[executing deny instead of drop.]"); diff --git a/src/actions/disruptive/drop.h b/src/actions/disruptive/drop.h index 66fe45f1..7c0e21b6 100644 --- a/src/actions/disruptive/drop.h +++ b/src/actions/disruptive/drop.h @@ -32,7 +32,7 @@ class Drop : public Action { public: explicit Drop(const std::string &action) : Action(action) { } - bool evaluate(RuleWithActions *rule, Transaction *transaction, + bool execute(RuleWithActions *rule, Transaction *transaction, RuleMessage &rm) override; bool isDisruptive() override { return true; } }; diff --git a/src/actions/disruptive/pass.cc b/src/actions/disruptive/pass.cc index 28b3bc94..c336b1f4 100644 --- a/src/actions/disruptive/pass.cc +++ b/src/actions/disruptive/pass.cc @@ -29,7 +29,7 @@ namespace actions { namespace disruptive { -bool Pass::evaluate(RuleWithActions *rule, Transaction *transaction, +bool Pass::execute(RuleWithActions *rule, Transaction *transaction, RuleMessage &rm) { intervention::free(&transaction->m_it); intervention::reset(&transaction->m_it); diff --git a/src/actions/disruptive/pass.h b/src/actions/disruptive/pass.h index 035cc24e..b005b063 100644 --- a/src/actions/disruptive/pass.h +++ b/src/actions/disruptive/pass.h @@ -31,7 +31,7 @@ class Pass : public Action { public: explicit Pass(const std::string &action) : Action(action) { } - bool evaluate(RuleWithActions *rule, Transaction *transaction, + bool execute(RuleWithActions *rule, Transaction *transaction, RuleMessage &rm) override; bool isDisruptive() override { return true; } }; diff --git a/src/actions/disruptive/redirect.cc b/src/actions/disruptive/redirect.cc index 0b0fc0dd..e098ac94 100644 --- a/src/actions/disruptive/redirect.cc +++ b/src/actions/disruptive/redirect.cc @@ -34,7 +34,7 @@ bool Redirect::init(std::string *error) { } -bool Redirect::evaluate(RuleWithActions *rule, Transaction *transaction, +bool Redirect::execute(RuleWithActions *rule, Transaction *transaction, RuleMessage &rm) { std::string m_urlExpanded(m_string->evaluate(transaction)); /* if it was changed before, lets keep it. */ diff --git a/src/actions/disruptive/redirect.h b/src/actions/disruptive/redirect.h index 8a2d9418..a8bba959 100644 --- a/src/actions/disruptive/redirect.h +++ b/src/actions/disruptive/redirect.h @@ -46,7 +46,7 @@ class Redirect : public Action { m_status(0), m_string(std::move(z)) { } - bool evaluate(RuleWithActions *rule, Transaction *transaction, + bool execute(RuleWithActions *rule, Transaction *transaction, RuleMessage &rm) override; bool init(std::string *error) override; bool isDisruptive() override { return true; } diff --git a/src/actions/exec.cc b/src/actions/exec.cc index 93cc5ff2..24b7f63d 100644 --- a/src/actions/exec.cc +++ b/src/actions/exec.cc @@ -49,7 +49,7 @@ bool Exec::init(std::string *error) { } -bool Exec::evaluate(RuleWithActions *rule, Transaction *t) { +bool Exec::execute(RuleWithActions *rule, Transaction *t) { ms_dbg_a(t, 8, "Running script... " + m_script); m_lua.run(t); return true; diff --git a/src/actions/exec.h b/src/actions/exec.h index 42537d03..cbe3f7b3 100644 --- a/src/actions/exec.h +++ b/src/actions/exec.h @@ -36,7 +36,7 @@ class Exec : public Action { ~Exec() { } - bool evaluate(RuleWithActions *rule, Transaction *transaction) override; + bool execute(RuleWithActions *rule, Transaction *transaction) override; bool init(std::string *error) override; private: diff --git a/src/actions/init_col.cc b/src/actions/init_col.cc index 24608450..4ac9dece 100644 --- a/src/actions/init_col.cc +++ b/src/actions/init_col.cc @@ -54,7 +54,7 @@ bool InitCol::init(std::string *error) { } -bool InitCol::evaluate(RuleWithActions *rule, Transaction *t) { +bool InitCol::execute(RuleWithActions *rule, Transaction *t) { std::string collectionName(m_string->evaluate(t)); if (m_collection_key == "ip") { diff --git a/src/actions/init_col.h b/src/actions/init_col.h index 0848561c..012baa7a 100644 --- a/src/actions/init_col.h +++ b/src/actions/init_col.h @@ -38,7 +38,7 @@ class InitCol : public Action { : Action(action, RunTimeOnlyIfMatchKind), m_string(std::move(z)) { } - bool evaluate(RuleWithActions *rule, Transaction *transaction) override; + bool execute(RuleWithActions *rule, Transaction *transaction) override; bool init(std::string *error) override; private: std::string m_collection_key; diff --git a/src/actions/log.cc b/src/actions/log.cc index 127c9c69..4907cf45 100644 --- a/src/actions/log.cc +++ b/src/actions/log.cc @@ -28,7 +28,7 @@ namespace modsecurity { namespace actions { -bool Log::evaluate(RuleWithActions *rule, Transaction *transaction, +bool Log::execute(RuleWithActions *rule, Transaction *transaction, RuleMessage &rm) { return true; } diff --git a/src/actions/log.h b/src/actions/log.h index d3496932..9d2ebb06 100644 --- a/src/actions/log.h +++ b/src/actions/log.h @@ -33,7 +33,7 @@ class Log : public Action { explicit Log(const std::string &action) : Action(action, RunTimeOnlyIfMatchKind) { } - bool evaluate(RuleWithActions *rule, Transaction *transaction, + bool execute(RuleWithActions *rule, Transaction *transaction, RuleMessage &rm) override; }; diff --git a/src/actions/log_data.cc b/src/actions/log_data.cc index a0fba217..70c52368 100644 --- a/src/actions/log_data.cc +++ b/src/actions/log_data.cc @@ -29,7 +29,7 @@ namespace modsecurity { namespace actions { -bool LogData::evaluate(RuleWithActions *rule, Transaction *transaction, +bool LogData::execute(RuleWithActions *rule, Transaction *transaction, RuleMessage &rm) { rm.m_data = data(transaction); diff --git a/src/actions/log_data.h b/src/actions/log_data.h index 13f015bb..6e458d89 100644 --- a/src/actions/log_data.h +++ b/src/actions/log_data.h @@ -39,7 +39,7 @@ class LogData : public Action { : Action("logdata", RunTimeOnlyIfMatchKind), m_string(std::move(z)) { } - bool evaluate(RuleWithActions *rule, Transaction *transaction, + bool execute(RuleWithActions *rule, Transaction *transaction, RuleMessage &rm) override; std::string data(Transaction *Transaction); diff --git a/src/actions/maturity.cc b/src/actions/maturity.cc index 921fedbc..33b78855 100644 --- a/src/actions/maturity.cc +++ b/src/actions/maturity.cc @@ -39,7 +39,7 @@ bool Maturity::init(std::string *error) { } -bool Maturity::evaluate(RuleWithActions *rule, Transaction *transaction) { +bool Maturity::execute(RuleWithActions *rule, Transaction *transaction) { return true; } diff --git a/src/actions/maturity.h b/src/actions/maturity.h index 38954d18..e66f14d5 100644 --- a/src/actions/maturity.h +++ b/src/actions/maturity.h @@ -33,7 +33,7 @@ class Maturity : public Action { : Action(action, ConfigurationKind), m_maturity(0) { } - bool evaluate(RuleWithActions *rule, Transaction *transaction) override; + bool execute(RuleWithActions *rule, Transaction *transaction) override; bool init(std::string *error) override; int getMaturity() const { return m_maturity; } diff --git a/src/actions/msg.cc b/src/actions/msg.cc index 20d1a202..f4d7dc75 100644 --- a/src/actions/msg.cc +++ b/src/actions/msg.cc @@ -46,7 +46,7 @@ namespace modsecurity { namespace actions { -bool Msg::evaluate(RuleWithActions *rule, Transaction *transaction, +bool Msg::execute(RuleWithActions *rule, Transaction *transaction, RuleMessage &rm) { std::string msg = data(transaction); rm.m_message = msg; diff --git a/src/actions/msg.h b/src/actions/msg.h index 6414c984..ecdc499b 100644 --- a/src/actions/msg.h +++ b/src/actions/msg.h @@ -40,7 +40,7 @@ class Msg : public Action { : Action("msg", RunTimeOnlyIfMatchKind), m_string(std::move(z)) { } - bool evaluate(RuleWithActions *rule, Transaction *transaction, + bool execute(RuleWithActions *rule, Transaction *transaction, RuleMessage &rm) override; std::string data(Transaction *Transaction); diff --git a/src/actions/multi_match.cc b/src/actions/multi_match.cc index 71189c2c..0956b7dc 100644 --- a/src/actions/multi_match.cc +++ b/src/actions/multi_match.cc @@ -25,7 +25,7 @@ namespace modsecurity { namespace actions { -bool MultiMatch::evaluate(RuleWithActions *rule, Transaction *transaction) { +bool MultiMatch::execute(RuleWithActions *rule, Transaction *transaction) { return true; } diff --git a/src/actions/multi_match.h b/src/actions/multi_match.h index abab94f8..1c62523a 100644 --- a/src/actions/multi_match.h +++ b/src/actions/multi_match.h @@ -35,7 +35,7 @@ class MultiMatch : public Action { explicit MultiMatch(const std::string &action) : Action(action, RunTimeOnlyIfMatchKind) { } - bool evaluate(RuleWithActions *rule, Transaction *transaction) override; + bool execute(RuleWithActions *rule, Transaction *transaction) override; }; } // namespace actions diff --git a/src/actions/no_audit_log.cc b/src/actions/no_audit_log.cc index 4db9f7ac..ed6b3bd7 100644 --- a/src/actions/no_audit_log.cc +++ b/src/actions/no_audit_log.cc @@ -26,7 +26,7 @@ namespace modsecurity { namespace actions { -bool NoAuditLog::evaluate(RuleWithActions *rule, Transaction *transaction, +bool NoAuditLog::execute(RuleWithActions *rule, Transaction *transaction, RuleMessage &rm) { transaction->messageSetNoAuditLog(true); return true; diff --git a/src/actions/no_audit_log.h b/src/actions/no_audit_log.h index 456b065e..3fc167a8 100644 --- a/src/actions/no_audit_log.h +++ b/src/actions/no_audit_log.h @@ -35,7 +35,7 @@ class NoAuditLog : public Action { explicit NoAuditLog(const std::string &action) : Action(action, RunTimeOnlyIfMatchKind) { } - bool evaluate(RuleWithActions *rule, Transaction *transaction, + bool execute(RuleWithActions *rule, Transaction *transaction, RuleMessage &rm) override; }; diff --git a/src/actions/no_log.cc b/src/actions/no_log.cc index 0346b16c..684c1eb6 100644 --- a/src/actions/no_log.cc +++ b/src/actions/no_log.cc @@ -29,7 +29,7 @@ namespace modsecurity { namespace actions { -bool NoLog::evaluate(RuleWithActions *rule, Transaction *transaction, +bool NoLog::execute(RuleWithActions *rule, Transaction *transaction, RuleMessage &rm) { return true; } diff --git a/src/actions/no_log.h b/src/actions/no_log.h index 97fdc9df..644fd8d1 100644 --- a/src/actions/no_log.h +++ b/src/actions/no_log.h @@ -33,7 +33,7 @@ class NoLog : public Action { explicit NoLog(const std::string &action) : Action(action, RunTimeOnlyIfMatchKind) { } - bool evaluate(RuleWithActions *rule, Transaction *transaction, + bool execute(RuleWithActions *rule, Transaction *transaction, RuleMessage &rm) override; }; diff --git a/src/actions/phase.cc b/src/actions/phase.cc index d82cbe02..3099592b 100644 --- a/src/actions/phase.cc +++ b/src/actions/phase.cc @@ -72,7 +72,7 @@ bool Phase::init(std::string *error) { } -bool Phase::evaluate(RuleWithActions *rule, Transaction *transaction) { +bool Phase::execute(RuleWithActions *rule, Transaction *transaction) { rule->setPhase(m_phase); return true; } diff --git a/src/actions/phase.h b/src/actions/phase.h index c85842e5..82942b76 100644 --- a/src/actions/phase.h +++ b/src/actions/phase.h @@ -37,7 +37,7 @@ class Phase : public Action { m_secRulesPhase(0) { } bool init(std::string *error) override; - bool evaluate(RuleWithActions *rule, Transaction *transaction) override; + bool execute(RuleWithActions *rule, Transaction *transaction) override; int m_phase; int m_secRulesPhase; diff --git a/src/actions/rev.cc b/src/actions/rev.cc index 418b04e9..86369ebb 100644 --- a/src/actions/rev.cc +++ b/src/actions/rev.cc @@ -33,7 +33,7 @@ bool Rev::init(std::string *error) { } -bool Rev::evaluate(RuleWithActions *rule, Transaction *transaction) { +bool Rev::execute(RuleWithActions *rule, Transaction *transaction) { return true; } diff --git a/src/actions/rev.h b/src/actions/rev.h index f39d4a10..ed8dbfdf 100644 --- a/src/actions/rev.h +++ b/src/actions/rev.h @@ -31,7 +31,7 @@ class Rev : public Action { public: explicit Rev(const std::string &action) : Action(action, ConfigurationKind) { } - bool evaluate(RuleWithActions *rule, Transaction *transaction) override; + bool execute(RuleWithActions *rule, Transaction *transaction) override; bool init(std::string *error) override; std::string getRevision() const { return m_rev; } diff --git a/src/actions/rule_id.cc b/src/actions/rule_id.cc index f083ebd5..7d68fe60 100644 --- a/src/actions/rule_id.cc +++ b/src/actions/rule_id.cc @@ -48,7 +48,7 @@ bool RuleId::init(std::string *error) { } -bool RuleId::evaluate(RuleWithActions *rule, Transaction *transaction) { +bool RuleId::execute(RuleWithActions *rule, Transaction *transaction) { rule->setId(m_ruleId); return true; } diff --git a/src/actions/rule_id.h b/src/actions/rule_id.h index 0a6b3807..74846f2d 100644 --- a/src/actions/rule_id.h +++ b/src/actions/rule_id.h @@ -37,7 +37,7 @@ class RuleId : public Action { m_ruleId(0) { } bool init(std::string *error) override; - bool evaluate(RuleWithActions *rule, Transaction *transaction) override; + bool execute(RuleWithActions *rule, Transaction *transaction) override; private: double m_ruleId; diff --git a/src/actions/set_env.cc b/src/actions/set_env.cc index 75419163..e5d080bb 100644 --- a/src/actions/set_env.cc +++ b/src/actions/set_env.cc @@ -31,7 +31,7 @@ bool SetENV::init(std::string *error) { } -bool SetENV::evaluate(RuleWithActions *rule, Transaction *t) { +bool SetENV::execute(RuleWithActions *rule, Transaction *t) { std::string colNameExpanded(m_string->evaluate(t)); ms_dbg_a(t, 8, "Setting envoriment variable: " diff --git a/src/actions/set_env.h b/src/actions/set_env.h index 57223873..72f3848e 100644 --- a/src/actions/set_env.h +++ b/src/actions/set_env.h @@ -39,7 +39,7 @@ class SetENV : public Action { : Action("setenv", RunTimeOnlyIfMatchKind), m_string(std::move(z)) { } - bool evaluate(RuleWithActions *rule, Transaction *transaction) override; + bool execute(RuleWithActions *rule, Transaction *transaction) override; bool init(std::string *error) override; private: diff --git a/src/actions/set_rsc.cc b/src/actions/set_rsc.cc index 34db37b2..6977a6db 100644 --- a/src/actions/set_rsc.cc +++ b/src/actions/set_rsc.cc @@ -31,7 +31,7 @@ bool SetRSC::init(std::string *error) { } -bool SetRSC::evaluate(RuleWithActions *rule, Transaction *t) { +bool SetRSC::execute(RuleWithActions *rule, Transaction *t) { std::string colNameExpanded(m_string->evaluate(t)); ms_dbg_a(t, 8, "RESOURCE initiated with value: \'" + colNameExpanded + "\'."); diff --git a/src/actions/set_rsc.h b/src/actions/set_rsc.h index fcf0e426..44cb4bfe 100644 --- a/src/actions/set_rsc.h +++ b/src/actions/set_rsc.h @@ -39,7 +39,7 @@ class SetRSC : public Action { : Action("setsrc", RunTimeOnlyIfMatchKind), m_string(std::move(z)) { } - bool evaluate(RuleWithActions *rule, Transaction *transaction) override; + bool execute(RuleWithActions *rule, Transaction *transaction) override; bool init(std::string *error) override; private: diff --git a/src/actions/set_sid.cc b/src/actions/set_sid.cc index e4c53111..f6da9cc8 100644 --- a/src/actions/set_sid.cc +++ b/src/actions/set_sid.cc @@ -31,7 +31,7 @@ bool SetSID::init(std::string *error) { } -bool SetSID::evaluate(RuleWithActions *rule, Transaction *t) { +bool SetSID::execute(RuleWithActions *rule, Transaction *t) { std::string colNameExpanded(m_string->evaluate(t)); ms_dbg_a(t, 8, "Session ID initiated with value: \'" + colNameExpanded + "\'."); diff --git a/src/actions/set_sid.h b/src/actions/set_sid.h index 612db849..41a2b652 100644 --- a/src/actions/set_sid.h +++ b/src/actions/set_sid.h @@ -39,7 +39,7 @@ class SetSID : public Action { : Action("setsid", RunTimeOnlyIfMatchKind), m_string(std::move(z)) { } - bool evaluate(RuleWithActions *rule, Transaction *transaction) override; + bool execute(RuleWithActions *rule, Transaction *transaction) override; bool init(std::string *error) override; private: diff --git a/src/actions/set_uid.cc b/src/actions/set_uid.cc index 90de7e47..dd89d1d7 100644 --- a/src/actions/set_uid.cc +++ b/src/actions/set_uid.cc @@ -31,7 +31,7 @@ bool SetUID::init(std::string *error) { } -bool SetUID::evaluate(RuleWithActions *rule, Transaction *t) { +bool SetUID::execute(RuleWithActions *rule, Transaction *t) { std::string colNameExpanded(m_string->evaluate(t)); ms_dbg_a(t, 8, "User collection initiated with value: \'" + colNameExpanded + "\'."); diff --git a/src/actions/set_uid.h b/src/actions/set_uid.h index f53bba54..bb5959b0 100644 --- a/src/actions/set_uid.h +++ b/src/actions/set_uid.h @@ -39,7 +39,7 @@ class SetUID : public Action { : Action("setuid", RunTimeOnlyIfMatchKind), m_string(std::move(z)) { } - bool evaluate(RuleWithActions *rule, Transaction *transaction) override; + bool execute(RuleWithActions *rule, Transaction *transaction) override; bool init(std::string *error) override; private: diff --git a/src/actions/set_var.cc b/src/actions/set_var.cc index c9f7f665..e97297e5 100644 --- a/src/actions/set_var.cc +++ b/src/actions/set_var.cc @@ -40,7 +40,7 @@ bool SetVar::init(std::string *error) { } -bool SetVar::evaluate(RuleWithActions *rule, Transaction *t) { +bool SetVar::execute(RuleWithActions *rule, Transaction *t) { std::string targetValue; std::string resolvedPre; diff --git a/src/actions/set_var.h b/src/actions/set_var.h index c64a0369..303ebeb7 100644 --- a/src/actions/set_var.h +++ b/src/actions/set_var.h @@ -58,7 +58,7 @@ class SetVar : public Action { m_operation(operation), m_variable(std::move(variable)) { } - bool evaluate(RuleWithActions *rule, Transaction *transaction) override; + bool execute(RuleWithActions *rule, Transaction *transaction) override; bool init(std::string *error) override; private: diff --git a/src/actions/severity.cc b/src/actions/severity.cc index a457bf67..30becd9b 100644 --- a/src/actions/severity.cc +++ b/src/actions/severity.cc @@ -71,7 +71,7 @@ bool Severity::init(std::string *error) { } -bool Severity::evaluate(RuleWithActions *rule, Transaction *transaction, +bool Severity::execute(RuleWithActions *rule, Transaction *transaction, RuleMessage &rm) { return true; } diff --git a/src/actions/severity.h b/src/actions/severity.h index 96ab3325..adf2d0e6 100644 --- a/src/actions/severity.h +++ b/src/actions/severity.h @@ -35,7 +35,7 @@ class Severity : public Action { : Action(action), m_severity(0) { } - bool evaluate(RuleWithActions *rule, Transaction *transaction, + bool execute(RuleWithActions *rule, Transaction *transaction, RuleMessage &rm) override; bool init(std::string *error) override; diff --git a/src/actions/skip.cc b/src/actions/skip.cc index 1f7d2081..8611dee3 100644 --- a/src/actions/skip.cc +++ b/src/actions/skip.cc @@ -38,7 +38,7 @@ bool Skip::init(std::string *error) { } -bool Skip::evaluate(RuleWithActions *rule, Transaction *transaction) { +bool Skip::execute(RuleWithActions *rule, Transaction *transaction) { ms_dbg_a(transaction, 5, "Skipping the next " + \ std::to_string(m_skip_next) + " rules."); diff --git a/src/actions/skip.h b/src/actions/skip.h index 97d2c50f..78bff450 100644 --- a/src/actions/skip.h +++ b/src/actions/skip.h @@ -34,7 +34,7 @@ class Skip : public Action { m_skip_next(0) { } bool init(std::string *error) override; - bool evaluate(RuleWithActions *rule, Transaction *transaction) override; + bool execute(RuleWithActions *rule, Transaction *transaction) override; int m_skip_next; }; diff --git a/src/actions/skip_after.cc b/src/actions/skip_after.cc index dce03d49..9e1bae39 100644 --- a/src/actions/skip_after.cc +++ b/src/actions/skip_after.cc @@ -27,7 +27,7 @@ namespace modsecurity { namespace actions { -bool SkipAfter::evaluate(RuleWithActions *rule, Transaction *transaction) { +bool SkipAfter::execute(RuleWithActions *rule, Transaction *transaction) { ms_dbg_a(transaction, 5, "Setting skipAfter for: " + *m_skipName); transaction->addMarker(m_skipName); return true; diff --git a/src/actions/skip_after.h b/src/actions/skip_after.h index 8a2148d8..c90c188b 100644 --- a/src/actions/skip_after.h +++ b/src/actions/skip_after.h @@ -34,7 +34,7 @@ class SkipAfter : public Action { : Action(action, RunTimeOnlyIfMatchKind), m_skipName(std::make_shared(m_parser_payload)) { } - bool evaluate(RuleWithActions *rule, Transaction *transaction) override; + bool execute(RuleWithActions *rule, Transaction *transaction) override; private: std::shared_ptr m_skipName; }; diff --git a/src/actions/tag.cc b/src/actions/tag.cc index f61c7ff8..f8be619f 100644 --- a/src/actions/tag.cc +++ b/src/actions/tag.cc @@ -56,7 +56,7 @@ std::string Tag::getName(Transaction *transaction) { } -bool Tag::evaluate(RuleWithActions *rule, Transaction *transaction, +bool Tag::execute(RuleWithActions *rule, Transaction *transaction, RuleMessage &rm) { std::string tag = getName(transaction); ms_dbg_a(transaction, 9, "Rule tag: " + tag); diff --git a/src/actions/tag.h b/src/actions/tag.h index 03c43331..5c7eda3e 100644 --- a/src/actions/tag.h +++ b/src/actions/tag.h @@ -38,7 +38,7 @@ class Tag : public Action { std::string getName(Transaction *transaction); - bool evaluate(RuleWithActions *rule, Transaction *transaction, + bool execute(RuleWithActions *rule, Transaction *transaction, RuleMessage &rm) override; protected: diff --git a/src/actions/transformations/base64_decode.cc b/src/actions/transformations/base64_decode.cc index e72fefea..e062439e 100644 --- a/src/actions/transformations/base64_decode.cc +++ b/src/actions/transformations/base64_decode.cc @@ -32,7 +32,7 @@ namespace actions { namespace transformations { -std::string Base64Decode::evaluate(const std::string &value, +std::string Base64Decode::execute(const std::string &value, Transaction *transaction) { std::string ret = Utils::Base64::decode(value); diff --git a/src/actions/transformations/base64_decode.h b/src/actions/transformations/base64_decode.h index 6676a99e..4354a5f2 100644 --- a/src/actions/transformations/base64_decode.h +++ b/src/actions/transformations/base64_decode.h @@ -32,7 +32,7 @@ class Base64Decode : public Transformation { public: explicit Base64Decode(const std::string &action) : Transformation(action) { } - std::string evaluate(const std::string &exp, + std::string execute(const std::string &exp, Transaction *transaction) override; }; diff --git a/src/actions/transformations/base64_decode_ext.cc b/src/actions/transformations/base64_decode_ext.cc index 3ea9887c..a03ab634 100644 --- a/src/actions/transformations/base64_decode_ext.cc +++ b/src/actions/transformations/base64_decode_ext.cc @@ -32,7 +32,7 @@ namespace actions { namespace transformations { -std::string Base64DecodeExt::evaluate(const std::string &value, +std::string Base64DecodeExt::execute(const std::string &value, Transaction *transaction) { std::string ret = Utils::Base64::decode_forgiven(value); diff --git a/src/actions/transformations/base64_decode_ext.h b/src/actions/transformations/base64_decode_ext.h index 595e31f2..30dcce3d 100644 --- a/src/actions/transformations/base64_decode_ext.h +++ b/src/actions/transformations/base64_decode_ext.h @@ -32,7 +32,7 @@ class Base64DecodeExt : public Transformation { public: explicit Base64DecodeExt(const std::string &action) : Transformation(action) { } - std::string evaluate(const std::string &exp, + std::string execute(const std::string &exp, Transaction *transaction) override; }; diff --git a/src/actions/transformations/base64_encode.cc b/src/actions/transformations/base64_encode.cc index ffc2465a..ed6f3860 100644 --- a/src/actions/transformations/base64_encode.cc +++ b/src/actions/transformations/base64_encode.cc @@ -32,7 +32,7 @@ namespace actions { namespace transformations { -std::string Base64Encode::evaluate(const std::string &value, +std::string Base64Encode::execute(const std::string &value, Transaction *transaction) { std::string ret = Utils::Base64::encode(value); diff --git a/src/actions/transformations/base64_encode.h b/src/actions/transformations/base64_encode.h index a5dfd0ba..9a3e0db1 100644 --- a/src/actions/transformations/base64_encode.h +++ b/src/actions/transformations/base64_encode.h @@ -32,7 +32,7 @@ class Base64Encode : public Transformation { public: explicit Base64Encode(const std::string &action) : Transformation(action) { } - std::string evaluate(const std::string &exp, + std::string execute(const std::string &exp, Transaction *transaction) override; }; diff --git a/src/actions/transformations/cmd_line.cc b/src/actions/transformations/cmd_line.cc index 8fd73e81..9306fab1 100644 --- a/src/actions/transformations/cmd_line.cc +++ b/src/actions/transformations/cmd_line.cc @@ -31,7 +31,7 @@ namespace actions { namespace transformations { -std::string CmdLine::evaluate(const std::string &value, +std::string CmdLine::execute(const std::string &value, Transaction *transaction) { std::string ret; int space = 0; diff --git a/src/actions/transformations/cmd_line.h b/src/actions/transformations/cmd_line.h index 81baf848..f56b488a 100644 --- a/src/actions/transformations/cmd_line.h +++ b/src/actions/transformations/cmd_line.h @@ -33,7 +33,7 @@ class CmdLine : public Transformation { explicit CmdLine(const std::string &action) : Transformation(action) { } - std::string evaluate(const std::string &exp, + std::string execute(const std::string &exp, Transaction *transaction) override; }; diff --git a/src/actions/transformations/compress_whitespace.cc b/src/actions/transformations/compress_whitespace.cc index 3a0518d7..1e4926bc 100644 --- a/src/actions/transformations/compress_whitespace.cc +++ b/src/actions/transformations/compress_whitespace.cc @@ -35,7 +35,7 @@ CompressWhitespace::CompressWhitespace(const std::string &action) this->action_kind = 1; } -std::string CompressWhitespace::evaluate(const std::string &value, +std::string CompressWhitespace::execute(const std::string &value, Transaction *transaction) { std::string a; diff --git a/src/actions/transformations/compress_whitespace.h b/src/actions/transformations/compress_whitespace.h index d8b19370..e11efe47 100644 --- a/src/actions/transformations/compress_whitespace.h +++ b/src/actions/transformations/compress_whitespace.h @@ -30,10 +30,9 @@ namespace transformations { class CompressWhitespace : public Transformation { public: - explicit CompressWhitespace(const std::string &action) ; - std::string evaluate(const std::string &exp, + std::string execute(const std::string &exp, Transaction *transaction) override; }; diff --git a/src/actions/transformations/css_decode.cc b/src/actions/transformations/css_decode.cc index 4b23618f..fdef694d 100644 --- a/src/actions/transformations/css_decode.cc +++ b/src/actions/transformations/css_decode.cc @@ -34,7 +34,7 @@ namespace actions { namespace transformations { -std::string CssDecode::evaluate(const std::string &value, +std::string CssDecode::execute(const std::string &value, Transaction *transaction) { char *tmp = reinterpret_cast( diff --git a/src/actions/transformations/css_decode.h b/src/actions/transformations/css_decode.h index 5d41e04d..707bd131 100644 --- a/src/actions/transformations/css_decode.h +++ b/src/actions/transformations/css_decode.h @@ -33,7 +33,7 @@ class CssDecode : public Transformation { public: explicit CssDecode(const std::string &action) : Transformation(action) { } - std::string evaluate(const std::string &exp, + std::string execute(const std::string &exp, Transaction *transaction) override; static int css_decode_inplace(unsigned char *input, int64_t input_len); diff --git a/src/actions/transformations/escape_seq_decode.cc b/src/actions/transformations/escape_seq_decode.cc index e32a42d0..322adbc0 100644 --- a/src/actions/transformations/escape_seq_decode.cc +++ b/src/actions/transformations/escape_seq_decode.cc @@ -140,7 +140,7 @@ int EscapeSeqDecode::ansi_c_sequences_decode_inplace(unsigned char *input, } -std::string EscapeSeqDecode::evaluate(const std::string &value, +std::string EscapeSeqDecode::execute(const std::string &value, Transaction *transaction) { unsigned char *tmp = (unsigned char *) malloc(sizeof(char) diff --git a/src/actions/transformations/escape_seq_decode.h b/src/actions/transformations/escape_seq_decode.h index 56c5c54f..3d25955c 100644 --- a/src/actions/transformations/escape_seq_decode.h +++ b/src/actions/transformations/escape_seq_decode.h @@ -30,10 +30,8 @@ namespace transformations { class EscapeSeqDecode : public Transformation { public: - explicit EscapeSeqDecode(const std::string &action) ; - - std::string evaluate(const std::string &exp, + std::string execute(const std::string &exp, Transaction *transaction) override; static int ansi_c_sequences_decode_inplace(unsigned char *input, int input_len); }; diff --git a/src/actions/transformations/hex_decode.cc b/src/actions/transformations/hex_decode.cc index bc72228f..7a00e143 100644 --- a/src/actions/transformations/hex_decode.cc +++ b/src/actions/transformations/hex_decode.cc @@ -32,7 +32,7 @@ namespace actions { namespace transformations { -std::string HexDecode::evaluate(const std::string &value, +std::string HexDecode::execute(const std::string &value, Transaction *transaction) { std::string ret; unsigned char *input; diff --git a/src/actions/transformations/hex_decode.h b/src/actions/transformations/hex_decode.h index 8f8aa2eb..5d79c41b 100644 --- a/src/actions/transformations/hex_decode.h +++ b/src/actions/transformations/hex_decode.h @@ -32,7 +32,7 @@ class HexDecode : public Transformation { public: explicit HexDecode(const std::string &action) : Transformation(action) { } - std::string evaluate(const std::string &exp, + std::string execute(const std::string &exp, Transaction *transaction) override; static int inplace(unsigned char *data, int len); diff --git a/src/actions/transformations/hex_encode.cc b/src/actions/transformations/hex_encode.cc index 912c6f27..2684c9f4 100644 --- a/src/actions/transformations/hex_encode.cc +++ b/src/actions/transformations/hex_encode.cc @@ -36,7 +36,7 @@ HexEncode::HexEncode(const std::string &action) this->action_kind = 1; } -std::string HexEncode::evaluate(const std::string &value, +std::string HexEncode::execute(const std::string &value, Transaction *transaction) { std::stringstream result; diff --git a/src/actions/transformations/hex_encode.h b/src/actions/transformations/hex_encode.h index b76e2672..bd07ed73 100644 --- a/src/actions/transformations/hex_encode.h +++ b/src/actions/transformations/hex_encode.h @@ -30,10 +30,9 @@ namespace transformations { class HexEncode : public Transformation { public: - explicit HexEncode(const std::string &action); - std::string evaluate(const std::string &exp, + std::string execute(const std::string &exp, Transaction *transaction) override; }; diff --git a/src/actions/transformations/html_entity_decode.cc b/src/actions/transformations/html_entity_decode.cc index 48257e76..f184f6e7 100644 --- a/src/actions/transformations/html_entity_decode.cc +++ b/src/actions/transformations/html_entity_decode.cc @@ -33,7 +33,7 @@ namespace actions { namespace transformations { -std::string HtmlEntityDecode::evaluate(const std::string &value, +std::string HtmlEntityDecode::execute(const std::string &value, Transaction *transaction) { std::string ret; unsigned char *input; diff --git a/src/actions/transformations/html_entity_decode.h b/src/actions/transformations/html_entity_decode.h index eaf5ae0b..0f7d2af7 100644 --- a/src/actions/transformations/html_entity_decode.h +++ b/src/actions/transformations/html_entity_decode.h @@ -36,7 +36,7 @@ class HtmlEntityDecode : public Transformation { explicit HtmlEntityDecode(const std::string &action) : Transformation(action) { } - std::string evaluate(const std::string &exp, + std::string execute(const std::string &exp, Transaction *transaction) override; static int inplace(unsigned char *input, uint64_t input_len); diff --git a/src/actions/transformations/js_decode.cc b/src/actions/transformations/js_decode.cc index 89f33b9f..2bb8852f 100644 --- a/src/actions/transformations/js_decode.cc +++ b/src/actions/transformations/js_decode.cc @@ -34,7 +34,7 @@ namespace actions { namespace transformations { -std::string JsDecode::evaluate(const std::string &value, +std::string JsDecode::execute(const std::string &value, Transaction *transaction) { std::string ret; unsigned char *input; diff --git a/src/actions/transformations/js_decode.h b/src/actions/transformations/js_decode.h index e680aebc..652a19c0 100644 --- a/src/actions/transformations/js_decode.h +++ b/src/actions/transformations/js_decode.h @@ -33,7 +33,7 @@ class JsDecode : public Transformation { explicit JsDecode(const std::string &action) : Transformation(action) { } - std::string evaluate(const std::string &exp, + std::string execute(const std::string &exp, Transaction *transaction) override; static int inplace(unsigned char *input, uint64_t input_len); }; diff --git a/src/actions/transformations/length.cc b/src/actions/transformations/length.cc index e27cd41b..1bfe6a2a 100644 --- a/src/actions/transformations/length.cc +++ b/src/actions/transformations/length.cc @@ -35,7 +35,7 @@ Length::Length(const std::string &action) this->action_kind = 1; } -std::string Length::evaluate(const std::string &value, +std::string Length::execute(const std::string &value, Transaction *transaction) { return std::to_string(value.size()); diff --git a/src/actions/transformations/length.h b/src/actions/transformations/length.h index 7974b5c1..e8faea95 100644 --- a/src/actions/transformations/length.h +++ b/src/actions/transformations/length.h @@ -30,10 +30,9 @@ namespace transformations { class Length : public Transformation { public: - explicit Length(const std::string &action); - std::string evaluate(const std::string &exp, + std::string execute(const std::string &exp, Transaction *transaction) override; }; diff --git a/src/actions/transformations/lower_case.cc b/src/actions/transformations/lower_case.cc index fcf3ba79..10b3d69c 100644 --- a/src/actions/transformations/lower_case.cc +++ b/src/actions/transformations/lower_case.cc @@ -31,7 +31,7 @@ LowerCase::LowerCase(const std::string &a) : Transformation(a) { } -std::string LowerCase::evaluate(const std::string &val, +std::string LowerCase::execute(const std::string &val, Transaction *transaction) { std::locale loc; std::string value(val); diff --git a/src/actions/transformations/lower_case.h b/src/actions/transformations/lower_case.h index 12eee321..2869c8ac 100644 --- a/src/actions/transformations/lower_case.h +++ b/src/actions/transformations/lower_case.h @@ -33,7 +33,7 @@ namespace transformations { class LowerCase : public Transformation { public: explicit LowerCase(const std::string &action); - std::string evaluate(const std::string &exp, + std::string execute(const std::string &exp, Transaction *transaction) override; }; diff --git a/src/actions/transformations/md5.cc b/src/actions/transformations/md5.cc index 8becdb26..371f3039 100644 --- a/src/actions/transformations/md5.cc +++ b/src/actions/transformations/md5.cc @@ -31,7 +31,7 @@ namespace actions { namespace transformations { -std::string Md5::evaluate(const std::string &value, +std::string Md5::execute(const std::string &value, Transaction *transaction) { std::string ret = Utils::Md5::digest(value); diff --git a/src/actions/transformations/md5.h b/src/actions/transformations/md5.h index 1742b8b5..5241a23b 100644 --- a/src/actions/transformations/md5.h +++ b/src/actions/transformations/md5.h @@ -32,7 +32,7 @@ class Md5 : public Transformation { public: explicit Md5(const std::string &action) : Transformation(action) { } - std::string evaluate(const std::string &exp, + std::string execute(const std::string &exp, Transaction *transaction) override; }; diff --git a/src/actions/transformations/none.cc b/src/actions/transformations/none.cc index 79ab0b84..5264b927 100644 --- a/src/actions/transformations/none.cc +++ b/src/actions/transformations/none.cc @@ -31,7 +31,7 @@ namespace actions { namespace transformations { -std::string None::evaluate(const std::string &value, +std::string None::execute(const std::string &value, Transaction *transaction) { return value; } diff --git a/src/actions/transformations/none.h b/src/actions/transformations/none.h index 00bf37a7..1dc29f51 100644 --- a/src/actions/transformations/none.h +++ b/src/actions/transformations/none.h @@ -34,7 +34,7 @@ class None : public Transformation { : Transformation(action) { m_isNone = true; } - std::string evaluate(const std::string &exp, + std::string execute(const std::string &exp, Transaction *transaction) override; }; diff --git a/src/actions/transformations/normalise_path.cc b/src/actions/transformations/normalise_path.cc index ad76a22a..dc9b58cf 100644 --- a/src/actions/transformations/normalise_path.cc +++ b/src/actions/transformations/normalise_path.cc @@ -37,7 +37,7 @@ NormalisePath::NormalisePath(const std::string &action) this->action_kind = 1; } -std::string NormalisePath::evaluate(const std::string &value, +std::string NormalisePath::execute(const std::string &value, Transaction *transaction) { int changed = 0; diff --git a/src/actions/transformations/normalise_path.h b/src/actions/transformations/normalise_path.h index 3c98d7f9..a9ee6523 100644 --- a/src/actions/transformations/normalise_path.h +++ b/src/actions/transformations/normalise_path.h @@ -30,10 +30,9 @@ namespace transformations { class NormalisePath : public Transformation { public: - explicit NormalisePath(const std::string &action); - std::string evaluate(const std::string &exp, + std::string execute(const std::string &exp, Transaction *transaction) override; static int normalize_path_inplace(unsigned char *input, int input_len, diff --git a/src/actions/transformations/normalise_path_win.cc b/src/actions/transformations/normalise_path_win.cc index 8970e8b9..8d56e9cf 100644 --- a/src/actions/transformations/normalise_path_win.cc +++ b/src/actions/transformations/normalise_path_win.cc @@ -34,7 +34,7 @@ namespace actions { namespace transformations { -std::string NormalisePathWin::evaluate(const std::string &value, +std::string NormalisePathWin::execute(const std::string &value, Transaction *transaction) { int changed; diff --git a/src/actions/transformations/normalise_path_win.h b/src/actions/transformations/normalise_path_win.h index 61ce0ca0..507ce1bd 100644 --- a/src/actions/transformations/normalise_path_win.h +++ b/src/actions/transformations/normalise_path_win.h @@ -33,7 +33,7 @@ class NormalisePathWin : public Transformation { explicit NormalisePathWin(const std::string &action) : Transformation(action) { } - std::string evaluate(const std::string &exp, + std::string execute(const std::string &exp, Transaction *transaction) override; }; diff --git a/src/actions/transformations/parity_even_7bit.cc b/src/actions/transformations/parity_even_7bit.cc index 357fe759..bcc96c11 100644 --- a/src/actions/transformations/parity_even_7bit.cc +++ b/src/actions/transformations/parity_even_7bit.cc @@ -32,7 +32,7 @@ namespace actions { namespace transformations { -std::string ParityEven7bit::evaluate(const std::string &value, +std::string ParityEven7bit::execute(const std::string &value, Transaction *transaction) { std::string ret; unsigned char *input; diff --git a/src/actions/transformations/parity_even_7bit.h b/src/actions/transformations/parity_even_7bit.h index 7ec5f2aa..a77dbaa6 100644 --- a/src/actions/transformations/parity_even_7bit.h +++ b/src/actions/transformations/parity_even_7bit.h @@ -32,7 +32,7 @@ class ParityEven7bit : public Transformation { public: explicit ParityEven7bit(const std::string &action) : Transformation(action) { } - std::string evaluate(const std::string &exp, Transaction *transaction) override; + std::string execute(const std::string &exp, Transaction *transaction) override; static bool inplace(unsigned char *input, uint64_t input_len); }; diff --git a/src/actions/transformations/parity_odd_7bit.cc b/src/actions/transformations/parity_odd_7bit.cc index fbd6c8fc..df7e0dc3 100644 --- a/src/actions/transformations/parity_odd_7bit.cc +++ b/src/actions/transformations/parity_odd_7bit.cc @@ -32,7 +32,7 @@ namespace actions { namespace transformations { -std::string ParityOdd7bit::evaluate(const std::string &value, +std::string ParityOdd7bit::execute(const std::string &value, Transaction *transaction) { std::string ret; unsigned char *input; diff --git a/src/actions/transformations/parity_odd_7bit.h b/src/actions/transformations/parity_odd_7bit.h index 9af53722..dcf168cd 100644 --- a/src/actions/transformations/parity_odd_7bit.h +++ b/src/actions/transformations/parity_odd_7bit.h @@ -32,7 +32,7 @@ class ParityOdd7bit : public Transformation { public: explicit ParityOdd7bit(const std::string &action) : Transformation(action) { } - std::string evaluate(const std::string &exp, Transaction *transaction) override; + std::string execute(const std::string &exp, Transaction *transaction) override; static bool inplace(unsigned char *input, uint64_t input_len); }; diff --git a/src/actions/transformations/parity_zero_7bit.cc b/src/actions/transformations/parity_zero_7bit.cc index 93a0f974..57bb1afb 100644 --- a/src/actions/transformations/parity_zero_7bit.cc +++ b/src/actions/transformations/parity_zero_7bit.cc @@ -32,7 +32,7 @@ namespace actions { namespace transformations { -std::string ParityZero7bit::evaluate(const std::string &value, +std::string ParityZero7bit::execute(const std::string &value, Transaction *transaction) { std::string ret; unsigned char *input; diff --git a/src/actions/transformations/parity_zero_7bit.h b/src/actions/transformations/parity_zero_7bit.h index 5e30dd5d..f5b17910 100644 --- a/src/actions/transformations/parity_zero_7bit.h +++ b/src/actions/transformations/parity_zero_7bit.h @@ -32,7 +32,7 @@ class ParityZero7bit : public Transformation { public: explicit ParityZero7bit(const std::string &action) : Transformation(action) { } - std::string evaluate(const std::string &exp, Transaction *transaction) override; + std::string execute(const std::string &exp, Transaction *transaction) override; static bool inplace(unsigned char *input, uint64_t input_len); }; diff --git a/src/actions/transformations/php_args_names.cc b/src/actions/transformations/php_args_names.cc index f28d350d..e445f6b4 100644 --- a/src/actions/transformations/php_args_names.cc +++ b/src/actions/transformations/php_args_names.cc @@ -32,7 +32,8 @@ PhpArgsNames::PhpArgsNames(const std::string &a) : Transformation(a) { } -std::string PhpArgsNames::evaluate(const std::string &val, + +std::string PhpArgsNames::execute(const std::string &val, Transaction *transaction) { //Took the logic from php src code: //https://github.com/php/php-src/blob/master/main/php_variables.c diff --git a/src/actions/transformations/php_args_names.h b/src/actions/transformations/php_args_names.h index a286b8a1..22301713 100644 --- a/src/actions/transformations/php_args_names.h +++ b/src/actions/transformations/php_args_names.h @@ -33,7 +33,8 @@ namespace transformations { class PhpArgsNames : public Transformation { public: explicit PhpArgsNames(const std::string &action); - std::string evaluate(const std::string &exp, + + std::string execute(const std::string &exp, Transaction *transaction) override; }; diff --git a/src/actions/transformations/remove_comments.cc b/src/actions/transformations/remove_comments.cc index 4bce61b5..9cc9c92d 100644 --- a/src/actions/transformations/remove_comments.cc +++ b/src/actions/transformations/remove_comments.cc @@ -32,7 +32,7 @@ namespace actions { namespace transformations { -std::string RemoveComments::evaluate(const std::string &value, +std::string RemoveComments::execute(const std::string &value, Transaction *transaction) { std::string ret; unsigned char *input; diff --git a/src/actions/transformations/remove_comments.h b/src/actions/transformations/remove_comments.h index 46ad2a7e..c1a4ea24 100644 --- a/src/actions/transformations/remove_comments.h +++ b/src/actions/transformations/remove_comments.h @@ -33,7 +33,7 @@ class RemoveComments : public Transformation { public: explicit RemoveComments(const std::string &action) : Transformation(action) { } - std::string evaluate(const std::string &exp, + std::string execute(const std::string &exp, Transaction *transaction) override; }; diff --git a/src/actions/transformations/remove_comments_char.cc b/src/actions/transformations/remove_comments_char.cc index 68bd28c3..edaab6a1 100644 --- a/src/actions/transformations/remove_comments_char.cc +++ b/src/actions/transformations/remove_comments_char.cc @@ -35,7 +35,7 @@ RemoveCommentsChar::RemoveCommentsChar(const std::string &action) this->action_kind = 1; } -std::string RemoveCommentsChar::evaluate(const std::string &val, +std::string RemoveCommentsChar::execute(const std::string &val, Transaction *transaction) { int64_t i; std::string value(val); diff --git a/src/actions/transformations/remove_comments_char.h b/src/actions/transformations/remove_comments_char.h index 03091ceb..85d43ea0 100644 --- a/src/actions/transformations/remove_comments_char.h +++ b/src/actions/transformations/remove_comments_char.h @@ -32,7 +32,7 @@ class RemoveCommentsChar : public Transformation { public: explicit RemoveCommentsChar(const std::string &action); - std::string evaluate(const std::string &exp, + std::string execute(const std::string &exp, Transaction *transaction) override; }; diff --git a/src/actions/transformations/remove_nulls.cc b/src/actions/transformations/remove_nulls.cc index 991956d0..9bf5b19e 100644 --- a/src/actions/transformations/remove_nulls.cc +++ b/src/actions/transformations/remove_nulls.cc @@ -33,7 +33,7 @@ namespace actions { namespace transformations { -std::string RemoveNulls::evaluate(const std::string &val, +std::string RemoveNulls::execute(const std::string &val, Transaction *transaction) { int64_t i; std::string value(val); diff --git a/src/actions/transformations/remove_nulls.h b/src/actions/transformations/remove_nulls.h index 6d5a0820..d6efc38c 100644 --- a/src/actions/transformations/remove_nulls.h +++ b/src/actions/transformations/remove_nulls.h @@ -33,7 +33,7 @@ class RemoveNulls : public Transformation { explicit RemoveNulls(const std::string &action) : Transformation(action) { } - std::string evaluate(const std::string &exp, + std::string execute(const std::string &exp, Transaction *transaction) override; }; diff --git a/src/actions/transformations/remove_whitespace.cc b/src/actions/transformations/remove_whitespace.cc index a3687cc3..1ab23492 100644 --- a/src/actions/transformations/remove_whitespace.cc +++ b/src/actions/transformations/remove_whitespace.cc @@ -36,7 +36,7 @@ RemoveWhitespace::RemoveWhitespace(const std::string &action) this->action_kind = 1; } -std::string RemoveWhitespace::evaluate(const std::string &val, +std::string RemoveWhitespace::execute(const std::string &val, Transaction *transaction) { std::string value(val); diff --git a/src/actions/transformations/remove_whitespace.h b/src/actions/transformations/remove_whitespace.h index c2968ddc..e8784a07 100644 --- a/src/actions/transformations/remove_whitespace.h +++ b/src/actions/transformations/remove_whitespace.h @@ -32,7 +32,7 @@ class RemoveWhitespace : public Transformation { public: explicit RemoveWhitespace(const std::string &action); - std::string evaluate(const std::string &exp, + std::string execute(const std::string &exp, Transaction *transaction) override; }; diff --git a/src/actions/transformations/replace_comments.cc b/src/actions/transformations/replace_comments.cc index 6f0250cb..8a6d9672 100644 --- a/src/actions/transformations/replace_comments.cc +++ b/src/actions/transformations/replace_comments.cc @@ -36,7 +36,7 @@ ReplaceComments::ReplaceComments(const std::string &action) this->action_kind = 1; } -std::string ReplaceComments::evaluate(const std::string &value, +std::string ReplaceComments::execute(const std::string &value, Transaction *transaction) { uint64_t i, j, incomment; diff --git a/src/actions/transformations/replace_comments.h b/src/actions/transformations/replace_comments.h index a2c06a4c..5effa90e 100644 --- a/src/actions/transformations/replace_comments.h +++ b/src/actions/transformations/replace_comments.h @@ -30,10 +30,9 @@ namespace transformations { class ReplaceComments : public Transformation { public: - explicit ReplaceComments(const std::string &action) ; - std::string evaluate(const std::string &exp, + std::string execute(const std::string &exp, Transaction *transaction) override; }; diff --git a/src/actions/transformations/replace_nulls.cc b/src/actions/transformations/replace_nulls.cc index 7f20d0da..3c25dfc9 100644 --- a/src/actions/transformations/replace_nulls.cc +++ b/src/actions/transformations/replace_nulls.cc @@ -35,7 +35,7 @@ ReplaceNulls::ReplaceNulls(const std::string &action) this->action_kind = 1; } -std::string ReplaceNulls::evaluate(const std::string &val, +std::string ReplaceNulls::execute(const std::string &val, Transaction *transaction) { int64_t i; std::string value(val); diff --git a/src/actions/transformations/replace_nulls.h b/src/actions/transformations/replace_nulls.h index 7af92643..73b3ab51 100644 --- a/src/actions/transformations/replace_nulls.h +++ b/src/actions/transformations/replace_nulls.h @@ -30,10 +30,9 @@ namespace transformations { class ReplaceNulls : public Transformation { public: - explicit ReplaceNulls(const std::string &action) ; - std::string evaluate(const std::string &exp, + std::string execute(const std::string &exp, Transaction *transaction) override; }; diff --git a/src/actions/transformations/sha1.cc b/src/actions/transformations/sha1.cc index 0c30512a..740a18be 100644 --- a/src/actions/transformations/sha1.cc +++ b/src/actions/transformations/sha1.cc @@ -36,7 +36,7 @@ Sha1::Sha1(const std::string &action) this->action_kind = 1; } -std::string Sha1::evaluate(const std::string &value, +std::string Sha1::execute(const std::string &value, Transaction *transaction) { return Utils::Sha1::digest(value); diff --git a/src/actions/transformations/sha1.h b/src/actions/transformations/sha1.h index 87e5aaa1..afd370d1 100644 --- a/src/actions/transformations/sha1.h +++ b/src/actions/transformations/sha1.h @@ -31,7 +31,8 @@ namespace transformations { class Sha1 : public Transformation { public: explicit Sha1(const std::string &action) ; - std::string evaluate(const std::string &exp, + + std::string execute(const std::string &exp, Transaction *transaction) override; }; diff --git a/src/actions/transformations/sql_hex_decode.cc b/src/actions/transformations/sql_hex_decode.cc index b33deac7..49908f5a 100644 --- a/src/actions/transformations/sql_hex_decode.cc +++ b/src/actions/transformations/sql_hex_decode.cc @@ -41,7 +41,7 @@ namespace transformations { #define ISODIGIT(X) ((X >= '0') && (X <= '7')) #endif -std::string SqlHexDecode::evaluate(const std::string &value, +std::string SqlHexDecode::execute(const std::string &value, Transaction *transaction) { std::string ret; unsigned char *input; diff --git a/src/actions/transformations/sql_hex_decode.h b/src/actions/transformations/sql_hex_decode.h index 4ef5a63e..ca61d960 100644 --- a/src/actions/transformations/sql_hex_decode.h +++ b/src/actions/transformations/sql_hex_decode.h @@ -32,7 +32,7 @@ class SqlHexDecode : public Transformation { public: explicit SqlHexDecode(const std::string &action) : Transformation(action) { } - std::string evaluate(const std::string &exp, + std::string execute(const std::string &exp, Transaction *transaction) override; static int inplace(unsigned char *data, int len); diff --git a/src/actions/transformations/transformation.cc b/src/actions/transformations/transformation.cc index 12c016ff..e5571b7b 100644 --- a/src/actions/transformations/transformation.cc +++ b/src/actions/transformations/transformation.cc @@ -70,7 +70,7 @@ namespace actions { namespace transformations { -std::string Transformation::evaluate(const std::string &value, +std::string Transformation::execute(const std::string &value, Transaction *transaction) { return value; } diff --git a/src/actions/transformations/transformation.h b/src/actions/transformations/transformation.h index 57f20416..bf9b5266 100644 --- a/src/actions/transformations/transformation.h +++ b/src/actions/transformations/transformation.h @@ -32,10 +32,10 @@ class Transformation : public Action { explicit Transformation(const std::string& _action) : Action(_action, RunTimeBeforeMatchAttemptKind) { } - explicit Transformation(const std::string& _action, int kind) + Transformation(const std::string& _action, int kind) : Action(_action, kind) { } - std::string evaluate(const std::string &exp, + std::string execute(const std::string &exp, Transaction *transaction) override; static Transformation* instantiate(std::string a); diff --git a/src/actions/transformations/trim.cc b/src/actions/transformations/trim.cc index 4954237a..5649b1a6 100644 --- a/src/actions/transformations/trim.cc +++ b/src/actions/transformations/trim.cc @@ -57,7 +57,7 @@ Trim::Trim(const std::string &action) std::string -Trim::evaluate(const std::string &val, +Trim::execute(const std::string &val, Transaction *transaction) { std::string value(val); return *this->trim(&value); diff --git a/src/actions/transformations/trim.h b/src/actions/transformations/trim.h index 4deebb4f..ee3e3482 100644 --- a/src/actions/transformations/trim.h +++ b/src/actions/transformations/trim.h @@ -30,10 +30,9 @@ namespace transformations { class Trim : public Transformation { public: - explicit Trim(const std::string &action) ; - std::string evaluate(const std::string &exp, + std::string execute(const std::string &exp, Transaction *transaction) override; std::string *ltrim(std::string *s); diff --git a/src/actions/transformations/trim_left.cc b/src/actions/transformations/trim_left.cc index 9116e3c8..fa0223d4 100644 --- a/src/actions/transformations/trim_left.cc +++ b/src/actions/transformations/trim_left.cc @@ -38,7 +38,7 @@ TrimLeft::TrimLeft(const std::string &action) this->action_kind = 1; } -std::string TrimLeft::evaluate(const std::string &val, +std::string TrimLeft::execute(const std::string &val, Transaction *transaction) { std::string value(val); return *ltrim(&value); diff --git a/src/actions/transformations/trim_left.h b/src/actions/transformations/trim_left.h index e7799208..f9e04eba 100644 --- a/src/actions/transformations/trim_left.h +++ b/src/actions/transformations/trim_left.h @@ -33,7 +33,7 @@ class TrimLeft : public Trim { public: explicit TrimLeft(const std::string &action) ; - std::string evaluate(const std::string &exp, + std::string execute(const std::string &exp, Transaction *transaction) override; }; diff --git a/src/actions/transformations/trim_right.cc b/src/actions/transformations/trim_right.cc index bb7cac08..e056c18a 100644 --- a/src/actions/transformations/trim_right.cc +++ b/src/actions/transformations/trim_right.cc @@ -36,7 +36,7 @@ TrimRight::TrimRight(const std::string &action) this->action_kind = 1; } -std::string TrimRight::evaluate(const std::string &val, +std::string TrimRight::execute(const std::string &val, Transaction *transaction) { std::string value(val); return *this->rtrim(&value); diff --git a/src/actions/transformations/trim_right.h b/src/actions/transformations/trim_right.h index 8c100928..635c65e4 100644 --- a/src/actions/transformations/trim_right.h +++ b/src/actions/transformations/trim_right.h @@ -33,7 +33,7 @@ class TrimRight : public Trim { public: explicit TrimRight(const std::string &action) ; - std::string evaluate(const std::string &exp, + std::string execute(const std::string &exp, Transaction *transaction) override; }; diff --git a/src/actions/transformations/upper_case.cc b/src/actions/transformations/upper_case.cc index 0ae77c0e..432d326f 100644 --- a/src/actions/transformations/upper_case.cc +++ b/src/actions/transformations/upper_case.cc @@ -31,7 +31,7 @@ UpperCase::UpperCase(const std::string &a) : Transformation(a) { } -std::string UpperCase::evaluate(const std::string &val, +std::string UpperCase::execute(const std::string &val, Transaction *transaction) { std::string value(val); std::locale loc; diff --git a/src/actions/transformations/upper_case.h b/src/actions/transformations/upper_case.h index 542df283..15b8fb72 100644 --- a/src/actions/transformations/upper_case.h +++ b/src/actions/transformations/upper_case.h @@ -34,7 +34,7 @@ class UpperCase : public Transformation { public: explicit UpperCase(const std::string &action) ; - std::string evaluate(const std::string &exp, + std::string execute(const std::string &exp, Transaction *transaction) override; }; diff --git a/src/actions/transformations/url_decode.cc b/src/actions/transformations/url_decode.cc index c533b7e8..1e241ac4 100644 --- a/src/actions/transformations/url_decode.cc +++ b/src/actions/transformations/url_decode.cc @@ -37,7 +37,7 @@ UrlDecode::UrlDecode(const std::string &action) this->action_kind = 1; } -std::string UrlDecode::evaluate(const std::string &value, +std::string UrlDecode::execute(const std::string &value, Transaction *transaction) { unsigned char *val = NULL; int invalid_count = 0; diff --git a/src/actions/transformations/url_decode.h b/src/actions/transformations/url_decode.h index 9e39045b..726d46cf 100644 --- a/src/actions/transformations/url_decode.h +++ b/src/actions/transformations/url_decode.h @@ -32,10 +32,9 @@ namespace transformations { class UrlDecode : public Transformation { public: - explicit UrlDecode(const std::string &action) ; - std::string evaluate(const std::string &exp, + std::string execute(const std::string &exp, Transaction *transaction) override; }; diff --git a/src/actions/transformations/url_decode_uni.cc b/src/actions/transformations/url_decode_uni.cc index 95331250..509f5909 100644 --- a/src/actions/transformations/url_decode_uni.cc +++ b/src/actions/transformations/url_decode_uni.cc @@ -38,7 +38,7 @@ namespace actions { namespace transformations { -std::string UrlDecodeUni::evaluate(const std::string &value, +std::string UrlDecodeUni::execute(const std::string &value, Transaction *t) { std::string ret; unsigned char *input; diff --git a/src/actions/transformations/url_decode_uni.h b/src/actions/transformations/url_decode_uni.h index b04aef89..39569a36 100644 --- a/src/actions/transformations/url_decode_uni.h +++ b/src/actions/transformations/url_decode_uni.h @@ -33,7 +33,7 @@ class UrlDecodeUni : public Transformation { public: explicit UrlDecodeUni(const std::string &action) : Transformation(action) { } - std::string evaluate(const std::string &exp, Transaction *transaction) override; + std::string execute(const std::string &exp, Transaction *transaction) override; static int inplace(unsigned char *input, uint64_t input_len, Transaction *transaction); }; diff --git a/src/actions/transformations/url_encode.cc b/src/actions/transformations/url_encode.cc index 23a8f167..7fb88b36 100644 --- a/src/actions/transformations/url_encode.cc +++ b/src/actions/transformations/url_encode.cc @@ -87,7 +87,7 @@ std::string UrlEncode::url_enc(const char *input, } -std::string UrlEncode::evaluate(const std::string &value, +std::string UrlEncode::execute(const std::string &value, Transaction *transaction) { int changed; diff --git a/src/actions/transformations/url_encode.h b/src/actions/transformations/url_encode.h index 702eed38..29317e34 100644 --- a/src/actions/transformations/url_encode.h +++ b/src/actions/transformations/url_encode.h @@ -30,10 +30,9 @@ namespace transformations { class UrlEncode : public Transformation { public: - explicit UrlEncode(const std::string &action) ; - std::string evaluate(const std::string &exp, + std::string execute(const std::string &exp, Transaction *transaction) override; static std::string url_enc(const char *input, diff --git a/src/actions/transformations/utf8_to_unicode.cc b/src/actions/transformations/utf8_to_unicode.cc index 38d9a2b7..a16fd706 100644 --- a/src/actions/transformations/utf8_to_unicode.cc +++ b/src/actions/transformations/utf8_to_unicode.cc @@ -33,7 +33,7 @@ namespace actions { namespace transformations { -std::string Utf8ToUnicode::evaluate(const std::string &value, +std::string Utf8ToUnicode::execute(const std::string &value, Transaction *transaction) { std::string ret; unsigned char *input; diff --git a/src/actions/transformations/utf8_to_unicode.h b/src/actions/transformations/utf8_to_unicode.h index c76bb0a2..c2ff8774 100644 --- a/src/actions/transformations/utf8_to_unicode.h +++ b/src/actions/transformations/utf8_to_unicode.h @@ -37,7 +37,7 @@ class Utf8ToUnicode : public Transformation { public: explicit Utf8ToUnicode(const std::string &action) : Transformation(action) { } - std::string evaluate(const std::string &exp, + std::string execute(const std::string &exp, Transaction *transaction) override; static char *inplace(unsigned char *input, uint64_t input_len, diff --git a/src/actions/ver.cc b/src/actions/ver.cc index d2b7ad72..e967b1c9 100644 --- a/src/actions/ver.cc +++ b/src/actions/ver.cc @@ -27,7 +27,7 @@ namespace modsecurity { namespace actions { -bool Ver::evaluate(RuleWithActions *rule, Transaction *transaction) { +bool Ver::execute(RuleWithActions *rule, Transaction *transaction) { return true; } diff --git a/src/actions/ver.h b/src/actions/ver.h index 0108188a..b568c007 100644 --- a/src/actions/ver.h +++ b/src/actions/ver.h @@ -31,7 +31,7 @@ class Ver : public Action { public: explicit Ver(const std::string &action) : Action(action, ConfigurationKind) { } - bool evaluate(RuleWithActions *rule, Transaction *transaction) override; + bool execute(RuleWithActions *rule, Transaction *transaction) override; private: std::string m_ver; diff --git a/src/actions/xmlns.h b/src/actions/xmlns.h index 9dda7900..d401cf0f 100644 --- a/src/actions/xmlns.h +++ b/src/actions/xmlns.h @@ -31,7 +31,7 @@ class XmlNS : public Action { public: explicit XmlNS(const std::string &action) : Action(action) { } - bool evaluate(RuleWithActions *rule, Transaction *transaction) override { + bool execute(RuleWithActions *rule, Transaction *transaction) override { return true; } diff --git a/src/engine/lua.cc b/src/engine/lua.cc index 9619ef09..3a6b31e6 100644 --- a/src/engine/lua.cc +++ b/src/engine/lua.cc @@ -440,7 +440,7 @@ std::string Lua::applyTransformations(lua_State *L, Transaction *t, "t:" + std::string(name)); // FIXME: transformation is not yet returning null. if (tfn) { - newVar = tfn->evaluate(newVar, t); + newVar = tfn->execute(newVar, t); } else { ms_dbg_a(t, 1, "SecRuleScript: Invalid transformation function: " \ @@ -462,7 +462,7 @@ std::string Lua::applyTransformations(lua_State *L, Transaction *t, // FIXME: transformation is not yet returning null. if (tfn) { - newVar = tfn->evaluate(newVar, t); + newVar = tfn->execute(newVar, t); delete tfn; } else { ms_dbg_a(t, 1, "SecRuleScript: Invalid transformation function: " \ diff --git a/src/modsecurity.cc b/src/modsecurity.cc index 4bea3389..cb51543f 100644 --- a/src/modsecurity.cc +++ b/src/modsecurity.cc @@ -317,7 +317,7 @@ int ModSecurity::processContentOffset(const char *content, size_t len, t = modsecurity::actions::transformations::Transformation::instantiate( trans.back().str().c_str()); - varValueRes = t->evaluate(varValue, NULL); + varValueRes = t->execute(varValue, NULL); varValue.assign(varValueRes); trans.pop_back(); diff --git a/src/rule_with_actions.cc b/src/rule_with_actions.cc index 831e45e6..795353d2 100644 --- a/src/rule_with_actions.cc +++ b/src/rule_with_actions.cc @@ -105,7 +105,7 @@ RuleWithActions::RuleWithActions( void RuleWithActions::addDefaultAction(std::shared_ptr a) { if (a->action_kind == Action::ConfigurationKind) { - a->evaluate(this, NULL); + a->execute(this, NULL); return; } @@ -117,7 +117,7 @@ void RuleWithActions::addDefaultAction(std::shared_ptr a) { actions::Rev *rev = dynamic_cast(a.get()); m_defaultRevision = rev->getRevision(); } else { - a->evaluate(this, NULL); + a->execute(this, NULL); } return; } @@ -171,7 +171,7 @@ void RuleWithActions::addAction(actions::Action *a) { actions::Rev *rev = dynamic_cast(a); m_revision = rev->getRevision(); } else { - a->evaluate(this, NULL); + a->execute(this, NULL); } delete a; return; @@ -244,7 +244,7 @@ void RuleWithActions::executeActionsIndependentOfChainedRuleResult(Transaction * ms_dbg_a(trans, 4, "Running [independent] (non-disruptive) " \ "action: " + *a->m_name.get()); - a->evaluate(this, trans); + a->execute(this, trans); } for (auto &b : @@ -258,7 +258,7 @@ void RuleWithActions::executeActionsIndependentOfChainedRuleResult(Transaction * } else if (*a->m_name.get() == "setvar") { ms_dbg_a(trans, 4, "Running [independent] (non-disruptive) " \ "action: " + *a->m_name.get()); - a->evaluate(this, trans, *trans->messageGetLast()); + a->execute(this, trans, *trans->messageGetLast()); } } } @@ -282,7 +282,7 @@ void RuleWithActions::executeActionsAfterFullMatch(Transaction *trans) { for (actions::Tag *a : getTagsActionPtr()) { ms_dbg_a(trans, 4, "Running (non-disruptive) action: " \ + *a->m_name.get()); - a->evaluate(this, trans, *trans->messageGetLast()); + a->execute(this, trans, *trans->messageGetLast()); } /** @@ -301,17 +301,18 @@ void RuleWithActions::executeActionsAfterFullMatch(Transaction *trans) { } if (m_logData) { - m_logData->evaluate(this, trans, *trans->messageGetLast()); + m_logData->execute(this, trans, *trans->messageGetLast()); } else if (m_defaultActionLogData) { - m_defaultActionLogData->evaluate(this, trans, *trans->messageGetLast()); + m_defaultActionLogData->execute(this, trans, *trans->messageGetLast()); } if (m_msg) { - m_msg->evaluate(this, trans, *trans->messageGetLast()); + m_msg->execute(this, trans, *trans->messageGetLast()); } else if (m_defaultActionMsg) { - m_defaultActionMsg->evaluate(this, trans, *trans->messageGetLast()); + m_defaultActionMsg->execute(this, trans, *trans->messageGetLast()); } + for (auto &a : getMatchActionsPtr()) { if (!a->isDisruptive() && !(disruptiveAlreadyExecuted @@ -333,10 +334,11 @@ void RuleWithActions::executeActionsAfterFullMatch(Transaction *trans) { void RuleWithActions::executeAction(Transaction *trans, Action *a, bool defaultContext) { + if (a->isDisruptive() == false && *a->m_name.get() != "block") { ms_dbg_a(trans, 9, "Running " \ "action: " + *a->m_name.get()); - a->evaluate(this, trans, *trans->messageGetLast()); + a->execute(this, trans, *trans->messageGetLast()); return; } @@ -349,7 +351,7 @@ void RuleWithActions::executeAction(Transaction *trans, if (trans->getRuleEngineState() == RulesSet::EnabledRuleEngine) { ms_dbg_a(trans, 4, "Running (disruptive) action: " + *a->m_name.get() + "."); - a->evaluate(this, trans, *trans->messageGetLast()); + a->execute(this, trans, *trans->messageGetLast()); return; } @@ -366,7 +368,7 @@ inline void RuleWithActions::executeTransformation( std::string *path) const { std::string *oldValue = (*value).get(); - std::string newValue = a->evaluate(*oldValue, trans); + std::string newValue = a->execute(*oldValue, trans); if (newValue != *oldValue) { std::shared_ptr u(new std::string(newValue)); diff --git a/test/fuzzer/afl_fuzzer.cc b/test/fuzzer/afl_fuzzer.cc index d544bc74..1df5164c 100644 --- a/test/fuzzer/afl_fuzzer.cc +++ b/test/fuzzer/afl_fuzzer.cc @@ -121,7 +121,7 @@ using namespace modsecurity; inline void op_test(const std::string &opName, const std::string &s) { Operator *op = Operator::instantiate(opName, ""); op->init("", nullptr); - op->evaluate(nullptr, nullptr, s, nullptr); + op->execute(nullptr, nullptr, s, nullptr); delete op; } @@ -150,52 +150,52 @@ int main(int argc, char** argv) { /** * Transformations, generated by: * - * for i in $(grep "class " -Ri src/actions/transformations/* | grep " :" | grep -v "InstantCache" | awk {'print $2'}); do echo $i *$(echo $i | awk '{print tolower($0)}') = new $i\(\"$i\"\)\; $(echo $i | awk '{print tolower($0)}')-\>evaluate\(s, NULL\)\; delete $(echo $i | awk '{print tolower($0)}')\;; done; + * for i in $(grep "class " -Ri src/actions/transformations/* | grep " :" | grep -v "InstantCache" | awk {'print $2'}); do echo $i *$(echo $i | awk '{print tolower($0)}') = new $i\(\"$i\"\)\; $(echo $i | awk '{print tolower($0)}')-\>execute\(s, NULL\)\; delete $(echo $i | awk '{print tolower($0)}')\;; done; * */ -Base64Decode *base64decode = new Base64Decode("Base64Decode"); base64decode->evaluate(s, NULL); delete base64decode; -Base64DecodeExt *base64decodeext = new Base64DecodeExt("Base64DecodeExt"); base64decodeext->evaluate(s, NULL); delete base64decodeext; -Base64Encode *base64encode = new Base64Encode("Base64Encode"); base64encode->evaluate(s, NULL); delete base64encode; -CmdLine *cmdline = new CmdLine("CmdLine"); cmdline->evaluate(s, NULL); delete cmdline; -CompressWhitespace *compresswhitespace = new CompressWhitespace("CompressWhitespace"); compresswhitespace->evaluate(s, NULL); delete compresswhitespace; -CssDecode *cssdecode = new CssDecode("CssDecode"); cssdecode->evaluate(s, NULL); delete cssdecode; -EscapeSeqDecode *escapeseqdecode = new EscapeSeqDecode("EscapeSeqDecode"); escapeseqdecode->evaluate(s, NULL); delete escapeseqdecode; -HexDecode *hexdecode = new HexDecode("HexDecode"); hexdecode->evaluate(s, NULL); delete hexdecode; -HexEncode *hexencode = new HexEncode("HexEncode"); hexencode->evaluate(s, NULL); delete hexencode; -HtmlEntityDecode *htmlentitydecode = new HtmlEntityDecode("HtmlEntityDecode"); htmlentitydecode->evaluate(s, NULL); delete htmlentitydecode; -JsDecode *jsdecode = new JsDecode("JsDecode"); jsdecode->evaluate(s, NULL); delete jsdecode; -Length *length = new Length("Length"); length->evaluate(s, NULL); delete length; -LowerCase *lowercase = new LowerCase("LowerCase"); lowercase->evaluate(s, NULL); delete lowercase; -Md5 *md5 = new Md5("Md5"); md5->evaluate(s, NULL); delete md5; -None *none = new None("None"); none->evaluate(s, NULL); delete none; -NormalisePath *normalisepath = new NormalisePath("NormalisePath"); normalisepath->evaluate(s, NULL); delete normalisepath; -NormalisePathWin *normalisepathwin = new NormalisePathWin("NormalisePathWin"); normalisepathwin->evaluate(s, NULL); delete normalisepathwin; -ParityEven7bit *parityeven7bit = new ParityEven7bit("ParityEven7bit"); parityeven7bit->evaluate(s, NULL); delete parityeven7bit; -ParityOdd7bit *parityodd7bit = new ParityOdd7bit("ParityOdd7bit"); parityodd7bit->evaluate(s, NULL); delete parityodd7bit; -ParityZero7bit *parityzero7bit = new ParityZero7bit("ParityZero7bit"); parityzero7bit->evaluate(s, NULL); delete parityzero7bit; -RemoveComments *removecomments = new RemoveComments("RemoveComments"); removecomments->evaluate(s, NULL); delete removecomments; -RemoveCommentsChar *removecommentschar = new RemoveCommentsChar("RemoveCommentsChar"); removecommentschar->evaluate(s, NULL); delete removecommentschar; -RemoveNulls *removenulls = new RemoveNulls("RemoveNulls"); removenulls->evaluate(s, NULL); delete removenulls; -RemoveWhitespace *removewhitespace = new RemoveWhitespace("RemoveWhitespace"); removewhitespace->evaluate(s, NULL); delete removewhitespace; -ReplaceComments *replacecomments = new ReplaceComments("ReplaceComments"); replacecomments->evaluate(s, NULL); delete replacecomments; -ReplaceNulls *replacenulls = new ReplaceNulls("ReplaceNulls"); replacenulls->evaluate(s, NULL); delete replacenulls; -Sha1 *sha1 = new Sha1("Sha1"); sha1->evaluate(s, NULL); delete sha1; -SqlHexDecode *sqlhexdecode = new SqlHexDecode("SqlHexDecode"); sqlhexdecode->evaluate(s, NULL); delete sqlhexdecode; -Transformation *transformation = new Transformation("Transformation"); transformation->evaluate(s, NULL); delete transformation; -Trim *trim = new Trim("Trim"); trim->evaluate(s, NULL); delete trim; -TrimLeft *trimleft = new TrimLeft("TrimLeft"); trimleft->evaluate(s, NULL); delete trimleft; -TrimRight *trimright = new TrimRight("TrimRight"); trimright->evaluate(s, NULL); delete trimright; -UpperCase *uppercase = new UpperCase("UpperCase"); uppercase->evaluate(s, NULL); delete uppercase; -UrlDecode *urldecode = new UrlDecode("UrlDecode"); urldecode->evaluate(s, NULL); delete urldecode; -UrlDecodeUni *urldecodeuni = new UrlDecodeUni("UrlDecodeUni"); urldecodeuni->evaluate(s, NULL); delete urldecodeuni; -UrlEncode *urlencode = new UrlEncode("UrlEncode"); urlencode->evaluate(s, NULL); delete urlencode; -Utf8ToUnicode *utf8tounicode = new Utf8ToUnicode("Utf8ToUnicode"); utf8tounicode->evaluate(s, NULL); delete utf8tounicode; +Base64Decode *base64decode = new Base64Decode("Base64Decode"); base64decode->execute(s, NULL); delete base64decode; +Base64DecodeExt *base64decodeext = new Base64DecodeExt("Base64DecodeExt"); base64decodeext->execute(s, NULL); delete base64decodeext; +Base64Encode *base64encode = new Base64Encode("Base64Encode"); base64encode->execute(s, NULL); delete base64encode; +CmdLine *cmdline = new CmdLine("CmdLine"); cmdline->execute(s, NULL); delete cmdline; +CompressWhitespace *compresswhitespace = new CompressWhitespace("CompressWhitespace"); compresswhitespace->execute(s, NULL); delete compresswhitespace; +CssDecode *cssdecode = new CssDecode("CssDecode"); cssdecode->execute(s, NULL); delete cssdecode; +EscapeSeqDecode *escapeseqdecode = new EscapeSeqDecode("EscapeSeqDecode"); escapeseqdecode->execute(s, NULL); delete escapeseqdecode; +HexDecode *hexdecode = new HexDecode("HexDecode"); hexdecode->execute(s, NULL); delete hexdecode; +HexEncode *hexencode = new HexEncode("HexEncode"); hexencode->execute(s, NULL); delete hexencode; +HtmlEntityDecode *htmlentitydecode = new HtmlEntityDecode("HtmlEntityDecode"); htmlentitydecode->execute(s, NULL); delete htmlentitydecode; +JsDecode *jsdecode = new JsDecode("JsDecode"); jsdecode->execute(s, NULL); delete jsdecode; +Length *length = new Length("Length"); length->execute(s, NULL); delete length; +LowerCase *lowercase = new LowerCase("LowerCase"); lowercase->execute(s, NULL); delete lowercase; +Md5 *md5 = new Md5("Md5"); md5->execute(s, NULL); delete md5; +None *none = new None("None"); none->execute(s, NULL); delete none; +NormalisePath *normalisepath = new NormalisePath("NormalisePath"); normalisepath->execute(s, NULL); delete normalisepath; +NormalisePathWin *normalisepathwin = new NormalisePathWin("NormalisePathWin"); normalisepathwin->execute(s, NULL); delete normalisepathwin; +ParityEven7bit *parityeven7bit = new ParityEven7bit("ParityEven7bit"); parityeven7bit->execute(s, NULL); delete parityeven7bit; +ParityOdd7bit *parityodd7bit = new ParityOdd7bit("ParityOdd7bit"); parityodd7bit->execute(s, NULL); delete parityodd7bit; +ParityZero7bit *parityzero7bit = new ParityZero7bit("ParityZero7bit"); parityzero7bit->execute(s, NULL); delete parityzero7bit; +RemoveComments *removecomments = new RemoveComments("RemoveComments"); removecomments->execute(s, NULL); delete removecomments; +RemoveCommentsChar *removecommentschar = new RemoveCommentsChar("RemoveCommentsChar"); removecommentschar->execute(s, NULL); delete removecommentschar; +RemoveNulls *removenulls = new RemoveNulls("RemoveNulls"); removenulls->execute(s, NULL); delete removenulls; +RemoveWhitespace *removewhitespace = new RemoveWhitespace("RemoveWhitespace"); removewhitespace->execute(s, NULL); delete removewhitespace; +ReplaceComments *replacecomments = new ReplaceComments("ReplaceComments"); replacecomments->execute(s, NULL); delete replacecomments; +ReplaceNulls *replacenulls = new ReplaceNulls("ReplaceNulls"); replacenulls->execute(s, NULL); delete replacenulls; +Sha1 *sha1 = new Sha1("Sha1"); sha1->execute(s, NULL); delete sha1; +SqlHexDecode *sqlhexdecode = new SqlHexDecode("SqlHexDecode"); sqlhexdecode->execute(s, NULL); delete sqlhexdecode; +Transformation *transformation = new Transformation("Transformation"); transformation->execute(s, NULL); delete transformation; +Trim *trim = new Trim("Trim"); trim->execute(s, NULL); delete trim; +TrimLeft *trimleft = new TrimLeft("TrimLeft"); trimleft->execute(s, NULL); delete trimleft; +TrimRight *trimright = new TrimRight("TrimRight"); trimright->execute(s, NULL); delete trimright; +UpperCase *uppercase = new UpperCase("UpperCase"); uppercase->execute(s, NULL); delete uppercase; +UrlDecode *urldecode = new UrlDecode("UrlDecode"); urldecode->execute(s, NULL); delete urldecode; +UrlDecodeUni *urldecodeuni = new UrlDecodeUni("UrlDecodeUni"); urldecodeuni->execute(s, NULL); delete urldecodeuni; +UrlEncode *urlencode = new UrlEncode("UrlEncode"); urlencode->execute(s, NULL); delete urlencode; +Utf8ToUnicode *utf8tounicode = new Utf8ToUnicode("Utf8ToUnicode"); utf8tounicode->execute(s, NULL); delete utf8tounicode; /** * Operators, generated by: * - * for i in $(grep "class " -Ri src/operators/* | grep " :" | awk {'print $2'}); do echo $i *$(echo $i | awk '{print tolower($0)}') = new $i\(\"$i\", z, false\)\; $(echo $i | awk '{print tolower($0)}')-\>evaluate\(t, s\)\; delete $(echo $i | awk '{print tolower($0)}')\;; done; + * for i in $(grep "class " -Ri src/operators/* | grep " :" | awk {'print $2'}); do echo $i *$(echo $i | awk '{print tolower($0)}') = new $i\(\"$i\", z, false\)\; $(echo $i | awk '{print tolower($0)}')-\>execute\(t, s\)\; delete $(echo $i | awk '{print tolower($0)}')\;; done; * */ op_test("BeginsWith", s); diff --git a/test/unit/unit.cc b/test/unit/unit.cc index f610a21e..dc029080 100644 --- a/test/unit/unit.cc +++ b/test/unit/unit.cc @@ -91,7 +91,7 @@ void perform_unit_test(ModSecurityTest *test, UnitTest *t, delete op; } else if (t->type == "tfn") { Transformation *tfn = Transformation::instantiate("t:" + t->name); - std::string ret = tfn->evaluate(t->input, NULL); + std::string ret = tfn->execute(t->input, NULL); t->obtained = 1; t->obtainedOutput = ret; if (ret != t->output) {