mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 19:24:29 +03:00
Changes library namespace from ModSecurity to modsecurity
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
#include "modsecurity/modsecurity.h"
|
||||
#include "modsecurity/rules.h"
|
||||
|
||||
using ModSecurity::Assay;
|
||||
using modsecurity::Assay;
|
||||
|
||||
char request_header[] = "" \
|
||||
"GET /tutorials/other/top-20-mysql-best-practices/ HTTP/1.1\n\r" \
|
||||
@@ -70,15 +70,15 @@ char rules_file[] = "basic_rules.conf";
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int i = 0;
|
||||
ModSecurity::ModSecurity *modsec;
|
||||
ModSecurity::Rules *rules;
|
||||
ModSecurity::ModSecurityIntervention it;
|
||||
modsecurity::ModSecurity *modsec;
|
||||
modsecurity::Rules *rules;
|
||||
modsecurity::ModSecurityIntervention it;
|
||||
|
||||
modsec = new ModSecurity::ModSecurity();
|
||||
modsec = new modsecurity::ModSecurity();
|
||||
modsec->setConnectorInformation("ModSecurity-benchmark v0.0.1-alpha" \
|
||||
" (ModSecurity benchmark utility)");
|
||||
|
||||
rules = new ModSecurity::Rules();
|
||||
rules = new modsecurity::Rules();
|
||||
if (rules->loadFromUri(rules_file) < 0) {
|
||||
std::cout << "Problems loading the rules..." << std::endl;
|
||||
std::cout << rules->parserError.str() << std::endl;
|
||||
|
@@ -36,13 +36,13 @@ void print_help() {
|
||||
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
ModSecurity::Rules *modsecRules = new ModSecurity::Rules();
|
||||
modsecurity::Rules *modsecRules = new modsecurity::Rules();
|
||||
std::vector<std::string> files;
|
||||
int total = 0;
|
||||
|
||||
int i = 1;
|
||||
while (i < argc) {
|
||||
std::vector<std::string> tfiles = ModSecurity::expandEnv(argv[i] , 0);
|
||||
std::vector<std::string> tfiles = modsecurity::expandEnv(argv[i] , 0);
|
||||
for (const auto &file : tfiles) {
|
||||
files.insert(files.begin(), file);
|
||||
}
|
||||
@@ -64,7 +64,7 @@ int main(int argc, char **argv) {
|
||||
std::cout << "Rules optimization" << std::endl;
|
||||
std::cout << std::endl;
|
||||
|
||||
int nphases = ModSecurity::ModSecurity::Phases::NUMBER_OF_PHASES;
|
||||
int nphases = modsecurity::ModSecurity::Phases::NUMBER_OF_PHASES;
|
||||
for (int i = 0; i < nphases; i++) {
|
||||
std::vector<Rule *> rules = modsecRules->rules[i];
|
||||
if (rules.size() == 0) {
|
||||
|
@@ -34,10 +34,10 @@ void CustomDebugLog::write(int level, const std::string& message) {
|
||||
|
||||
|
||||
bool CustomDebugLog::contains(const std::string& pattern) {
|
||||
ModSecurity::Utils::Regex re(pattern);
|
||||
ModSecurity::Utils::SMatch match;
|
||||
modsecurity::Utils::Regex re(pattern);
|
||||
modsecurity::Utils::SMatch match;
|
||||
std::string s = m_log.str();
|
||||
return ModSecurity::Utils::regex_search(s, re);
|
||||
return modsecurity::Utils::regex_search(s, re);
|
||||
}
|
||||
|
||||
std::string CustomDebugLog::log_messages() {
|
||||
|
@@ -23,7 +23,7 @@
|
||||
|
||||
namespace modsecurity_test {
|
||||
|
||||
class CustomDebugLog : public ModSecurity::DebugLog {
|
||||
class CustomDebugLog : public modsecurity::DebugLog {
|
||||
public:
|
||||
CustomDebugLog *new_instance();
|
||||
|
||||
|
@@ -37,9 +37,9 @@ using modsecurity_test::ModSecurityTestResults;
|
||||
using modsecurity_test::RegressionTest;
|
||||
using modsecurity_test::RegressionTestResult;
|
||||
|
||||
using ModSecurity::Utils::regex_search;
|
||||
using ModSecurity::Utils::SMatch;
|
||||
using ModSecurity::Utils::Regex;
|
||||
using modsecurity::Utils::regex_search;
|
||||
using modsecurity::Utils::SMatch;
|
||||
using modsecurity::Utils::Regex;
|
||||
|
||||
std::string default_test_path = "test-cases/regression";
|
||||
std::list<std::string> resources;
|
||||
@@ -52,9 +52,9 @@ void print_help() {
|
||||
|
||||
|
||||
void actions(ModSecurityTestResults<RegressionTest> *r,
|
||||
ModSecurity::Assay *a) {
|
||||
ModSecurity::ModSecurityIntervention it;
|
||||
memset(&it, '\0', sizeof(ModSecurity::ModSecurityIntervention));
|
||||
modsecurity::Assay *a) {
|
||||
modsecurity::ModSecurityIntervention it;
|
||||
memset(&it, '\0', sizeof(modsecurity::ModSecurityIntervention));
|
||||
it.status = 200;
|
||||
if (a->intervention(&it) == true) {
|
||||
if (it.pause != 0) {
|
||||
@@ -81,9 +81,9 @@ void perform_unit_test(std::vector<RegressionTest *> *tests,
|
||||
|
||||
for (RegressionTest *t : *tests) {
|
||||
CustomDebugLog *debug_log = new CustomDebugLog();
|
||||
ModSecurity::ModSecurity *modsec = NULL;
|
||||
ModSecurity::Rules *modsec_rules = NULL;
|
||||
ModSecurity::Assay *modsec_assay = NULL;
|
||||
modsecurity::ModSecurity *modsec = NULL;
|
||||
modsecurity::Rules *modsec_rules = NULL;
|
||||
modsecurity::Assay *modsec_assay = NULL;
|
||||
ModSecurityTestResults<RegressionTest> r;
|
||||
std::stringstream serverLog;
|
||||
RegressionTestResult *testRes = new RegressionTestResult();
|
||||
@@ -104,11 +104,11 @@ void perform_unit_test(std::vector<RegressionTest *> *tests,
|
||||
std::cout << std::setw(50) << std::left << filename;
|
||||
std::cout << std::setw(70) << std::left << t->name;
|
||||
|
||||
modsec = new ModSecurity::ModSecurity();
|
||||
modsec = new modsecurity::ModSecurity();
|
||||
modsec->setConnectorInformation("ModSecurity-regression v0.0.1-alpha" \
|
||||
" (ModSecurity regression test utility)");
|
||||
modsec->setServerLogCb(logCb);
|
||||
modsec_rules = new ModSecurity::Rules(debug_log);
|
||||
modsec_rules = new modsecurity::Rules(debug_log);
|
||||
|
||||
bool found = true;
|
||||
if (t->resource.empty() == false) {
|
||||
@@ -170,7 +170,7 @@ void perform_unit_test(std::vector<RegressionTest *> *tests,
|
||||
}
|
||||
}
|
||||
|
||||
modsec_assay = new ModSecurity::Assay(modsec, modsec_rules,
|
||||
modsec_assay = new modsecurity::Assay(modsec, modsec_rules,
|
||||
&serverLog);
|
||||
|
||||
modsec_assay->processConnection(t->clientIp.c_str(),
|
||||
|
@@ -33,8 +33,8 @@
|
||||
using modsecurity_test::UnitTest;
|
||||
using modsecurity_test::ModSecurityTest;
|
||||
using modsecurity_test::ModSecurityTestResults;
|
||||
using ModSecurity::actions::transformations::Transformation;
|
||||
using ModSecurity::operators::Operator;
|
||||
using modsecurity::actions::transformations::Transformation;
|
||||
using modsecurity::operators::Operator;
|
||||
|
||||
std::string default_test_path = "test-cases/secrules-language-tests/operators";
|
||||
|
||||
|
@@ -72,9 +72,9 @@ std::string UnitTest::print() {
|
||||
i << this->obtained << "\"" << std::endl;
|
||||
}
|
||||
if (this->output != this->obtainedOutput) {
|
||||
i << "Expecting: \"" << ModSecurity::toHexIfNeeded(this->output);
|
||||
i << "Expecting: \"" << modsecurity::toHexIfNeeded(this->output);
|
||||
i << "\" - returned: \"";
|
||||
i << ModSecurity::toHexIfNeeded(this->obtainedOutput) << "\"";
|
||||
i << modsecurity::toHexIfNeeded(this->obtainedOutput) << "\"";
|
||||
i << std::endl;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user