mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-10-02 04:27:47 +03:00
PoC: Adds support to direct access on ARGS collection
This commit is contained in:
committed by
Felipe Zimmerle
parent
17e5a63577
commit
ca24b6bb06
45
src/anchored_set_variable.cc
Normal file
45
src/anchored_set_variable.cc
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* 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 "modsecurity/transaction.h"
|
||||
|
||||
#include <ctime>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "modsecurity/modsecurity.h"
|
||||
#include "modsecurity/transaction.h"
|
||||
#include "src/utils/regex.h"
|
||||
|
||||
namespace modsecurity {
|
||||
|
||||
|
||||
void AnchoredSetVariable::resolveRegularExpression(const std::string &var,
|
||||
std::vector<const collection::Variable *> *l) {
|
||||
Utils::Regex *r = new Utils::Regex(var);
|
||||
for (const auto& x : *this) {
|
||||
int ret = Utils::regex_search(x.first, *r);
|
||||
if (ret <= 0) {
|
||||
continue;
|
||||
}
|
||||
l->insert(l->begin(), x.second);
|
||||
}
|
||||
delete r;
|
||||
}
|
||||
|
||||
|
||||
} // namespace modsecurity
|
Reference in New Issue
Block a user