Very first commit: libmodsecurity

Check the README.md file for further information about the libmodsecurity.
This commit is contained in:
Felipe Zimmerle
2015-06-26 14:35:15 -03:00
parent 33cbe0452a
commit 95cb4c56ab
153 changed files with 12862 additions and 0 deletions

6
src/operators/.directory Normal file
View File

@@ -0,0 +1,6 @@
[Dolphin]
SortRole=type
Timestamp=2015,6,11,13,57,39
Version=3
ViewMode=1
VisibleRoles=Details_text,Details_size,Details_date,Details_type,CustomizedDetails

View File

@@ -0,0 +1,44 @@
/**
* 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.
*
*/
#include "operators/begins_with.h"
#include <string>
#include "operators/operator.h"
namespace ModSecurity {
namespace operators {
bool BeginsWith::evaluate(Assay *assay) {
/**
* @todo Implement the operator BeginsWith.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#beginswith
*/
return true;
}
BeginsWith::BeginsWith(std::string op, std::string param,
bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

View File

@@ -0,0 +1,39 @@
/**
* 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.
*
*/
#ifndef SRC_OPERATORS_BEGINS_WITH_H_
#define SRC_OPERATORS_BEGINS_WITH_H_
#include <string>
#include "operators/operator.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class BeginsWith : public Operator {
public:
/** @ingroup ModSecurity_Operator */
BeginsWith(std::string o, std::string p, bool i);
bool evaluate(Assay *assay);
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_BEGINS_WITH_H_

35
src/operators/contains.cc Normal file
View File

@@ -0,0 +1,35 @@
/**
* 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.
*
*/
#include "operators/contains.h"
#include <string>
namespace ModSecurity {
namespace operators {
bool Contains::evaluate(Assay *assay, const std::string &input) {
return input.find(this->param) != std::string::npos;
}
Contains::Contains(std::string _op, std::string _param,
bool negation)
: Operator() {
this->op = _op;
this->param = _param;
}
} // namespace operators
} // namespace ModSecurity

40
src/operators/contains.h Normal file
View File

@@ -0,0 +1,40 @@
/**
* 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.
*
*/
#ifndef SRC_OPERATORS_CONTAINS_H_
#define SRC_OPERATORS_CONTAINS_H_
#include <string>
#include "modsecurity/assay.h"
#include "operators/operator.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class Contains : public Operator {
public:
/** @ingroup ModSecurity_Operator */
Contains(std::string o, std::string p, bool i);
bool evaluate(Assay *assay, const std::string &exp) override;
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_CONTAINS_H_

View File

@@ -0,0 +1,65 @@
/**
* 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.
*
*/
#include "operators/contains_word.h"
#include <string>
#include <regex>
#include "operators/operator.h"
namespace ModSecurity {
namespace operators {
bool ContainsWord::evaluate(Assay *assay,
std::string input) {
/**
* @todo Implement the operator ContainsWord in a performative way.
*/
// FIXME: This is odd logic and should be removed in a future version
if (this->param == "") {
return 1;
}
// If our length is too long we will never match
if (this->param.length() > input.length()) {
return 0;
}
// If they are exact matches shortcut
if (this->param == input) {
return 1;
}
std::regex r("\\b" + this->param + "\\b");
std::smatch m;
if (std::regex_search(input, m, r)) {
// this won't find anything because 'spoons' is not
// the word you're searching for
return 1;
}
return 0;
}
ContainsWord::ContainsWord(std::string op,
std::string param, bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

View File

@@ -0,0 +1,40 @@
/**
* 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.
*
*/
#ifndef SRC_OPERATORS_CONTAINS_WORD_H_
#define SRC_OPERATORS_CONTAINS_WORD_H_
#include <string>
#include "operators/operator.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class ContainsWord : public Operator {
public:
/** @ingroup ModSecurity_Operator */
ContainsWord(std::string o, std::string p, bool i);
bool evaluate(Assay *assay, std::string exp);
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_CONTAINS_WORD_H_

View File

@@ -0,0 +1,43 @@
/**
* 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.
*
*/
#include "operators/detect_sqli.h"
#include <string>
#include "operators/operator.h"
namespace ModSecurity {
namespace operators {
bool DetectSQLi::evaluate(Assay *assay) {
/**
* @todo Implement the operator BeginsWith.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#detectsqli
*/
return true;
}
DetectSQLi::DetectSQLi(std::string op, std::string param,
bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

View File

@@ -0,0 +1,39 @@
/**
* 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.
*
*/
#ifndef SRC_OPERATORS_DETECT_SQLI_H_
#define SRC_OPERATORS_DETECT_SQLI_H_
#include <string>
#include "operators/operator.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class DetectSQLi : public Operator {
public:
/** @ingroup ModSecurity_Operator */
DetectSQLi(std::string o, std::string p, bool i);
bool evaluate(Assay *assay);
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_DETECT_SQLI_H_

View File

@@ -0,0 +1,42 @@
/**
* 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.
*
*/
#include "operators/detect_xss.h"
#include <string>
#include "operators/operator.h"
namespace ModSecurity {
namespace operators {
bool DetectXSS::evaluate(Assay *assay) {
/**
* @todo Implement the operator DetectXSS.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#detectxss
*/
return true;
}
DetectXSS::DetectXSS(std::string op, std::string param, bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

View File

@@ -0,0 +1,39 @@
/**
* 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.
*
*/
#ifndef SRC_OPERATORS_DETECT_XSS_H_
#define SRC_OPERATORS_DETECT_XSS_H_
#include <string>
#include "operators/operator.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class DetectXSS : public Operator {
public:
/** @ingroup ModSecurity_Operator */
DetectXSS(std::string o, std::string p, bool i);
bool evaluate(Assay *assay);
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_DETECT_XSS_H_

View File

@@ -0,0 +1,58 @@
/**
* 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.
*
*/
#include "operators/ends_with.h"
#include <string>
#include "operators/operator.h"
namespace ModSecurity {
namespace operators {
bool EndsWith::evaluate(Assay *assay,
std::string input) {
// Check that the param is not longer than the input
if (this->param.length() > input.length()) {
return 0;
}
// Check that the input != the param
if (this->param == input) {
return 1;
}
// Start at the end of the input minus the size of the input
std::string endString = input.substr(input.length() - \
(this->param.length()), (this->param.length()));
// FIXME: We can make this smalle
if (endString == this->param) {
return 1;
}
return 0;
}
EndsWith::EndsWith(std::string op, std::string param,
bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

40
src/operators/ends_with.h Normal file
View File

@@ -0,0 +1,40 @@
/**
* 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.
*
*/
#ifndef SRC_OPERATORS_ENDS_WITH_H_
#define SRC_OPERATORS_ENDS_WITH_H_
#include <string>
#include "operators/operator.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class EndsWith : public Operator {
public:
/** @ingroup ModSecurity_Operator */
EndsWith(std::string o, std::string p, bool i);
bool evaluate(Assay *assay, std::string exp);
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_ENDS_WITH_H_

42
src/operators/eq.cc Normal file
View File

@@ -0,0 +1,42 @@
/**
* 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.
*
*/
#include "operators/eq.h"
#include <string>
#include "operators/operator.h"
namespace ModSecurity {
namespace operators {
bool Eq::evaluate(Assay *assay) {
/**
* @todo Implement the operator Eq.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#eq
*/
return true;
}
Eq::Eq(std::string op, std::string param,
bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

39
src/operators/eq.h Normal file
View File

@@ -0,0 +1,39 @@
/**
* 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.
*
*/
#ifndef SRC_OPERATORS_EQ_H_
#define SRC_OPERATORS_EQ_H_
#include <string>
#include "operators/operator.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class Eq : public Operator {
public:
/** @ingroup ModSecurity_Operator */
Eq(std::string o, std::string p, bool i);
bool evaluate(Assay *assay);
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_EQ_H_

View File

@@ -0,0 +1,41 @@
/**
* 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.
*
*/
#include "operators/fuzzy_hash.h"
#include <string>
#include "operators/operator.h"
namespace ModSecurity {
namespace operators {
bool FuzzyHash::evaluate(Assay *assay) {
/**
* @todo Implement the operator FuzzyHash.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#fuzzyhash
*/
return true;
}
FuzzyHash::FuzzyHash(std::string op, std::string param,
bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

View File

@@ -0,0 +1,40 @@
/**
* 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.
*
*/
#ifndef SRC_OPERATORS_FUZZY_HASH_H_
#define SRC_OPERATORS_FUZZY_HASH_H_
#include <string>
#include "operators/operator.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class FuzzyHash : public Operator {
public:
/** @ingroup ModSecurity_Operator */
FuzzyHash(std::string o, std::string p, bool i);
bool evaluate(Assay *assay);
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_FUZZY_HASH_H_

43
src/operators/ge.cc Normal file
View File

@@ -0,0 +1,43 @@
/**
* 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.
*
*/
#include "operators/ge.h"
#include <string>
#include "operators/operator.h"
namespace ModSecurity {
namespace operators {
bool Ge::evaluate(Assay *assay) {
/**
* @todo Implement the operator Ge.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#ge
*/
return true;
}
Ge::Ge(std::string op, std::string param,
bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

39
src/operators/ge.h Normal file
View File

@@ -0,0 +1,39 @@
/**
* 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.
*
*/
#ifndef SRC_OPERATORS_GE_H_
#define SRC_OPERATORS_GE_H_
#include <string>
#include "operators/operator.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class Ge : public Operator {
public:
/** @ingroup ModSecurity_Operator */
Ge(std::string o, std::string p, bool i);
bool evaluate(Assay *assay);
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_GE_H_

View File

@@ -0,0 +1,41 @@
/**
* 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.
*
*/
#include "operators/geolookup.h"
#include <string>
#include "operators/operator.h"
namespace ModSecurity {
namespace operators {
bool GeoLookup::evaluate(Assay *assay) {
/**
* @todo Implement the operator GeoLookup.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#geolookup
*/
return true;
}
GeoLookup::GeoLookup(std::string op, std::string param,
bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

39
src/operators/geolookup.h Normal file
View File

@@ -0,0 +1,39 @@
/**
* 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.
*
*/
#ifndef SRC_OPERATORS_GEOLOOKUP_H_
#define SRC_OPERATORS_GEOLOOKUP_H_
#include <string>
#include "operators/operator.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class GeoLookup : public Operator {
public:
/** @ingroup ModSecurity_Operator */
GeoLookup(std::string o, std::string p, bool i);
bool evaluate(Assay *assay);
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_GEOLOOKUP_H_

View File

@@ -0,0 +1,42 @@
/**
* 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.
*
*/
#include "operators/gsblookup.h"
#include <string>
#include "operators/operator.h"
namespace ModSecurity {
namespace operators {
bool GsbLookup::evaluate(Assay *assay) {
/**
* @todo Implement the operator GeoLookup.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#gsblookup
*/
return true;
}
GsbLookup::GsbLookup(std::string op, std::string param,
bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

40
src/operators/gsblookup.h Normal file
View File

@@ -0,0 +1,40 @@
/**
* 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.
*
*/
#ifndef SRC_OPERATORS_GSBLOOKUP_H_
#define SRC_OPERATORS_GSBLOOKUP_H_
#include <string>
#include "operators/operator.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class GsbLookup : public Operator {
public:
/** @ingroup ModSecurity_Operator */
GsbLookup(std::string o, std::string p, bool i);
bool evaluate(Assay *assay);
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_GSBLOOKUP_H_

42
src/operators/gt.cc Normal file
View File

@@ -0,0 +1,42 @@
/**
* 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.
*
*/
#include "operators/gt.h"
#include <string>
#include "operators/operator.h"
namespace ModSecurity {
namespace operators {
bool Gt::evaluate(Assay *assay) {
/**
* @todo Implement the operator Gt.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#gt
*/
return true;
}
Gt::Gt(std::string op, std::string param,
bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

38
src/operators/gt.h Normal file
View File

@@ -0,0 +1,38 @@
/**
* 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.
*
*/
#ifndef SRC_OPERATORS_GT_H_
#define SRC_OPERATORS_GT_H_
#include <string>
#include "operators/operator.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class Gt : public Operator {
public:
/** @ingroup ModSecurity_Operator */
Gt(std::string o, std::string p, bool i);
bool evaluate(Assay *assay);
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_GT_H_

View File

@@ -0,0 +1,42 @@
/**
* 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.
*
*/
#include "operators/inspect_file.h"
#include <string>
#include "operators/operator.h"
namespace ModSecurity {
namespace operators {
bool InspectFile::evaluate(Assay *assay) {
/**
* @todo Implement the operator InspectFile.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#inspectfile
*/
return true;
}
InspectFile::InspectFile(std::string op, std::string param,
bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

View File

@@ -0,0 +1,39 @@
/**
* 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.
*
*/
#ifndef SRC_OPERATORS_INSPECT_FILE_H_
#define SRC_OPERATORS_INSPECT_FILE_H_
#include <string>
#include "operators/operator.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class InspectFile : public Operator {
public:
/** @ingroup ModSecurity_Operator */
InspectFile(std::string o, std::string p, bool i);
bool evaluate(Assay *assay);
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_INSPECT_FILE_H_

43
src/operators/ip_match.cc Normal file
View File

@@ -0,0 +1,43 @@
/**
* 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.
*
*/
#include "operators/ip_match.h"
#include <string>
#include "operators/operator.h"
namespace ModSecurity {
namespace operators {
bool IpMatch::evaluate(Assay *assay) {
/**
* @todo Implement the operator IpMatch.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#ipmatch
*/
return true;
}
IpMatch::IpMatch(std::string op, std::string param,
bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

39
src/operators/ip_match.h Normal file
View File

@@ -0,0 +1,39 @@
/**
* 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.
*
*/
#ifndef SRC_OPERATORS_IP_MATCH_H_
#define SRC_OPERATORS_IP_MATCH_H_
#include <string>
#include "operators/operator.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class IpMatch : public Operator {
public:
/** @ingroup ModSecurity_Operator */
IpMatch(std::string o, std::string p, bool i);
bool evaluate(Assay *assay);
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_IP_MATCH_H_

View File

@@ -0,0 +1,42 @@
/**
* 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.
*
*/
#include "operators/ip_match_f.h"
#include <string>
#include "operators/operator.h"
namespace ModSecurity {
namespace operators {
bool IpMatchF::evaluate(Assay *assay) {
/**
* @todo Implement the operator IpMatchF.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#ipmatchf
*/
return true;
}
IpMatchF::IpMatchF(std::string op, std::string param,
bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

View File

@@ -0,0 +1,39 @@
/**
* 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.
*
*/
#ifndef SRC_OPERATORS_IP_MATCH_F_H_
#define SRC_OPERATORS_IP_MATCH_F_H_
#include <string>
#include "operators/operator.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class IpMatchF : public Operator {
public:
/** @ingroup ModSecurity_Operator */
IpMatchF(std::string p, std::string o, bool i);
bool evaluate(Assay *assay);
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_IP_MATCH_F_H_

View File

@@ -0,0 +1,42 @@
/**
* 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.
*
*/
#include "operators/ip_match_from_file.h"
#include <string>
#include "operators/operator.h"
namespace ModSecurity {
namespace operators {
bool IpMatchFromFile::evaluate(Assay *assay) {
/**
* @todo Implement the operator IpMatchFromFile.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#ipmatchfromfile
*/
return true;
}
IpMatchFromFile::IpMatchFromFile(std::string op, std::string param,
bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

View File

@@ -0,0 +1,38 @@
/**
* 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.
*
*/
#ifndef SRC_OPERATORS_IP_MATCH_FROM_FILE_H_
#define SRC_OPERATORS_IP_MATCH_FROM_FILE_H_
#include <string>
#include "operators/operator.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class IpMatchFromFile : public Operator {
public:
/** @ingroup ModSecurity_Operator */
IpMatchFromFile(std::string o, std::string p, bool i);
bool evaluate(Assay *assay);
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_IP_MATCH_FROM_FILE_H_

41
src/operators/le.cc Normal file
View File

@@ -0,0 +1,41 @@
/**
* 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.
*
*/
#include "operators/le.h"
#include <string>
#include "operators/operator.h"
namespace ModSecurity {
namespace operators {
bool Le::evaluate(Assay *assay) {
/**
* @todo Implement the operator Le.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#le
*/
return true;
}
Le::Le(std::string op, std::string param, bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

41
src/operators/le.h Normal file
View File

@@ -0,0 +1,41 @@
/**
* 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.
*
*/
#ifndef SRC_OPERATORS_LE_H_
#define SRC_OPERATORS_LE_H_
#include <string>
#include "operators/operator.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class Le : public Operator {
public:
/** @ingroup ModSecurity_Operator */
Le(std::string o, std::string p, bool i);
bool evaluate(Assay *assay);
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_LE_H_

41
src/operators/lt.cc Normal file
View File

@@ -0,0 +1,41 @@
/**
* 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.
*
*/
#include "operators/lt.h"
#include <string>
#include "operators/operator.h"
namespace ModSecurity {
namespace operators {
bool Lt::evaluate(Assay *assay) {
/**
* @todo Implement the operator Lt.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#lt
*/
return true;
}
Lt::Lt(std::string op, std::string param, bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

40
src/operators/lt.h Normal file
View File

@@ -0,0 +1,40 @@
/**
* 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.
*
*/
#ifndef SRC_OPERATORS_LT_H_
#define SRC_OPERATORS_LT_H_
#include <string>
#include "operators/operator.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class Lt : public Operator {
public:
/** @ingroup ModSecurity_Operator */
Lt(std::string o, std::string p, bool i);
bool evaluate(Assay *assay);
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_LT_H_

177
src/operators/operator.cc Normal file
View File

@@ -0,0 +1,177 @@
/**
* 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.
*
*/
#include "operators/operator.h"
#include <cstring>
#include <string>
#include "modsecurity/assay.h"
#include "operators/detect_sqli.h"
#include "operators/detect_xss.h"
#include "operators/inspect_file.h"
#include "operators/fuzzy_hash.h"
#include "operators/validate_byte_range.h"
#include "operators/validate_dtd.h"
#include "operators/validate_hash.h"
#include "operators/validate_schema.h"
#include "operators/validate_url_encoding.h"
#include "operators/validate_utf8_encoding.h"
#include "operators/verify_cc.h"
#include "operators/verify_cpf.h"
#include "operators/verify_ssn.h"
#include "operators/geolookup.h"
#include "operators/gsblookup.h"
#include "operators/rsub.h"
#include "operators/within.h"
#include "operators/contains_word.h"
#include "operators/contains.h"
#include "operators/ends_with.h"
#include "operators/eq.h"
#include "operators/ge.h"
#include "operators/gt.h"
#include "operators/ip_match_f.h"
#include "operators/ip_match.h"
#include "operators/ip_match_from_file.h"
#include "operators/le.h"
#include "operators/lt.h"
#include "operators/pm_f.h"
#include "operators/pm.h"
#include "operators/pm_from_file.h"
#include "operators/rbl.h"
#include "operators/rx.h"
#include "operators/str_eq.h"
#include "operators/str_match.h"
#include "operators/begins_with.h"
#define IF_MATCH(a) \
if (op.compare(1, std::strlen(#a), #a) == 0)
namespace ModSecurity {
namespace operators {
Operator::Operator() {
}
Operator::Operator(std::string op, std::string param, bool negation) {
this->op = op;
this->param = param;
}
bool Operator::evaluate(Assay *assay) {
if (assay) {
assay->debug(2, "Operator: " + this->op + \
" is not implemented or malfunctioning.");
}
return true;
}
bool Operator::evaluate(Assay *assay, const std::string& a) {
if (assay) {
assay->debug(2, "Operator: " + this->op + \
" is not implemented or malfunctioning.");
}
return true;
}
Operator *Operator::instantiate(std::string op_string) {
// Sanity check.
if (op_string.size() <= 2) {
return NULL;
}
std::string op = op_string;
op = op.substr(1, op_string.size() - 2);
// We assume no negation by default
bool negation = false;
// If there is a '!' in front substring and assign negation
if (op.at(0) == '!') {
op = op.substr(1, op.size() - 1);
negation = true;
}
// Check to see if there is a parameter, if not param is an empty string
std::string param = "";
if (op.find(" ") != std::string::npos) {
param = op;
param.erase(0, op_string.find(" "));
op.erase(op_string.find(" "),
op_string.length() - op_string.find(" "));
}
for (std::basic_string<char>::iterator p = op.begin();
p != op.end(); ++p) {
*p = tolower(*p);
}
IF_MATCH(beginswith) { return new BeginsWith(op, param, negation); }
IF_MATCH(contains) { return new Contains(op, param, negation); }
IF_MATCH(containsword) { return new ContainsWord(op, param, negation); }
IF_MATCH(detectsqli) { return new DetectSQLi(op, param, negation); }
IF_MATCH(detectxss) { return new DetectXSS(op, param, negation); }
IF_MATCH(endswith) { return new EndsWith(op, param, negation); }
IF_MATCH(eq) { return new Eq(op, param, negation); }
IF_MATCH(fuzzyhash) { return new FuzzyHash(op, param, negation); }
IF_MATCH(geolookup) { return new GeoLookup(op, param, negation); }
IF_MATCH(ge) { return new Ge(op, param, negation); }
IF_MATCH(gsblookup) { return new GsbLookup(op, param, negation); }
IF_MATCH(gt) { return new Gt(op, param, negation); }
IF_MATCH(inspectfile) { return new InspectFile(op, param, negation); }
IF_MATCH(ipmatchf) { return new IpMatchF(op, param, negation); }
IF_MATCH(ipmatchfromfile) {
return new IpMatchFromFile(op, param, negation);
}
IF_MATCH(ipmatch) { return new IpMatch(op, param, negation); }
IF_MATCH(le) { return new Le(op, param, negation); }
IF_MATCH(lt) { return new Lt(op, param, negation); }
IF_MATCH(pmf) { return new PmF(op, param, negation); }
IF_MATCH(pmfromfile) { return new PmFromFile(op, param, negation); }
IF_MATCH(pm) { return new Pm(op, param, negation); }
IF_MATCH(rbl) { return new Rbl(op, param, negation); }
IF_MATCH(rsub) { return new Rsub(op, param, negation); }
IF_MATCH(rx) { return new Rx(op, param, negation); }
IF_MATCH(streq) { return new StrEq(op, param, negation); }
IF_MATCH(strmatch) { return new StrMatch(op, param, negation); }
IF_MATCH(validatebyterange) {
return new ValidateByteRange(op, param, negation);
}
IF_MATCH(validatedtd) { return new ValidateDTD(op, param, negation); }
IF_MATCH(validatehash) { return new ValidateHash(op, param, negation); }
IF_MATCH(validateschema) { return new ValidateSchema(op, param, negation); }
IF_MATCH(validateurlencoding) {
return new ValidateUrlEncoding(op, param, negation);
}
IF_MATCH(validateutf8encoding) {
return new ValidateUtf8Encoding(op, param, negation);
}
IF_MATCH(verifycc) { return new VerifyCC(op, param, negation); }
IF_MATCH(verifycpf) { return new VerifyCPF(op, param, negation); }
IF_MATCH(verifyssn) { return new VerifySSN(op, param, negation); }
IF_MATCH(within) { return new Within(op, param, negation); }
return new Operator(op, param, negation);
}
} // namespace operators
} // namespace ModSecurity

49
src/operators/operator.h Normal file
View File

@@ -0,0 +1,49 @@
/**
* 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 <string>
#endif
#ifndef SRC_OPERATORS_OPERATOR_H__
#define SRC_OPERATORS_OPERATOR_H__
#include "modsecurity/assay.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class Operator {
public:
/** @ingroup ModSecurity_Operator */
Operator();
Operator(std::string po, std::string param, bool invert);
std::string op;
std::string param;
virtual bool evaluate(Assay *assay);
virtual bool evaluate(Assay *assay, const std::string &str);
static Operator *instantiate(std::string op);
protected:
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_OPERATOR_H__

41
src/operators/pm.cc Normal file
View File

@@ -0,0 +1,41 @@
/**
* 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.
*
*/
#include "operators/pm.h"
#include <string>
#include "operators/operator.h"
namespace ModSecurity {
namespace operators {
bool Pm::evaluate(Assay *assay) {
/**
* @todo Implement the operator Pm.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#pm
*/
return true;
}
Pm::Pm(std::string op, std::string param, bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

39
src/operators/pm.h Normal file
View File

@@ -0,0 +1,39 @@
/**
* 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.
*
*/
#ifndef SRC_OPERATORS_PM_H_
#define SRC_OPERATORS_PM_H_
#include <string>
#include "operators/operator.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class Pm : public Operator {
public:
/** @ingroup ModSecurity_Operator */
Pm(std::string o, std::string p, bool i);
bool evaluate(Assay *assay);
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_PM_H_

41
src/operators/pm_f.cc Normal file
View File

@@ -0,0 +1,41 @@
/**
* 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.
*
*/
#include "operators/pm_f.h"
#include <string>
#include "operators/operator.h"
namespace ModSecurity {
namespace operators {
bool PmF::evaluate(Assay *assay) {
/**
* @todo Implement the operator PmF.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#pmf
*/
return true;
}
PmF::PmF(std::string op, std::string param, bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

39
src/operators/pm_f.h Normal file
View File

@@ -0,0 +1,39 @@
/**
* 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.
*
*/
#ifndef SRC_OPERATORS_PM_F_H_
#define SRC_OPERATORS_PM_F_H_
#include <string>
#include "operators/operator.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class PmF : public Operator {
public:
/** @ingroup ModSecurity_Operator */
PmF(std::string o, std::string p, bool i);
bool evaluate(Assay *assay);
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_PM_F_H_

View File

@@ -0,0 +1,41 @@
/**
* 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.
*
*/
#include "operators/pm_from_file.h"
#include <string>
#include "operators/operator.h"
namespace ModSecurity {
namespace operators {
bool PmFromFile::evaluate(Assay *assay) {
/**
* @todo Implement the operator PmFromFile.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#pmfromfile
*/
return true;
}
PmFromFile::PmFromFile(std::string op, std::string param, bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

View File

@@ -0,0 +1,40 @@
/**
* 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.
*
*/
#ifndef SRC_OPERATORS_PM_FROM_FILE_H_
#define SRC_OPERATORS_PM_FROM_FILE_H_
#include <string>
#include "operators/operator.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class PmFromFile : public Operator {
public:
/** @ingroup ModSecurity_Operator */
PmFromFile(std::string o, std::string p, bool i);
bool evaluate(Assay *assay);
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_PM_FROM_FILE_H_

41
src/operators/rbl.cc Normal file
View File

@@ -0,0 +1,41 @@
/**
* 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.
*
*/
#include "operators/rbl.h"
#include <string>
#include "operators/operator.h"
namespace ModSecurity {
namespace operators {
bool Rbl::evaluate(Assay *assay) {
/**
* @todo Implement the operator Rbl.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#rbl
*/
return true;
}
Rbl::Rbl(std::string op, std::string param, bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

40
src/operators/rbl.h Normal file
View File

@@ -0,0 +1,40 @@
/**
* 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.
*
*/
#ifndef SRC_OPERATORS_RBL_H_
#define SRC_OPERATORS_RBL_H_
#include <string>
#include "operators/operator.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class Rbl : public Operator {
public:
/** @ingroup ModSecurity_Operator */
Rbl(std::string o, std::string p, bool i);
bool evaluate(Assay *assay);
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_RBL_H_

41
src/operators/rsub.cc Normal file
View File

@@ -0,0 +1,41 @@
/**
* 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.
*
*/
#include "operators/rsub.h"
#include <string>
#include "operators/operator.h"
namespace ModSecurity {
namespace operators {
bool Rsub::evaluate(Assay *assay) {
/**
* @todo Implement the operator Rsub.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#rsub
*/
return true;
}
Rsub::Rsub(std::string op, std::string param, bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

38
src/operators/rsub.h Normal file
View File

@@ -0,0 +1,38 @@
/**
* 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.
*
*/
#ifndef SRC_OPERATORS_RSUB_H_
#define SRC_OPERATORS_RSUB_H_
#include <string>
#include "operators/operator.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class Rsub : public Operator {
public:
/** @ingroup ModSecurity_Operator */
Rsub(std::string o, std::string p, bool i);
bool evaluate(Assay *assay);
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_RSUB_H_

41
src/operators/rx.cc Normal file
View File

@@ -0,0 +1,41 @@
/**
* 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.
*
*/
#include "operators/rx.h"
#include <string>
#include "operators/operator.h"
namespace ModSecurity {
namespace operators {
bool Rx::evaluate(Assay *assay) {
/**
* @todo Implement the operator Rx.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#rx
*/
return true;
}
Rx::Rx(std::string op, std::string param, bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

39
src/operators/rx.h Normal file
View File

@@ -0,0 +1,39 @@
/**
* 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.
*
*/
#ifndef SRC_OPERATORS_RX_H_
#define SRC_OPERATORS_RX_H_
#include <string>
#include "operators/operator.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class Rx : public Operator {
public:
/** @ingroup ModSecurity_Operator */
Rx(std::string o, std::string p, bool i);
bool evaluate(Assay *assay);
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_RX_H_

39
src/operators/str_eq.cc Normal file
View File

@@ -0,0 +1,39 @@
/**
* 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.
*
*/
#include "operators/str_eq.h"
#include <string>
namespace ModSecurity {
namespace operators {
bool StrEq::evaluate(Assay *assay, const std::string &str) {
/**
* @todo Implement the operator StrEq.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#streq
*/
return !this->param.compare(str);
}
StrEq::StrEq(std::string op, std::string param, bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

43
src/operators/str_eq.h Normal file
View File

@@ -0,0 +1,43 @@
/**
* 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.
*
*/
#include <string>
#include "modsecurity/assay.h"
#include "operators/operator.h"
#ifndef SRC_OPERATORS_STR_EQ_H_
#define SRC_OPERATORS_STR_EQ_H_
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class StrEq : public Operator {
public:
/** @ingroup ModSecurity_Operator */
StrEq(std::string o, std::string p, bool i);
bool evaluate(Assay *assay, const std::string &str) override;
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_STR_EQ_H_

View File

@@ -0,0 +1,41 @@
/**
* 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.
*
*/
#include "operators/str_match.h"
#include <string>
#include "operators/operator.h"
namespace ModSecurity {
namespace operators {
bool StrMatch::evaluate(Assay *assay) {
/**
* @todo Implement the operator StrMatch.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#strmatch
*/
return true;
}
StrMatch::StrMatch(std::string op, std::string param, bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

39
src/operators/str_match.h Normal file
View File

@@ -0,0 +1,39 @@
/**
* 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.
*
*/
#ifndef SRC_OPERATORS_STR_MATCH_H_
#define SRC_OPERATORS_STR_MATCH_H_
#include <string>
#include "operators/operator.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class StrMatch : public Operator {
public:
/** @ingroup ModSecurity_Operator */
StrMatch(std::string o, std::string p, bool i);
bool evaluate(Assay *assay);
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_STR_MATCH_H_

View File

@@ -0,0 +1,42 @@
/**
* 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.
*
*/
#include "operators/validate_byte_range.h"
#include <string>
#include "operators/operator.h"
namespace ModSecurity {
namespace operators {
bool ValidateByteRange::evaluate(Assay *assay) {
/**
* @todo Implement the operator ValidateByteRange.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#validateByteRange
*/
return true;
}
ValidateByteRange::ValidateByteRange(std::string op, std::string param,
bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

View File

@@ -0,0 +1,40 @@
/**
* 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.
*
*/
#ifndef SRC_OPERATORS_VALIDATE_BYTE_RANGE_H_
#define SRC_OPERATORS_VALIDATE_BYTE_RANGE_H_
#include <string>
#include "operators/operator.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class ValidateByteRange : public Operator {
public:
/** @ingroup ModSecurity_Operator */
ValidateByteRange(std::string o, std::string p, bool i);
bool evaluate(Assay *assay);
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_VALIDATE_BYTE_RANGE_H_

View File

@@ -0,0 +1,41 @@
/**
* 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.
*
*/
#include "operators/validate_dtd.h"
#include <string>
#include "operators/operator.h"
namespace ModSecurity {
namespace operators {
bool ValidateDTD::evaluate(Assay *assay) {
/**
* @todo Implement the operator ValidateDTD.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#validateDTD
*/
return true;
}
ValidateDTD::ValidateDTD(std::string op, std::string param, bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

View File

@@ -0,0 +1,39 @@
/**
* 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.
*
*/
#ifndef SRC_OPERATORS_VALIDATE_DTD_H_
#define SRC_OPERATORS_VALIDATE_DTD_H_
#include <string>
#include "operators/operator.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class ValidateDTD : public Operator {
public:
/** @ingroup ModSecurity_Operator */
ValidateDTD(std::string o, std::string p, bool i);
bool evaluate(Assay *assay);
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_VALIDATE_DTD_H_

View File

@@ -0,0 +1,41 @@
/**
* 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.
*
*/
#include "operators/validate_hash.h"
#include <string>
#include "operators/operator.h"
namespace ModSecurity {
namespace operators {
bool ValidateHash::evaluate(Assay *assay) {
/**
* @todo Implement the operator ValidateHash.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#validateHash
*/
return true;
}
ValidateHash::ValidateHash(std::string op, std::string param, bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

View File

@@ -0,0 +1,39 @@
/**
* 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.
*
*/
#ifndef SRC_OPERATORS_VALIDATE_HASH_H_
#define SRC_OPERATORS_VALIDATE_HASH_H_
#include <string>
#include "operators/operator.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class ValidateHash : public Operator {
public:
/** @ingroup ModSecurity_Operator */
ValidateHash(std::string o, std::string p, bool i);
bool evaluate(Assay *assay);
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_VALIDATE_HASH_H_

View File

@@ -0,0 +1,41 @@
/**
* 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.
*
*/
#include "operators/validate_schema.h"
#include <string>
#include "operators/operator.h"
namespace ModSecurity {
namespace operators {
bool ValidateSchema::evaluate(Assay *assay) {
/**
* @todo Implement the operator ValidateSchema.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#validateSchema
*/
return true;
}
ValidateSchema::ValidateSchema(std::string op, std::string param, bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

View File

@@ -0,0 +1,39 @@
/**
* 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.
*
*/
#ifndef SRC_OPERATORS_VALIDATE_SCHEMA_H_
#define SRC_OPERATORS_VALIDATE_SCHEMA_H_
#include <string>
#include "operators/operator.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class ValidateSchema : public Operator {
public:
/** @ingroup ModSecurity_Operator */
ValidateSchema(std::string o, std::string p, bool i);
bool evaluate(Assay *assay);
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_VALIDATE_SCHEMA_H_

View File

@@ -0,0 +1,42 @@
/**
* 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.
*
*/
#include "operators/validate_url_encoding.h"
#include <string>
#include "operators/operator.h"
namespace ModSecurity {
namespace operators {
bool ValidateUrlEncoding::evaluate(Assay *assay) {
/**
* @todo Implement the operator ValidateUrlEncoding.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#validateUrlEncoding
*/
return true;
}
ValidateUrlEncoding::ValidateUrlEncoding(std::string op, std::string param,
bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

View File

@@ -0,0 +1,39 @@
/**
* 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.
*
*/
#ifndef SRC_OPERATORS_VALIDATE_URL_ENCODING_H_
#define SRC_OPERATORS_VALIDATE_URL_ENCODING_H_
#include <string>
#include "operators/operator.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class ValidateUrlEncoding : public Operator {
public:
/** @ingroup ModSecurity_Operator */
ValidateUrlEncoding(std::string o, std::string p, bool i);
bool evaluate(Assay *assay);
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_VALIDATE_URL_ENCODING_H_

View File

@@ -0,0 +1,42 @@
/**
* 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.
*
*/
#include "operators/validate_utf8_encoding.h"
#include <string>
#include "operators/operator.h"
namespace ModSecurity {
namespace operators {
bool ValidateUtf8Encoding::evaluate(Assay *assay) {
/**
* @todo Implement the operator ValidateUtf8Encoding.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#validateUtf8Encoding
*/
return true;
}
ValidateUtf8Encoding::ValidateUtf8Encoding(std::string op, std::string param,
bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

View File

@@ -0,0 +1,41 @@
/**
* 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.
*
*/
#ifndef SRC_OPERATORS_VALIDATE_UTF8_ENCODING_H_
#define SRC_OPERATORS_VALIDATE_UTF8_ENCODING_H_
#include <string>
#include "operators/operator.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class ValidateUtf8Encoding : public Operator {
public:
/** @ingroup ModSecurity_Operator */
ValidateUtf8Encoding(std::string o, std::string p, bool i);
bool evaluate(Assay *assay);
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_VALIDATE_UTF8_ENCODING_H_

View File

@@ -0,0 +1,41 @@
/**
* 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.
*
*/
#include "operators/verify_cc.h"
#include <iostream>
#include "operators/operator.h"
namespace ModSecurity {
namespace operators {
bool VerifyCC::evaluate(Assay *assay) {
/**
* @todo Implement the operator VerifyCC.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#verifyCC
*/
return true;
}
VerifyCC::VerifyCC(std::string op, std::string param, bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

40
src/operators/verify_cc.h Normal file
View File

@@ -0,0 +1,40 @@
/**
* 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.
*
*/
#ifndef SRC_OPERATORS_VERIFY_CC_H_
#define SRC_OPERATORS_VERIFY_CC_H_
#include <string>
#include "operators/operator.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class VerifyCC : public Operator {
public:
/** @ingroup ModSecurity_Operator */
VerifyCC(std::string o, std::string p, bool i);
bool evaluate(Assay *assay);
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_VERIFY_CC_H_

View File

@@ -0,0 +1,41 @@
/**
* 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.
*
*/
#include "operators/verify_cpf.h"
#include <string>
#include "operators/operator.h"
namespace ModSecurity {
namespace operators {
bool VerifyCPF::evaluate(Assay *assay) {
/**
* @todo Implement the operator VerifyCPF.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#verifyCPF
*/
return true;
}
VerifyCPF::VerifyCPF(std::string op, std::string param, bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

View File

@@ -0,0 +1,40 @@
/**
* 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.
*
*/
#ifndef SRC_OPERATORS_VERIFY_CPF_H_
#define SRC_OPERATORS_VERIFY_CPF_H_
#include <string>
#include "operators/operator.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class VerifyCPF : public Operator {
public:
/** @ingroup ModSecurity_Operator */
VerifyCPF(std::string o, std::string p, bool i);
bool evaluate(Assay *assay);
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_VERIFY_CPF_H_

View File

@@ -0,0 +1,40 @@
/**
* 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.
*
*/
#include "operators/verify_ssn.h"
#include <string>
#include "operators/operator.h"
namespace ModSecurity {
namespace operators {
bool VerifySSN::evaluate(Assay *assay) {
/**
* @todo Implement the operator VerifySSN.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#verifySSN
*/
return true;
}
VerifySSN::VerifySSN(std::string op, std::string param, bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

View File

@@ -0,0 +1,40 @@
/**
* 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.
*
*/
#ifndef SRC_OPERATORS_VERIFY_SSN_H_
#define SRC_OPERATORS_VERIFY_SSN_H_
#include <string>
#include "operators/operator.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class VerifySSN : public Operator {
public:
/** @ingroup ModSecurity_Operator */
VerifySSN(std::string o, std::string p, bool i);
bool evaluate(Assay *assay);
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_VERIFY_SSN_H_

41
src/operators/within.cc Normal file
View File

@@ -0,0 +1,41 @@
/**
* 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.
*
*/
#include "operators/within.h"
#include <string>
#include "operators/operator.h"
namespace ModSecurity {
namespace operators {
bool Within::evaluate(Assay *assay) {
/**
* @todo Implement the operator Within.
* Reference: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#within
*/
return true;
}
Within::Within(std::string op, std::string param, bool negation)
: Operator() {
this->op = op;
this->param = param;
}
} // namespace operators
} // namespace ModSecurity

39
src/operators/within.h Normal file
View File

@@ -0,0 +1,39 @@
/**
* 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.
*
*/
#ifndef SRC_OPERATORS_WITHIN_H_
#define SRC_OPERATORS_WITHIN_H_
#include <string>
#include "operators/operator.h"
#ifdef __cplusplus
namespace ModSecurity {
namespace operators {
class Within : public Operator {
public:
/** @ingroup ModSecurity_Operator */
Within(std::string o, std::string p, bool i);
bool evaluate(Assay *assay);
};
} // namespace operators
} // namespace ModSecurity
#endif
#endif // SRC_OPERATORS_WITHIN_H_