mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-28 18:56:33 +03:00
Adds support to base64 decode transformation
This commit is contained in:
parent
348cf3bfab
commit
e48f468cbc
@ -24,30 +24,22 @@
|
|||||||
|
|
||||||
#include "modsecurity/transaction.h"
|
#include "modsecurity/transaction.h"
|
||||||
#include "actions/transformations/transformation.h"
|
#include "actions/transformations/transformation.h"
|
||||||
|
#include "utils/base64.h"
|
||||||
|
|
||||||
|
|
||||||
namespace modsecurity {
|
namespace modsecurity {
|
||||||
namespace actions {
|
namespace actions {
|
||||||
namespace transformations {
|
namespace transformations {
|
||||||
|
|
||||||
Base64Decode::Base64Decode(std::string action)
|
|
||||||
: Transformation(action) {
|
|
||||||
this->action_kind = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string Base64Decode::evaluate(std::string value,
|
std::string Base64Decode::evaluate(std::string value,
|
||||||
Transaction *transaction) {
|
Transaction *transaction) {
|
||||||
/**
|
std::string ret = Utils::Base64::decode(value);
|
||||||
* @todo Implement the transformation base64decode
|
|
||||||
*/
|
return ret;
|
||||||
if (transaction) {
|
|
||||||
#ifndef NO_LOGS
|
|
||||||
transaction->debug(4, "Transformation 64 is not implemented yet.");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace transformations
|
} // namespace transformations
|
||||||
} // namespace actions
|
} // namespace actions
|
||||||
} // namespace modsecurity
|
} // namespace modsecurity
|
||||||
|
@ -30,7 +30,8 @@ namespace transformations {
|
|||||||
|
|
||||||
class Base64Decode : public Transformation {
|
class Base64Decode : public Transformation {
|
||||||
public:
|
public:
|
||||||
explicit Base64Decode(std::string action);
|
explicit Base64Decode(std::string action) : Transformation(action) { };
|
||||||
|
|
||||||
std::string evaluate(std::string exp,
|
std::string evaluate(std::string exp,
|
||||||
Transaction *transaction) override;
|
Transaction *transaction) override;
|
||||||
};
|
};
|
||||||
|
@ -74,7 +74,7 @@ std::string Transformation::evaluate(std::string value,
|
|||||||
|
|
||||||
Transformation* Transformation::instantiate(std::string a) {
|
Transformation* Transformation::instantiate(std::string a) {
|
||||||
IF_MATCH(base64_decode_ext) { return new Base64DecodeExt(a); }
|
IF_MATCH(base64_decode_ext) { return new Base64DecodeExt(a); }
|
||||||
IF_MATCH(base64_decode) { return new Base64Decode(a); }
|
IF_MATCH(base64Decode) { return new Base64Decode(a); }
|
||||||
IF_MATCH(cmd_line) { return new CmdLine(a); }
|
IF_MATCH(cmd_line) { return new CmdLine(a); }
|
||||||
IF_MATCH(compress_whitespace) { return new CompressWhitespace(a); }
|
IF_MATCH(compress_whitespace) { return new CompressWhitespace(a); }
|
||||||
IF_MATCH(cssDecode) { return new CssDecode(a); }
|
IF_MATCH(cssDecode) { return new CssDecode(a); }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user