mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 19:24:29 +03:00
Fix a few things to provide an easy interface for script bindings
This commit is contained in:
@@ -173,7 +173,7 @@ class Assay {
|
||||
std::list<std::string> rulesMessages;
|
||||
std::list<std::string> ruleTags;
|
||||
|
||||
std::list<std::pair<int, std::string>> auditLogModifier;
|
||||
std::list< std::pair<int, std::string> > auditLogModifier;
|
||||
std::string m_marker;
|
||||
|
||||
private:
|
||||
|
@@ -140,7 +140,7 @@ class ModSecurity {
|
||||
ModSecurity();
|
||||
~ModSecurity();
|
||||
|
||||
static std::string whoAmI();
|
||||
static const std::string whoAmI();
|
||||
void setConnectorInformation(std::string connector);
|
||||
void setServerLogCb(LogCb cb);
|
||||
void serverLog(void *data, const std::string& msg);
|
||||
|
91
headers/modsecurity/rule.h
Normal file
91
headers/modsecurity/rule.h
Normal file
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* ModSecurity, http://www.modsecurity.org/
|
||||
* Copyright (c) 2015 Trustwave Holdings, Inc. (http://www.trustwave.com/)
|
||||
*
|
||||
* You may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* If any of the files related to licensing are missing or if you have any
|
||||
* other questions related to licensing please contact Trustwave Holdings, Inc.
|
||||
* directly using the email address security@modsecurity.org.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <stack>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#endif
|
||||
|
||||
#ifndef SRC_RULE_H_
|
||||
#define SRC_RULE_H_
|
||||
|
||||
#include "modsecurity/modsecurity.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace modsecurity {
|
||||
namespace Variables {
|
||||
class Variable;
|
||||
}
|
||||
|
||||
class Rule {
|
||||
public:
|
||||
Rule(operators::Operator *_op,
|
||||
std::vector<Variables::Variable *> *_variables,
|
||||
std::vector<actions::Action *> *_actions,
|
||||
std::string fileName,
|
||||
int lineNumber);
|
||||
explicit Rule(std::string marker);
|
||||
|
||||
~Rule();
|
||||
bool evaluate(Assay *assay);
|
||||
bool evaluateActions(Assay *assay);
|
||||
|
||||
operators::Operator *op;
|
||||
std::vector<actions::Action *> actions_conf;
|
||||
std::vector<actions::Action *> actions_runtime_pre;
|
||||
std::vector<actions::Action *> actions_runtime_pos;
|
||||
|
||||
std::vector<std::string> getActionNames();
|
||||
|
||||
std::vector<Variables::Variable *> *variables;
|
||||
int phase;
|
||||
long rule_id;
|
||||
|
||||
Rule *chainedRule;
|
||||
bool chained;
|
||||
|
||||
void refCountDecreaseAndCheck() {
|
||||
this->m_referenceCount--;
|
||||
if (this->m_referenceCount == 0) {
|
||||
delete this;
|
||||
}
|
||||
}
|
||||
|
||||
void refCountIncrease() {
|
||||
this->m_referenceCount++;
|
||||
}
|
||||
|
||||
std::string rev;
|
||||
|
||||
std::string m_marker;
|
||||
bool m_secmarker;
|
||||
std::string m_fileName;
|
||||
int m_lineNumber;
|
||||
|
||||
private:
|
||||
bool m_unconditional;
|
||||
int m_referenceCount;
|
||||
};
|
||||
|
||||
} // namespace modsecurity
|
||||
#endif
|
||||
|
||||
|
||||
#endif // SRC_RULE_H_
|
||||
|
||||
|
@@ -92,6 +92,14 @@ class RulesProperties {
|
||||
}
|
||||
|
||||
std::vector<Rule *> rules[7];
|
||||
std::vector<Rule *> * getRulesForPhase(int phase) {
|
||||
if (phase > 7)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return &rules[phase];
|
||||
};
|
||||
|
||||
// ModSecurity::Phases::NUMBER_OF_PHASES
|
||||
std::vector<actions::Action *> defaultActions[7];
|
||||
// ModSecurity::Phases::NUMBER_OF_PHASES
|
||||
|
@@ -51,9 +51,6 @@ class Variables :
|
||||
|
||||
std::string* resolveFirst(const std::string& var);
|
||||
|
||||
std::string* resolveFirst(const std::string& collectionName,
|
||||
const std::string& var);
|
||||
|
||||
|
||||
void resolveSingleMatch(const std::string& var,
|
||||
std::vector<const transaction::Variable *> *l);
|
||||
|
Reference in New Issue
Block a user