diff --git a/src/Makefile.am b/src/Makefile.am index 7142520b..b44b2087 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -28,6 +28,50 @@ pkginclude_HEADERS = \ ../headers/modsecurity/intervention.h +ACTIONS = \ + actions/action.cc \ + actions/block.cc \ + actions/phase.cc \ + actions/redirect.cc \ + actions/rule_id.cc \ + actions/status.cc \ + actions/transformations/base64_decode.cc \ + actions/transformations/base64_decode_ext.cc \ + actions/transformations/cmd_line.cc \ + actions/transformations/compress_whitespace.cc \ + actions/transformations/css_decode.cc \ + actions/transformations/escape_seq_decode.cc \ + actions/transformations/hex_decode.cc \ + actions/transformations/hex_encode.cc \ + actions/transformations/html_entity_decode.cc \ + actions/transformations/js_decode.cc \ + actions/transformations/length.cc \ + actions/transformations/lowercase.cc \ + actions/transformations/md5.cc \ + actions/transformations/none.cc \ + actions/transformations/normalise_path.cc \ + actions/transformations/normalise_path_win.cc \ + actions/transformations/parity_even_7bit.cc \ + actions/transformations/parity_odd_7bit.cc \ + actions/transformations/parity_zero_7bit.cc \ + actions/transformations/remove_comments.cc \ + actions/transformations/remove_comments_char.cc \ + actions/transformations/remove_nulls.cc \ + actions/transformations/remove_whitespace.cc \ + actions/transformations/replace_comments.cc \ + actions/transformations/replace_nulls.cc \ + actions/transformations/sha1.cc \ + actions/transformations/sql_hex_decode.cc \ + actions/transformations/transformation.cc \ + actions/transformations/trim.cc \ + actions/transformations/trim_left.cc \ + actions/transformations/trim_right.cc \ + actions/transformations/url_decode.cc \ + actions/transformations/url_decode_uni.cc \ + actions/transformations/url_encode.cc \ + actions/transformations/utf8_to_unicode.cc + + libmodsecurity_la_SOURCES = \ parser/seclang-parser.yy \ parser/seclang-scanner.ll \ @@ -76,15 +120,9 @@ libmodsecurity_la_SOURCES = \ operators/str_eq.cc \ operators/str_match.cc \ operators/begins_with.cc \ - actions/rule_id.cc \ - actions/phase.cc \ - actions/action.cc \ - actions/block.cc \ - actions/redirect.cc \ - actions/status.cc \ - actions/transformations/transformation.cc \ - actions/transformations/trim.cc \ - actions/transformations/lowercase.cc + ${ACTIONS} + + libmodsecurity_la_CFLAGS = diff --git a/src/actions/action.cc b/src/actions/action.cc index bf733d7e..6dae6891 100644 --- a/src/actions/action.cc +++ b/src/actions/action.cc @@ -25,6 +25,10 @@ #include "actions/rule_id.h" #include "actions/phase.h" + +#define IF_MATCH(a) \ + if (op.compare(1, std::strlen(#a), #a) == 0) + namespace ModSecurity { namespace actions { diff --git a/src/actions/transformations/base64_decode.cc b/src/actions/transformations/base64_decode.cc new file mode 100644 index 00000000..55c01bcd --- /dev/null +++ b/src/actions/transformations/base64_decode.cc @@ -0,0 +1,48 @@ +/** + * 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 "actions/transformations/base64_decode.h" + +#include +#include +#include +#include +#include +#include + +#include "modsecurity/assay.h" +#include "actions/transformations/transformation.h" + + +namespace ModSecurity { +namespace actions { +namespace transformations { + +Base64Decode::Base64Decode(std::string action) + : Transformation(action) { + this->action_kind = 1; +} + +std::string& Base64Decode::evaluate(std::string value, + Assay *assay) { + /** + * @todo Implement the transformation base64decode + */ + assay->debug(4, "Transformation 64 is not implemented yet."); +} + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity diff --git a/src/actions/transformations/base64_decode.h b/src/actions/transformations/base64_decode.h new file mode 100644 index 00000000..a13b8e56 --- /dev/null +++ b/src/actions/transformations/base64_decode.h @@ -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 + +#include "actions/action.h" +#include "actions/transformations/transformation.h" + +#ifndef SRC_ACTIONS_TRANSFORMATIONS_BASE64_DECODE_H_ +#define SRC_ACTIONS_TRANSFORMATIONS_BASE64_DECODE_H_ + +#ifdef __cplusplus +namespace ModSecurity { +class Assay; + +namespace actions { +namespace transformations { + +class Base64Decode : public Transformation { + public: + explicit Base64Decode(std::string action); + std::string& evaluate(std::string exp, + Assay *assay) override; +}; + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity + +#endif + +#endif // SRC_ACTIONS_TRANSFORMATIONS_BASE64_DECODE_H_ diff --git a/src/actions/transformations/base64_decode_ext.cc b/src/actions/transformations/base64_decode_ext.cc new file mode 100644 index 00000000..648dcb73 --- /dev/null +++ b/src/actions/transformations/base64_decode_ext.cc @@ -0,0 +1,48 @@ +/** + * 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 "actions/transformations/base64_decode_ext.h" + +#include +#include +#include +#include +#include +#include + +#include "modsecurity/assay.h" +#include "actions/transformations/transformation.h" + + +namespace ModSecurity { +namespace actions { +namespace transformations { + +Base64DecodeExt::Base64DecodeExt(std::string action) + : Transformation(action) { + this->action_kind = 1; +} + +std::string& Base64DecodeExt::evaluate(std::string value, + Assay *assay) { + /** + * @todo Implement the transformation Base64DecodeExt + */ + assay->debug(4, "Transformation Base64DecodeExt is not implemented yet."); +} + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity diff --git a/src/actions/transformations/base64_decode_ext.h b/src/actions/transformations/base64_decode_ext.h new file mode 100644 index 00000000..3c057802 --- /dev/null +++ b/src/actions/transformations/base64_decode_ext.h @@ -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 + +#include "actions/action.h" +#include "actions/transformations/transformation.h" + +#ifndef SRC_ACTIONS_TRANSFORMATIONS_BASE64_DECODE_EXT_H_ +#define SRC_ACTIONS_TRANSFORMATIONS_BASE64_DECODE_EXT_H_ + +#ifdef __cplusplus +namespace ModSecurity { +class Assay; + +namespace actions { +namespace transformations { + +class Base64DecodeExt : public Transformation { + public: + explicit Base64DecodeExt(std::string action); + std::string& evaluate(std::string exp, + Assay *assay) override; +}; + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity + +#endif + +#endif // SRC_ACTIONS_TRANSFORMATIONS_BASE64_DECODE_EXT_H_ diff --git a/src/actions/transformations/cmd_line.cc b/src/actions/transformations/cmd_line.cc new file mode 100644 index 00000000..ea9d8153 --- /dev/null +++ b/src/actions/transformations/cmd_line.cc @@ -0,0 +1,48 @@ +/** + * 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 "actions/transformations/cmd_line.h" + +#include +#include +#include +#include +#include +#include + +#include "modsecurity/assay.h" +#include "actions/transformations/transformation.h" + + +namespace ModSecurity { +namespace actions { +namespace transformations { + +CmdLine::CmdLine(std::string action) + : Transformation(action) { + this->action_kind = 1; +} + +std::string& CmdLine::evaluate(std::string value, + Assay *assay) { + /** + * @todo Implement the transformation CmdLine + */ + assay->debug(4, "Transformation CmdLine is not implemented yet."); +} + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity diff --git a/src/actions/transformations/cmd_line.h b/src/actions/transformations/cmd_line.h new file mode 100644 index 00000000..283410e0 --- /dev/null +++ b/src/actions/transformations/cmd_line.h @@ -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 + +#include "actions/action.h" +#include "actions/transformations/transformation.h" + +#ifndef SRC_ACTIONS_TRANSFORMATIONS_CMD_LINE_H_ +#define SRC_ACTIONS_TRANSFORMATIONS_CMD_LINE_H_ + +#ifdef __cplusplus +namespace ModSecurity { +class Assay; + +namespace actions { +namespace transformations { + +class CmdLine : public Transformation { + public: + explicit CmdLine(std::string action); + std::string& evaluate(std::string exp, + Assay *assay) override; +}; + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity + +#endif + +#endif // SRC_ACTIONS_TRANSFORMATIONS_CMD_LINE_H_ diff --git a/src/actions/transformations/compress_whitespace.cc b/src/actions/transformations/compress_whitespace.cc new file mode 100644 index 00000000..c6864ad3 --- /dev/null +++ b/src/actions/transformations/compress_whitespace.cc @@ -0,0 +1,48 @@ +/** + * 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 "actions/transformations/compress_whitespace.h" + +#include +#include +#include +#include +#include +#include + +#include "modsecurity/assay.h" +#include "actions/transformations/transformation.h" + + +namespace ModSecurity { +namespace actions { +namespace transformations { + +CompressWhitespace::CompressWhitespace(std::string action) + : Transformation(action) { + this->action_kind = 1; +} + +std::string& CompressWhitespace::evaluate(std::string value, + Assay *assay) { + /** + * @todo Implement the transformation CompressWhitespace + */ + assay->debug(4, "Transformation CompressWhitespace is not implemented yet."); +} + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity diff --git a/src/actions/transformations/compress_whitespace.h b/src/actions/transformations/compress_whitespace.h new file mode 100644 index 00000000..dcb092ed --- /dev/null +++ b/src/actions/transformations/compress_whitespace.h @@ -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 + +#include "actions/action.h" +#include "actions/transformations/transformation.h" + +#ifndef SRC_ACTIONS_TRANSFORMATIONS_COMPRESS_WHITESPACE_H_ +#define SRC_ACTIONS_TRANSFORMATIONS_COMPRESS_WHITESPACE_H_ + +#ifdef __cplusplus +namespace ModSecurity { +class Assay; + +namespace actions { +namespace transformations { + +class CompressWhitespace : public Transformation { + public: + explicit CompressWhitespace(std::string action); + std::string& evaluate(std::string exp, + Assay *assay) override; +}; + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity + +#endif + +#endif // SRC_ACTIONS_TRANSFORMATIONS_COMPRESS_WHITESPACE_H_ diff --git a/src/actions/transformations/css_decode.cc b/src/actions/transformations/css_decode.cc new file mode 100644 index 00000000..639e861a --- /dev/null +++ b/src/actions/transformations/css_decode.cc @@ -0,0 +1,48 @@ +/** + * 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 "actions/transformations/css_decode.h" + +#include +#include +#include +#include +#include +#include + +#include "modsecurity/assay.h" +#include "actions/transformations/transformation.h" + + +namespace ModSecurity { +namespace actions { +namespace transformations { + +CssDecode::CssDecode(std::string action) + : Transformation(action) { + this->action_kind = 1; +} + +std::string& CssDecode::evaluate(std::string value, + Assay *assay) { + /** + * @todo Implement the transformation CssDecode + */ + assay->debug(4, "Transformation CssDecode is not implemented yet."); +} + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity diff --git a/src/actions/transformations/css_decode.h b/src/actions/transformations/css_decode.h new file mode 100644 index 00000000..fd6900aa --- /dev/null +++ b/src/actions/transformations/css_decode.h @@ -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 + +#include "actions/action.h" +#include "actions/transformations/transformation.h" + +#ifndef SRC_ACTIONS_TRANSFORMATIONS_CSS_DECODE_H_ +#define SRC_ACTIONS_TRANSFORMATIONS_CSS_DECODE_H_ + +#ifdef __cplusplus +namespace ModSecurity { +class Assay; + +namespace actions { +namespace transformations { + +class CssDecode : public Transformation { + public: + explicit CssDecode(std::string action); + std::string& evaluate(std::string exp, + Assay *assay) override; +}; + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity + +#endif + +#endif // SRC_ACTIONS_TRANSFORMATIONS_CSS_DECODE_H_ diff --git a/src/actions/transformations/escape_seq_decode.cc b/src/actions/transformations/escape_seq_decode.cc new file mode 100644 index 00000000..90cfe3d3 --- /dev/null +++ b/src/actions/transformations/escape_seq_decode.cc @@ -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. + * + */ + +#include "actions/transformations/escape_seq_decode.h" + +#include +#include +#include +#include +#include +#include + +#include "modsecurity/assay.h" +#include "actions/transformations/transformation.h" + + +namespace ModSecurity { +namespace actions { +namespace transformations { + +EscapeSeqDecode::EscapeSeqDecode(std::string action) + : Transformation(action) { + this->action_kind = 1; +} + +std::string& EscapeSeqDecode::evaluate(std::string value, + Assay *assay) { + /** + * @todo Implement the transformation EscapeSeqDecode + */ + assay->debug(4, "Transformation EscapeSeqDecode is not implemented yet."); + return value; +} + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity diff --git a/src/actions/transformations/escape_seq_decode.h b/src/actions/transformations/escape_seq_decode.h new file mode 100644 index 00000000..3830b0de --- /dev/null +++ b/src/actions/transformations/escape_seq_decode.h @@ -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 + +#include "actions/action.h" +#include "actions/transformations/transformation.h" + +#ifndef SRC_ACTIONS_TRANSFORMATIONS_ESCAPE_SEQ_DECODE_H_ +#define SRC_ACTIONS_TRANSFORMATIONS_ESCAPE_SEQ_DECODE_H_ + +#ifdef __cplusplus +namespace ModSecurity { +class Assay; + +namespace actions { +namespace transformations { + +class EscapeSeqDecode : public Transformation { + public: + explicit EscapeSeqDecode(std::string action); + std::string& evaluate(std::string exp, + Assay *assay) override; +}; + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity + +#endif + +#endif // SRC_ACTIONS_TRANSFORMATIONS_ESCAPE_SEQ_DECODE_H_ diff --git a/src/actions/transformations/hex_decode.cc b/src/actions/transformations/hex_decode.cc new file mode 100644 index 00000000..2e99e1ef --- /dev/null +++ b/src/actions/transformations/hex_decode.cc @@ -0,0 +1,48 @@ +/** + * 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 "actions/transformations/hex_decode.h" + +#include +#include +#include +#include +#include +#include + +#include "modsecurity/assay.h" +#include "actions/transformations/transformation.h" + + +namespace ModSecurity { +namespace actions { +namespace transformations { + +HexDecode::HexDecode(std::string action) + : Transformation(action) { + this->action_kind = 1; +} + +std::string& HexDecode::evaluate(std::string value, + Assay *assay) { + /** + * @todo Implement the transformation HexDecode + */ + assay->debug(4, "Transformation HexDecode is not implemented yet."); +} + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity diff --git a/src/actions/transformations/hex_decode.h b/src/actions/transformations/hex_decode.h new file mode 100644 index 00000000..a863f9b5 --- /dev/null +++ b/src/actions/transformations/hex_decode.h @@ -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 + +#include "actions/action.h" +#include "actions/transformations/transformation.h" + +#ifndef SRC_ACTIONS_TRANSFORMATIONS_HEX_DECODE_H_ +#define SRC_ACTIONS_TRANSFORMATIONS_HEX_DECODE_H_ + +#ifdef __cplusplus +namespace ModSecurity { +class Assay; + +namespace actions { +namespace transformations { + +class HexDecode : public Transformation { + public: + explicit HexDecode(std::string action); + std::string& evaluate(std::string exp, + Assay *assay) override; +}; + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity + +#endif + +#endif // SRC_ACTIONS_TRANSFORMATIONS_BASE64DECODE_H_ diff --git a/src/actions/transformations/hex_encode.cc b/src/actions/transformations/hex_encode.cc new file mode 100644 index 00000000..057ce9f1 --- /dev/null +++ b/src/actions/transformations/hex_encode.cc @@ -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. + * + */ + +#include "actions/transformations/hex_encode.h" + +#include +#include +#include +#include +#include +#include + +#include "modsecurity/assay.h" +#include "actions/transformations/transformation.h" + + +namespace ModSecurity { +namespace actions { +namespace transformations { + +HexEncode::HexEncode(std::string action) + : Transformation(action) { + this->action_kind = 1; +} + +std::string& HexEncode::evaluate(std::string value, + Assay *assay) { + /** + * @todo Implement the transformation HexEncode + */ + assay->debug(4, "Transformation HexEncode is not implemented yet."); + return value; +} + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity diff --git a/src/actions/transformations/hex_encode.h b/src/actions/transformations/hex_encode.h new file mode 100644 index 00000000..4709a76c --- /dev/null +++ b/src/actions/transformations/hex_encode.h @@ -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 + +#include "actions/action.h" +#include "actions/transformations/transformation.h" + +#ifndef SRC_ACTIONS_TRANSFORMATIONS_BASE64DECODE_H_ +#define SRC_ACTIONS_TRANSFORMATIONS_BASE64DECODE_H_ + +#ifdef __cplusplus +namespace ModSecurity { +class Assay; + +namespace actions { +namespace transformations { + +class HexEncode : public Transformation { + public: + explicit HexEncode(std::string action); + std::string& evaluate(std::string exp, + Assay *assay) override; +}; + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity + +#endif + +#endif // SRC_ACTIONS_TRANSFORMATIONS_BASE64DECODE_H_ diff --git a/src/actions/transformations/html_entity_decode.cc b/src/actions/transformations/html_entity_decode.cc new file mode 100644 index 00000000..974c3154 --- /dev/null +++ b/src/actions/transformations/html_entity_decode.cc @@ -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. + * + */ + +#include "actions/transformations/html_entity_decode.h" + +#include +#include +#include +#include +#include +#include + +#include "modsecurity/assay.h" +#include "actions/transformations/transformation.h" + + +namespace ModSecurity { +namespace actions { +namespace transformations { + +HtmlEntityDecode::HtmlEntityDecode(std::string action) + : Transformation(action) { + this->action_kind = 1; +} + +std::string& HtmlEntityDecode::evaluate(std::string value, + Assay *assay) { + /** + * @todo Implement the transformation HtmlEntityDecode + */ + assay->debug(4, "Transformation HtmlEntityDecode is not implemented yet."); + return value; +} + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity diff --git a/src/actions/transformations/html_entity_decode.h b/src/actions/transformations/html_entity_decode.h new file mode 100644 index 00000000..53378661 --- /dev/null +++ b/src/actions/transformations/html_entity_decode.h @@ -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 + +#include "actions/action.h" +#include "actions/transformations/transformation.h" + +#ifndef SRC_ACTIONS_TRANSFORMATIONS_HTML_ENTITY_DECODE_H_ +#define SRC_ACTIONS_TRANSFORMATIONS_HTML_ENTITY_DECODE_H_ + +#ifdef __cplusplus +namespace ModSecurity { +class Assay; + +namespace actions { +namespace transformations { + +class HtmlEntityDecode : public Transformation { + public: + explicit HtmlEntityDecode(std::string action); + std::string& evaluate(std::string exp, + Assay *assay) override; +}; + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity + +#endif + +#endif // SRC_ACTIONS_TRANSFORMATIONS_HTML_ENTITY_DECODE_H_ diff --git a/src/actions/transformations/js_decode.cc b/src/actions/transformations/js_decode.cc new file mode 100644 index 00000000..ce11bdd8 --- /dev/null +++ b/src/actions/transformations/js_decode.cc @@ -0,0 +1,48 @@ +/** + * 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 "actions/transformations/js_decode.h" + +#include +#include +#include +#include +#include +#include + +#include "modsecurity/assay.h" +#include "actions/transformations/transformation.h" + + +namespace ModSecurity { +namespace actions { +namespace transformations { + +JsDecode::JsDecode(std::string action) + : Transformation(action) { + this->action_kind = 1; +} + +std::string& JsDecode::evaluate(std::string value, + Assay *assay) { + /** + * @todo Implement the transformation JsDecode + */ + assay->debug(4, "Transformation JsDecode is not implemented yet."); +} + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity diff --git a/src/actions/transformations/js_decode.h b/src/actions/transformations/js_decode.h new file mode 100644 index 00000000..bed2608f --- /dev/null +++ b/src/actions/transformations/js_decode.h @@ -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 + +#include "actions/action.h" +#include "actions/transformations/transformation.h" + +#ifndef SRC_ACTIONS_TRANSFORMATIONS_JS_DECODE_H_ +#define SRC_ACTIONS_TRANSFORMATIONS_JS_DECODE_H_ + +#ifdef __cplusplus +namespace ModSecurity { +class Assay; + +namespace actions { +namespace transformations { + +class JsDecode : public Transformation { + public: + explicit JsDecode(std::string action); + std::string& evaluate(std::string exp, + Assay *assay) override; +}; + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity + +#endif + +#endif // SRC_ACTIONS_TRANSFORMATIONS_JS_DECODE_H_ diff --git a/src/actions/transformations/length.cc b/src/actions/transformations/length.cc new file mode 100644 index 00000000..648d2259 --- /dev/null +++ b/src/actions/transformations/length.cc @@ -0,0 +1,48 @@ +/** + * 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 "actions/transformations/length.h" + +#include +#include +#include +#include +#include +#include + +#include "modsecurity/assay.h" +#include "actions/transformations/transformation.h" + + +namespace ModSecurity { +namespace actions { +namespace transformations { + +Length::Length(std::string action) + : Transformation(action) { + this->action_kind = 1; +} + +std::string& Length::evaluate(std::string value, + Assay *assay) { + /** + * @todo Implement the transformation Length + */ + assay->debug(4, "Transformation Length is not implemented yet."); +} + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity diff --git a/src/actions/transformations/length.h b/src/actions/transformations/length.h new file mode 100644 index 00000000..af8deb21 --- /dev/null +++ b/src/actions/transformations/length.h @@ -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 + +#include "actions/action.h" +#include "actions/transformations/transformation.h" + +#ifndef SRC_ACTIONS_TRANSFORMATIONS_LENGTH_H_ +#define SRC_ACTIONS_TRANSFORMATIONS_LENGTH_H_ + +#ifdef __cplusplus +namespace ModSecurity { +class Assay; + +namespace actions { +namespace transformations { + +class Length : public Transformation { + public: + explicit Length(std::string action); + std::string& evaluate(std::string exp, + Assay *assay) override; +}; + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity + +#endif + +#endif // SRC_ACTIONS_TRANSFORMATIONS_LENGTH_H_ diff --git a/src/actions/transformations/libmodsecurity_la-base64_decode.lo b/src/actions/transformations/libmodsecurity_la-base64_decode.lo new file mode 100644 index 00000000..05e59af5 --- /dev/null +++ b/src/actions/transformations/libmodsecurity_la-base64_decode.lo @@ -0,0 +1,12 @@ +# actions/transformations/libmodsecurity_la-base64_decode.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libmodsecurity_la-base64_decode.o' + +# Name of the non-PIC object +non_pic_object='libmodsecurity_la-base64_decode.o' + diff --git a/src/actions/transformations/libmodsecurity_la-base64_decode.o b/src/actions/transformations/libmodsecurity_la-base64_decode.o new file mode 100644 index 00000000..69a53d67 Binary files /dev/null and b/src/actions/transformations/libmodsecurity_la-base64_decode.o differ diff --git a/src/actions/transformations/libmodsecurity_la-base64_decode_ext.lo b/src/actions/transformations/libmodsecurity_la-base64_decode_ext.lo new file mode 100644 index 00000000..56aec7b4 --- /dev/null +++ b/src/actions/transformations/libmodsecurity_la-base64_decode_ext.lo @@ -0,0 +1,12 @@ +# actions/transformations/libmodsecurity_la-base64_decode_ext.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libmodsecurity_la-base64_decode_ext.o' + +# Name of the non-PIC object +non_pic_object='libmodsecurity_la-base64_decode_ext.o' + diff --git a/src/actions/transformations/libmodsecurity_la-base64_decode_ext.o b/src/actions/transformations/libmodsecurity_la-base64_decode_ext.o new file mode 100644 index 00000000..1f141f7f Binary files /dev/null and b/src/actions/transformations/libmodsecurity_la-base64_decode_ext.o differ diff --git a/src/actions/transformations/libmodsecurity_la-cmd_line.lo b/src/actions/transformations/libmodsecurity_la-cmd_line.lo new file mode 100644 index 00000000..592df465 --- /dev/null +++ b/src/actions/transformations/libmodsecurity_la-cmd_line.lo @@ -0,0 +1,12 @@ +# actions/transformations/libmodsecurity_la-cmd_line.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libmodsecurity_la-cmd_line.o' + +# Name of the non-PIC object +non_pic_object='libmodsecurity_la-cmd_line.o' + diff --git a/src/actions/transformations/libmodsecurity_la-cmd_line.o b/src/actions/transformations/libmodsecurity_la-cmd_line.o new file mode 100644 index 00000000..13d03b7e Binary files /dev/null and b/src/actions/transformations/libmodsecurity_la-cmd_line.o differ diff --git a/src/actions/transformations/libmodsecurity_la-compress_whitespace.lo b/src/actions/transformations/libmodsecurity_la-compress_whitespace.lo new file mode 100644 index 00000000..f0d8ede2 --- /dev/null +++ b/src/actions/transformations/libmodsecurity_la-compress_whitespace.lo @@ -0,0 +1,12 @@ +# actions/transformations/libmodsecurity_la-compress_whitespace.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libmodsecurity_la-compress_whitespace.o' + +# Name of the non-PIC object +non_pic_object='libmodsecurity_la-compress_whitespace.o' + diff --git a/src/actions/transformations/libmodsecurity_la-compress_whitespace.o b/src/actions/transformations/libmodsecurity_la-compress_whitespace.o new file mode 100644 index 00000000..5ef033f5 Binary files /dev/null and b/src/actions/transformations/libmodsecurity_la-compress_whitespace.o differ diff --git a/src/actions/transformations/libmodsecurity_la-css_decode.lo b/src/actions/transformations/libmodsecurity_la-css_decode.lo new file mode 100644 index 00000000..c660b264 --- /dev/null +++ b/src/actions/transformations/libmodsecurity_la-css_decode.lo @@ -0,0 +1,12 @@ +# actions/transformations/libmodsecurity_la-css_decode.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libmodsecurity_la-css_decode.o' + +# Name of the non-PIC object +non_pic_object='libmodsecurity_la-css_decode.o' + diff --git a/src/actions/transformations/libmodsecurity_la-css_decode.o b/src/actions/transformations/libmodsecurity_la-css_decode.o new file mode 100644 index 00000000..560fefbf Binary files /dev/null and b/src/actions/transformations/libmodsecurity_la-css_decode.o differ diff --git a/src/actions/transformations/libmodsecurity_la-escape_seq_decode.lo b/src/actions/transformations/libmodsecurity_la-escape_seq_decode.lo new file mode 100644 index 00000000..a22299b4 --- /dev/null +++ b/src/actions/transformations/libmodsecurity_la-escape_seq_decode.lo @@ -0,0 +1,12 @@ +# actions/transformations/libmodsecurity_la-escape_seq_decode.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libmodsecurity_la-escape_seq_decode.o' + +# Name of the non-PIC object +non_pic_object='libmodsecurity_la-escape_seq_decode.o' + diff --git a/src/actions/transformations/libmodsecurity_la-escape_seq_decode.o b/src/actions/transformations/libmodsecurity_la-escape_seq_decode.o new file mode 100644 index 00000000..6a830d3c Binary files /dev/null and b/src/actions/transformations/libmodsecurity_la-escape_seq_decode.o differ diff --git a/src/actions/transformations/libmodsecurity_la-hex_decode.lo b/src/actions/transformations/libmodsecurity_la-hex_decode.lo new file mode 100644 index 00000000..90f39187 --- /dev/null +++ b/src/actions/transformations/libmodsecurity_la-hex_decode.lo @@ -0,0 +1,12 @@ +# actions/transformations/libmodsecurity_la-hex_decode.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libmodsecurity_la-hex_decode.o' + +# Name of the non-PIC object +non_pic_object='libmodsecurity_la-hex_decode.o' + diff --git a/src/actions/transformations/libmodsecurity_la-hex_decode.o b/src/actions/transformations/libmodsecurity_la-hex_decode.o new file mode 100644 index 00000000..d5104b6d Binary files /dev/null and b/src/actions/transformations/libmodsecurity_la-hex_decode.o differ diff --git a/src/actions/transformations/libmodsecurity_la-hex_encode.lo b/src/actions/transformations/libmodsecurity_la-hex_encode.lo new file mode 100644 index 00000000..5a00d037 --- /dev/null +++ b/src/actions/transformations/libmodsecurity_la-hex_encode.lo @@ -0,0 +1,12 @@ +# actions/transformations/libmodsecurity_la-hex_encode.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libmodsecurity_la-hex_encode.o' + +# Name of the non-PIC object +non_pic_object='libmodsecurity_la-hex_encode.o' + diff --git a/src/actions/transformations/libmodsecurity_la-hex_encode.o b/src/actions/transformations/libmodsecurity_la-hex_encode.o new file mode 100644 index 00000000..7ca3ac57 Binary files /dev/null and b/src/actions/transformations/libmodsecurity_la-hex_encode.o differ diff --git a/src/actions/transformations/libmodsecurity_la-html_entity_decode.lo b/src/actions/transformations/libmodsecurity_la-html_entity_decode.lo new file mode 100644 index 00000000..5fb3493b --- /dev/null +++ b/src/actions/transformations/libmodsecurity_la-html_entity_decode.lo @@ -0,0 +1,12 @@ +# actions/transformations/libmodsecurity_la-html_entity_decode.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libmodsecurity_la-html_entity_decode.o' + +# Name of the non-PIC object +non_pic_object='libmodsecurity_la-html_entity_decode.o' + diff --git a/src/actions/transformations/libmodsecurity_la-html_entity_decode.o b/src/actions/transformations/libmodsecurity_la-html_entity_decode.o new file mode 100644 index 00000000..568dbfae Binary files /dev/null and b/src/actions/transformations/libmodsecurity_la-html_entity_decode.o differ diff --git a/src/actions/transformations/libmodsecurity_la-js_decode.lo b/src/actions/transformations/libmodsecurity_la-js_decode.lo new file mode 100644 index 00000000..8141c18d --- /dev/null +++ b/src/actions/transformations/libmodsecurity_la-js_decode.lo @@ -0,0 +1,12 @@ +# actions/transformations/libmodsecurity_la-js_decode.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libmodsecurity_la-js_decode.o' + +# Name of the non-PIC object +non_pic_object='libmodsecurity_la-js_decode.o' + diff --git a/src/actions/transformations/libmodsecurity_la-js_decode.o b/src/actions/transformations/libmodsecurity_la-js_decode.o new file mode 100644 index 00000000..6642d6bd Binary files /dev/null and b/src/actions/transformations/libmodsecurity_la-js_decode.o differ diff --git a/src/actions/transformations/libmodsecurity_la-length.lo b/src/actions/transformations/libmodsecurity_la-length.lo new file mode 100644 index 00000000..bd57e9ef --- /dev/null +++ b/src/actions/transformations/libmodsecurity_la-length.lo @@ -0,0 +1,12 @@ +# actions/transformations/libmodsecurity_la-length.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libmodsecurity_la-length.o' + +# Name of the non-PIC object +non_pic_object='libmodsecurity_la-length.o' + diff --git a/src/actions/transformations/libmodsecurity_la-length.o b/src/actions/transformations/libmodsecurity_la-length.o new file mode 100644 index 00000000..58c51a73 Binary files /dev/null and b/src/actions/transformations/libmodsecurity_la-length.o differ diff --git a/src/actions/transformations/libmodsecurity_la-lowercase.lo b/src/actions/transformations/libmodsecurity_la-lowercase.lo new file mode 100644 index 00000000..53317029 --- /dev/null +++ b/src/actions/transformations/libmodsecurity_la-lowercase.lo @@ -0,0 +1,12 @@ +# actions/transformations/libmodsecurity_la-lowercase.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libmodsecurity_la-lowercase.o' + +# Name of the non-PIC object +non_pic_object='libmodsecurity_la-lowercase.o' + diff --git a/src/actions/transformations/libmodsecurity_la-lowercase.o b/src/actions/transformations/libmodsecurity_la-lowercase.o new file mode 100644 index 00000000..2178c275 Binary files /dev/null and b/src/actions/transformations/libmodsecurity_la-lowercase.o differ diff --git a/src/actions/transformations/libmodsecurity_la-md5.lo b/src/actions/transformations/libmodsecurity_la-md5.lo new file mode 100644 index 00000000..3010216b --- /dev/null +++ b/src/actions/transformations/libmodsecurity_la-md5.lo @@ -0,0 +1,12 @@ +# actions/transformations/libmodsecurity_la-md5.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libmodsecurity_la-md5.o' + +# Name of the non-PIC object +non_pic_object='libmodsecurity_la-md5.o' + diff --git a/src/actions/transformations/libmodsecurity_la-md5.o b/src/actions/transformations/libmodsecurity_la-md5.o new file mode 100644 index 00000000..2ac7612d Binary files /dev/null and b/src/actions/transformations/libmodsecurity_la-md5.o differ diff --git a/src/actions/transformations/libmodsecurity_la-none.lo b/src/actions/transformations/libmodsecurity_la-none.lo new file mode 100644 index 00000000..6af47bcd --- /dev/null +++ b/src/actions/transformations/libmodsecurity_la-none.lo @@ -0,0 +1,12 @@ +# actions/transformations/libmodsecurity_la-none.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libmodsecurity_la-none.o' + +# Name of the non-PIC object +non_pic_object='libmodsecurity_la-none.o' + diff --git a/src/actions/transformations/libmodsecurity_la-none.o b/src/actions/transformations/libmodsecurity_la-none.o new file mode 100644 index 00000000..ee4db520 Binary files /dev/null and b/src/actions/transformations/libmodsecurity_la-none.o differ diff --git a/src/actions/transformations/libmodsecurity_la-normalise_path.lo b/src/actions/transformations/libmodsecurity_la-normalise_path.lo new file mode 100644 index 00000000..e1f45f32 --- /dev/null +++ b/src/actions/transformations/libmodsecurity_la-normalise_path.lo @@ -0,0 +1,12 @@ +# actions/transformations/libmodsecurity_la-normalise_path.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libmodsecurity_la-normalise_path.o' + +# Name of the non-PIC object +non_pic_object='libmodsecurity_la-normalise_path.o' + diff --git a/src/actions/transformations/libmodsecurity_la-normalise_path.o b/src/actions/transformations/libmodsecurity_la-normalise_path.o new file mode 100644 index 00000000..2ea37e76 Binary files /dev/null and b/src/actions/transformations/libmodsecurity_la-normalise_path.o differ diff --git a/src/actions/transformations/libmodsecurity_la-normalise_path_win.lo b/src/actions/transformations/libmodsecurity_la-normalise_path_win.lo new file mode 100644 index 00000000..5f40cb77 --- /dev/null +++ b/src/actions/transformations/libmodsecurity_la-normalise_path_win.lo @@ -0,0 +1,12 @@ +# actions/transformations/libmodsecurity_la-normalise_path_win.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libmodsecurity_la-normalise_path_win.o' + +# Name of the non-PIC object +non_pic_object='libmodsecurity_la-normalise_path_win.o' + diff --git a/src/actions/transformations/libmodsecurity_la-normalise_path_win.o b/src/actions/transformations/libmodsecurity_la-normalise_path_win.o new file mode 100644 index 00000000..17cd9884 Binary files /dev/null and b/src/actions/transformations/libmodsecurity_la-normalise_path_win.o differ diff --git a/src/actions/transformations/libmodsecurity_la-parity_even_7bit.lo b/src/actions/transformations/libmodsecurity_la-parity_even_7bit.lo new file mode 100644 index 00000000..1f2a5d53 --- /dev/null +++ b/src/actions/transformations/libmodsecurity_la-parity_even_7bit.lo @@ -0,0 +1,12 @@ +# actions/transformations/libmodsecurity_la-parity_even_7bit.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libmodsecurity_la-parity_even_7bit.o' + +# Name of the non-PIC object +non_pic_object='libmodsecurity_la-parity_even_7bit.o' + diff --git a/src/actions/transformations/libmodsecurity_la-parity_even_7bit.o b/src/actions/transformations/libmodsecurity_la-parity_even_7bit.o new file mode 100644 index 00000000..ce5a2dfa Binary files /dev/null and b/src/actions/transformations/libmodsecurity_la-parity_even_7bit.o differ diff --git a/src/actions/transformations/libmodsecurity_la-parity_odd_7bit.lo b/src/actions/transformations/libmodsecurity_la-parity_odd_7bit.lo new file mode 100644 index 00000000..0e6e1ca2 --- /dev/null +++ b/src/actions/transformations/libmodsecurity_la-parity_odd_7bit.lo @@ -0,0 +1,12 @@ +# actions/transformations/libmodsecurity_la-parity_odd_7bit.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libmodsecurity_la-parity_odd_7bit.o' + +# Name of the non-PIC object +non_pic_object='libmodsecurity_la-parity_odd_7bit.o' + diff --git a/src/actions/transformations/libmodsecurity_la-parity_odd_7bit.o b/src/actions/transformations/libmodsecurity_la-parity_odd_7bit.o new file mode 100644 index 00000000..abca965f Binary files /dev/null and b/src/actions/transformations/libmodsecurity_la-parity_odd_7bit.o differ diff --git a/src/actions/transformations/libmodsecurity_la-parity_zero_7bit.lo b/src/actions/transformations/libmodsecurity_la-parity_zero_7bit.lo new file mode 100644 index 00000000..f67ed41f --- /dev/null +++ b/src/actions/transformations/libmodsecurity_la-parity_zero_7bit.lo @@ -0,0 +1,12 @@ +# actions/transformations/libmodsecurity_la-parity_zero_7bit.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libmodsecurity_la-parity_zero_7bit.o' + +# Name of the non-PIC object +non_pic_object='libmodsecurity_la-parity_zero_7bit.o' + diff --git a/src/actions/transformations/libmodsecurity_la-parity_zero_7bit.o b/src/actions/transformations/libmodsecurity_la-parity_zero_7bit.o new file mode 100644 index 00000000..107dffd3 Binary files /dev/null and b/src/actions/transformations/libmodsecurity_la-parity_zero_7bit.o differ diff --git a/src/actions/transformations/libmodsecurity_la-remove_comments.lo b/src/actions/transformations/libmodsecurity_la-remove_comments.lo new file mode 100644 index 00000000..93ad8328 --- /dev/null +++ b/src/actions/transformations/libmodsecurity_la-remove_comments.lo @@ -0,0 +1,12 @@ +# actions/transformations/libmodsecurity_la-remove_comments.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libmodsecurity_la-remove_comments.o' + +# Name of the non-PIC object +non_pic_object='libmodsecurity_la-remove_comments.o' + diff --git a/src/actions/transformations/libmodsecurity_la-remove_comments.o b/src/actions/transformations/libmodsecurity_la-remove_comments.o new file mode 100644 index 00000000..5c272804 Binary files /dev/null and b/src/actions/transformations/libmodsecurity_la-remove_comments.o differ diff --git a/src/actions/transformations/libmodsecurity_la-remove_comments_char.lo b/src/actions/transformations/libmodsecurity_la-remove_comments_char.lo new file mode 100644 index 00000000..f9a0103d --- /dev/null +++ b/src/actions/transformations/libmodsecurity_la-remove_comments_char.lo @@ -0,0 +1,12 @@ +# actions/transformations/libmodsecurity_la-remove_comments_char.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libmodsecurity_la-remove_comments_char.o' + +# Name of the non-PIC object +non_pic_object='libmodsecurity_la-remove_comments_char.o' + diff --git a/src/actions/transformations/libmodsecurity_la-remove_comments_char.o b/src/actions/transformations/libmodsecurity_la-remove_comments_char.o new file mode 100644 index 00000000..db8d2876 Binary files /dev/null and b/src/actions/transformations/libmodsecurity_la-remove_comments_char.o differ diff --git a/src/actions/transformations/libmodsecurity_la-remove_nulls.lo b/src/actions/transformations/libmodsecurity_la-remove_nulls.lo new file mode 100644 index 00000000..8dac419f --- /dev/null +++ b/src/actions/transformations/libmodsecurity_la-remove_nulls.lo @@ -0,0 +1,12 @@ +# actions/transformations/libmodsecurity_la-remove_nulls.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libmodsecurity_la-remove_nulls.o' + +# Name of the non-PIC object +non_pic_object='libmodsecurity_la-remove_nulls.o' + diff --git a/src/actions/transformations/libmodsecurity_la-remove_nulls.o b/src/actions/transformations/libmodsecurity_la-remove_nulls.o new file mode 100644 index 00000000..3ed9a894 Binary files /dev/null and b/src/actions/transformations/libmodsecurity_la-remove_nulls.o differ diff --git a/src/actions/transformations/libmodsecurity_la-remove_whitespace.lo b/src/actions/transformations/libmodsecurity_la-remove_whitespace.lo new file mode 100644 index 00000000..3d8aeebb --- /dev/null +++ b/src/actions/transformations/libmodsecurity_la-remove_whitespace.lo @@ -0,0 +1,12 @@ +# actions/transformations/libmodsecurity_la-remove_whitespace.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libmodsecurity_la-remove_whitespace.o' + +# Name of the non-PIC object +non_pic_object='libmodsecurity_la-remove_whitespace.o' + diff --git a/src/actions/transformations/libmodsecurity_la-remove_whitespace.o b/src/actions/transformations/libmodsecurity_la-remove_whitespace.o new file mode 100644 index 00000000..194e0bc5 Binary files /dev/null and b/src/actions/transformations/libmodsecurity_la-remove_whitespace.o differ diff --git a/src/actions/transformations/libmodsecurity_la-replace_comments.lo b/src/actions/transformations/libmodsecurity_la-replace_comments.lo new file mode 100644 index 00000000..785a02e0 --- /dev/null +++ b/src/actions/transformations/libmodsecurity_la-replace_comments.lo @@ -0,0 +1,12 @@ +# actions/transformations/libmodsecurity_la-replace_comments.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libmodsecurity_la-replace_comments.o' + +# Name of the non-PIC object +non_pic_object='libmodsecurity_la-replace_comments.o' + diff --git a/src/actions/transformations/libmodsecurity_la-replace_comments.o b/src/actions/transformations/libmodsecurity_la-replace_comments.o new file mode 100644 index 00000000..92210674 Binary files /dev/null and b/src/actions/transformations/libmodsecurity_la-replace_comments.o differ diff --git a/src/actions/transformations/libmodsecurity_la-replace_nulls.lo b/src/actions/transformations/libmodsecurity_la-replace_nulls.lo new file mode 100644 index 00000000..f178163c --- /dev/null +++ b/src/actions/transformations/libmodsecurity_la-replace_nulls.lo @@ -0,0 +1,12 @@ +# actions/transformations/libmodsecurity_la-replace_nulls.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libmodsecurity_la-replace_nulls.o' + +# Name of the non-PIC object +non_pic_object='libmodsecurity_la-replace_nulls.o' + diff --git a/src/actions/transformations/libmodsecurity_la-replace_nulls.o b/src/actions/transformations/libmodsecurity_la-replace_nulls.o new file mode 100644 index 00000000..afd0b81c Binary files /dev/null and b/src/actions/transformations/libmodsecurity_la-replace_nulls.o differ diff --git a/src/actions/transformations/libmodsecurity_la-sha1.lo b/src/actions/transformations/libmodsecurity_la-sha1.lo new file mode 100644 index 00000000..4800ad5e --- /dev/null +++ b/src/actions/transformations/libmodsecurity_la-sha1.lo @@ -0,0 +1,12 @@ +# actions/transformations/libmodsecurity_la-sha1.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libmodsecurity_la-sha1.o' + +# Name of the non-PIC object +non_pic_object='libmodsecurity_la-sha1.o' + diff --git a/src/actions/transformations/libmodsecurity_la-sha1.o b/src/actions/transformations/libmodsecurity_la-sha1.o new file mode 100644 index 00000000..386d68b9 Binary files /dev/null and b/src/actions/transformations/libmodsecurity_la-sha1.o differ diff --git a/src/actions/transformations/libmodsecurity_la-sql_hex_decode.lo b/src/actions/transformations/libmodsecurity_la-sql_hex_decode.lo new file mode 100644 index 00000000..e13751ca --- /dev/null +++ b/src/actions/transformations/libmodsecurity_la-sql_hex_decode.lo @@ -0,0 +1,12 @@ +# actions/transformations/libmodsecurity_la-sql_hex_decode.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libmodsecurity_la-sql_hex_decode.o' + +# Name of the non-PIC object +non_pic_object='libmodsecurity_la-sql_hex_decode.o' + diff --git a/src/actions/transformations/libmodsecurity_la-sql_hex_decode.o b/src/actions/transformations/libmodsecurity_la-sql_hex_decode.o new file mode 100644 index 00000000..a80d09fc Binary files /dev/null and b/src/actions/transformations/libmodsecurity_la-sql_hex_decode.o differ diff --git a/src/actions/transformations/libmodsecurity_la-transformation.lo b/src/actions/transformations/libmodsecurity_la-transformation.lo new file mode 100644 index 00000000..f9f0ec58 --- /dev/null +++ b/src/actions/transformations/libmodsecurity_la-transformation.lo @@ -0,0 +1,12 @@ +# actions/transformations/libmodsecurity_la-transformation.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libmodsecurity_la-transformation.o' + +# Name of the non-PIC object +non_pic_object='libmodsecurity_la-transformation.o' + diff --git a/src/actions/transformations/libmodsecurity_la-transformation.o b/src/actions/transformations/libmodsecurity_la-transformation.o new file mode 100644 index 00000000..04d19f40 Binary files /dev/null and b/src/actions/transformations/libmodsecurity_la-transformation.o differ diff --git a/src/actions/transformations/libmodsecurity_la-trim.lo b/src/actions/transformations/libmodsecurity_la-trim.lo new file mode 100644 index 00000000..26766e8f --- /dev/null +++ b/src/actions/transformations/libmodsecurity_la-trim.lo @@ -0,0 +1,12 @@ +# actions/transformations/libmodsecurity_la-trim.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libmodsecurity_la-trim.o' + +# Name of the non-PIC object +non_pic_object='libmodsecurity_la-trim.o' + diff --git a/src/actions/transformations/libmodsecurity_la-trim.o b/src/actions/transformations/libmodsecurity_la-trim.o new file mode 100644 index 00000000..55ca175b Binary files /dev/null and b/src/actions/transformations/libmodsecurity_la-trim.o differ diff --git a/src/actions/transformations/libmodsecurity_la-trim_left.lo b/src/actions/transformations/libmodsecurity_la-trim_left.lo new file mode 100644 index 00000000..7498e79b --- /dev/null +++ b/src/actions/transformations/libmodsecurity_la-trim_left.lo @@ -0,0 +1,12 @@ +# actions/transformations/libmodsecurity_la-trim_left.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libmodsecurity_la-trim_left.o' + +# Name of the non-PIC object +non_pic_object='libmodsecurity_la-trim_left.o' + diff --git a/src/actions/transformations/libmodsecurity_la-trim_left.o b/src/actions/transformations/libmodsecurity_la-trim_left.o new file mode 100644 index 00000000..3cdf3fdf Binary files /dev/null and b/src/actions/transformations/libmodsecurity_la-trim_left.o differ diff --git a/src/actions/transformations/libmodsecurity_la-trim_right.lo b/src/actions/transformations/libmodsecurity_la-trim_right.lo new file mode 100644 index 00000000..9cacb8ec --- /dev/null +++ b/src/actions/transformations/libmodsecurity_la-trim_right.lo @@ -0,0 +1,12 @@ +# actions/transformations/libmodsecurity_la-trim_right.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libmodsecurity_la-trim_right.o' + +# Name of the non-PIC object +non_pic_object='libmodsecurity_la-trim_right.o' + diff --git a/src/actions/transformations/libmodsecurity_la-trim_right.o b/src/actions/transformations/libmodsecurity_la-trim_right.o new file mode 100644 index 00000000..742f4263 Binary files /dev/null and b/src/actions/transformations/libmodsecurity_la-trim_right.o differ diff --git a/src/actions/transformations/libmodsecurity_la-url_decode.lo b/src/actions/transformations/libmodsecurity_la-url_decode.lo new file mode 100644 index 00000000..dcba78d0 --- /dev/null +++ b/src/actions/transformations/libmodsecurity_la-url_decode.lo @@ -0,0 +1,12 @@ +# actions/transformations/libmodsecurity_la-url_decode.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libmodsecurity_la-url_decode.o' + +# Name of the non-PIC object +non_pic_object='libmodsecurity_la-url_decode.o' + diff --git a/src/actions/transformations/libmodsecurity_la-url_decode.o b/src/actions/transformations/libmodsecurity_la-url_decode.o new file mode 100644 index 00000000..1dbd14dd Binary files /dev/null and b/src/actions/transformations/libmodsecurity_la-url_decode.o differ diff --git a/src/actions/transformations/libmodsecurity_la-url_decode_uni.lo b/src/actions/transformations/libmodsecurity_la-url_decode_uni.lo new file mode 100644 index 00000000..38cd8d86 --- /dev/null +++ b/src/actions/transformations/libmodsecurity_la-url_decode_uni.lo @@ -0,0 +1,12 @@ +# actions/transformations/libmodsecurity_la-url_decode_uni.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libmodsecurity_la-url_decode_uni.o' + +# Name of the non-PIC object +non_pic_object='libmodsecurity_la-url_decode_uni.o' + diff --git a/src/actions/transformations/libmodsecurity_la-url_decode_uni.o b/src/actions/transformations/libmodsecurity_la-url_decode_uni.o new file mode 100644 index 00000000..8775d380 Binary files /dev/null and b/src/actions/transformations/libmodsecurity_la-url_decode_uni.o differ diff --git a/src/actions/transformations/libmodsecurity_la-url_encode.lo b/src/actions/transformations/libmodsecurity_la-url_encode.lo new file mode 100644 index 00000000..ce7087d7 --- /dev/null +++ b/src/actions/transformations/libmodsecurity_la-url_encode.lo @@ -0,0 +1,12 @@ +# actions/transformations/libmodsecurity_la-url_encode.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libmodsecurity_la-url_encode.o' + +# Name of the non-PIC object +non_pic_object='libmodsecurity_la-url_encode.o' + diff --git a/src/actions/transformations/libmodsecurity_la-url_encode.o b/src/actions/transformations/libmodsecurity_la-url_encode.o new file mode 100644 index 00000000..6266177b Binary files /dev/null and b/src/actions/transformations/libmodsecurity_la-url_encode.o differ diff --git a/src/actions/transformations/libmodsecurity_la-utf8_to_unicode.lo b/src/actions/transformations/libmodsecurity_la-utf8_to_unicode.lo new file mode 100644 index 00000000..edd0b80a --- /dev/null +++ b/src/actions/transformations/libmodsecurity_la-utf8_to_unicode.lo @@ -0,0 +1,12 @@ +# actions/transformations/libmodsecurity_la-utf8_to_unicode.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libmodsecurity_la-utf8_to_unicode.o' + +# Name of the non-PIC object +non_pic_object='libmodsecurity_la-utf8_to_unicode.o' + diff --git a/src/actions/transformations/libmodsecurity_la-utf8_to_unicode.o b/src/actions/transformations/libmodsecurity_la-utf8_to_unicode.o new file mode 100644 index 00000000..7b7b5158 Binary files /dev/null and b/src/actions/transformations/libmodsecurity_la-utf8_to_unicode.o differ diff --git a/src/actions/transformations/md5.cc b/src/actions/transformations/md5.cc new file mode 100644 index 00000000..9789eb1c --- /dev/null +++ b/src/actions/transformations/md5.cc @@ -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. + * + */ + +#include "actions/transformations/md5.h" + +#include +#include +#include +#include +#include +#include + +#include "modsecurity/assay.h" +#include "actions/transformations/transformation.h" + + +namespace ModSecurity { +namespace actions { +namespace transformations { + +Md5::Md5(std::string action) + : Transformation(action) { + this->action_kind = 1; +} + +std::string& Md5::evaluate(std::string value, + Assay *assay) { + /** + * @todo Implement the transformation Md5 + */ + assay->debug(4, "Transformation Md5 is not implemented yet."); + return value; +} + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity diff --git a/src/actions/transformations/md5.h b/src/actions/transformations/md5.h new file mode 100644 index 00000000..ab7bf7b5 --- /dev/null +++ b/src/actions/transformations/md5.h @@ -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 + +#include "actions/action.h" +#include "actions/transformations/transformation.h" + +#ifndef SRC_ACTIONS_TRANSFORMATIONS_MD5_H_ +#define SRC_ACTIONS_TRANSFORMATIONS_MD5_H_ + +#ifdef __cplusplus +namespace ModSecurity { +class Assay; + +namespace actions { +namespace transformations { + +class Md5 : public Transformation { + public: + explicit Md5(std::string action); + std::string& evaluate(std::string exp, + Assay *assay) override; +}; + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity + +#endif + +#endif // SRC_ACTIONS_TRANSFORMATIONS_MD5_H_ diff --git a/src/actions/transformations/none.cc b/src/actions/transformations/none.cc new file mode 100644 index 00000000..ca7a28dc --- /dev/null +++ b/src/actions/transformations/none.cc @@ -0,0 +1,48 @@ +/** + * 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 "actions/transformations/none.h" + +#include +#include +#include +#include +#include +#include + +#include "modsecurity/assay.h" +#include "actions/transformations/transformation.h" + + +namespace ModSecurity { +namespace actions { +namespace transformations { + +None::None(std::string action) + : Transformation(action) { + this->action_kind = 1; +} + +std::string& None::evaluate(std::string value, + Assay *assay) { + /** + * @todo Implement the transformation None + */ + assay->debug(4, "Transformation None is not implemented yet."); +} + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity diff --git a/src/actions/transformations/none.h b/src/actions/transformations/none.h new file mode 100644 index 00000000..4d9c2881 --- /dev/null +++ b/src/actions/transformations/none.h @@ -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 + +#include "actions/action.h" +#include "actions/transformations/transformation.h" + +#ifndef SRC_ACTIONS_TRANSFORMATIONS_NONE_H_ +#define SRC_ACTIONS_TRANSFORMATIONS_NONE_H_ + +#ifdef __cplusplus +namespace ModSecurity { +class Assay; + +namespace actions { +namespace transformations { + +class None : public Transformation { + public: + explicit None(std::string action); + std::string& evaluate(std::string exp, + Assay *assay) override; +}; + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity + +#endif + +#endif // SRC_ACTIONS_TRANSFORMATIONS_NONE_H_ diff --git a/src/actions/transformations/normalise_path.cc b/src/actions/transformations/normalise_path.cc new file mode 100644 index 00000000..47228ee4 --- /dev/null +++ b/src/actions/transformations/normalise_path.cc @@ -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. + * + */ + +#include "actions/transformations/normalise_path.h" + +#include +#include +#include +#include +#include +#include + +#include "modsecurity/assay.h" +#include "actions/transformations/transformation.h" + + +namespace ModSecurity { +namespace actions { +namespace transformations { + +NormalisePath::NormalisePath(std::string action) + : Transformation(action) { + this->action_kind = 1; +} + +std::string& NormalisePath::evaluate(std::string value, + Assay *assay) { + /** + * @todo Implement the transformation NormalisePath + */ + assay->debug(4, "Transformation NormalisePath is not implemented yet."); + return value; +} + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity diff --git a/src/actions/transformations/normalise_path.h b/src/actions/transformations/normalise_path.h new file mode 100644 index 00000000..01a78861 --- /dev/null +++ b/src/actions/transformations/normalise_path.h @@ -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 + +#include "actions/action.h" +#include "actions/transformations/transformation.h" + +#ifndef SRC_ACTIONS_TRANSFORMATIONS_NORMALISE_PATH_H_ +#define SRC_ACTIONS_TRANSFORMATIONS_NORMALISE_PATH_H_ + +#ifdef __cplusplus +namespace ModSecurity { +class Assay; + +namespace actions { +namespace transformations { + +class NormalisePath : public Transformation { + public: + explicit NormalisePath(std::string action); + std::string& evaluate(std::string exp, + Assay *assay) override; +}; + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity + +#endif + +#endif // SRC_ACTIONS_TRANSFORMATIONS_NORMALISE_PATH_H_ diff --git a/src/actions/transformations/normalise_path_win.cc b/src/actions/transformations/normalise_path_win.cc new file mode 100644 index 00000000..9e0ea05d --- /dev/null +++ b/src/actions/transformations/normalise_path_win.cc @@ -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. + * + */ + +#include "actions/transformations/normalise_path_win.h" + +#include +#include +#include +#include +#include +#include + +#include "modsecurity/assay.h" +#include "actions/transformations/transformation.h" + + +namespace ModSecurity { +namespace actions { +namespace transformations { + +NormalisePathWin::NormalisePathWin(std::string action) + : Transformation(action) { + this->action_kind = 1; +} + +std::string& NormalisePathWin::evaluate(std::string value, + Assay *assay) { + /** + * @todo Implement the transformation NormalisePathWin + */ + assay->debug(4, "Transformation NormalisePathWin is not implemented yet."); + return value; +} + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity diff --git a/src/actions/transformations/normalise_path_win.h b/src/actions/transformations/normalise_path_win.h new file mode 100644 index 00000000..9bfb6f8c --- /dev/null +++ b/src/actions/transformations/normalise_path_win.h @@ -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 + +#include "actions/action.h" +#include "actions/transformations/transformation.h" + +#ifndef SRC_ACTIONS_TRANSFORMATIONS_NORMALISE_PATH_WIN_H_ +#define SRC_ACTIONS_TRANSFORMATIONS_NORMALISE_PATH_WIN_H_ + +#ifdef __cplusplus +namespace ModSecurity { +class Assay; + +namespace actions { +namespace transformations { + +class NormalisePathWin : public Transformation { + public: + explicit NormalisePathWin(std::string action); + std::string& evaluate(std::string exp, + Assay *assay) override; +}; + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity + +#endif + +#endif // SRC_ACTIONS_TRANSFORMATIONS_NORMALISE_PATH_WIN_H_ diff --git a/src/actions/transformations/parity_even_7bit.cc b/src/actions/transformations/parity_even_7bit.cc new file mode 100644 index 00000000..522bd175 --- /dev/null +++ b/src/actions/transformations/parity_even_7bit.cc @@ -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. + * + */ + +#include "actions/transformations/parity_even_7bit.h" + +#include +#include +#include +#include +#include +#include + +#include "modsecurity/assay.h" +#include "actions/transformations/transformation.h" + + +namespace ModSecurity { +namespace actions { +namespace transformations { + +ParityEven7bit::ParityEven7bit(std::string action) + : Transformation(action) { + this->action_kind = 1; +} + +std::string& ParityEven7bit::evaluate(std::string value, + Assay *assay) { + /** + * @todo Implement the transformation ParityEven7bit + */ + assay->debug(4, "Transformation ParityEven7bit is not implemented yet."); + return value; +} + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity diff --git a/src/actions/transformations/parity_even_7bit.h b/src/actions/transformations/parity_even_7bit.h new file mode 100644 index 00000000..294cdebe --- /dev/null +++ b/src/actions/transformations/parity_even_7bit.h @@ -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 + +#include "actions/action.h" +#include "actions/transformations/transformation.h" + +#ifndef SRC_ACTIONS_TRANSFORMATIONS_PARITY_EVEN_7BIT_H_ +#define SRC_ACTIONS_TRANSFORMATIONS_PARITY_EVEN_7BIT_H_ + +#ifdef __cplusplus +namespace ModSecurity { +class Assay; + +namespace actions { +namespace transformations { + +class ParityEven7bit : public Transformation { + public: + explicit ParityEven7bit(std::string action); + std::string& evaluate(std::string exp, + Assay *assay) override; +}; + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity + +#endif + +#endif // SRC_ACTIONS_TRANSFORMATIONS_PARITY_EVEN_7BIT_H_ diff --git a/src/actions/transformations/parity_odd_7bit.cc b/src/actions/transformations/parity_odd_7bit.cc new file mode 100644 index 00000000..e25d9752 --- /dev/null +++ b/src/actions/transformations/parity_odd_7bit.cc @@ -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. + * + */ + +#include "actions/transformations/parity_odd_7bit.h" + +#include +#include +#include +#include +#include +#include + +#include "modsecurity/assay.h" +#include "actions/transformations/transformation.h" + + +namespace ModSecurity { +namespace actions { +namespace transformations { + +ParityOdd7bit::ParityOdd7bit(std::string action) + : Transformation(action) { + this->action_kind = 1; +} + +std::string& ParityOdd7bit::evaluate(std::string value, + Assay *assay) { + /** + * @todo Implement the transformation ParityOdd7bit + */ + assay->debug(4, "Transformation ParityOdd7bit is not implemented yet."); + return value; +} + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity diff --git a/src/actions/transformations/parity_odd_7bit.h b/src/actions/transformations/parity_odd_7bit.h new file mode 100644 index 00000000..491d7ce4 --- /dev/null +++ b/src/actions/transformations/parity_odd_7bit.h @@ -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 + +#include "actions/action.h" +#include "actions/transformations/transformation.h" + +#ifndef SRC_ACTIONS_TRANSFORMATIONS_PARITY_ODD_7BIT_H_ +#define SRC_ACTIONS_TRANSFORMATIONS_PARITY_ODD_7BIT_H_ + +#ifdef __cplusplus +namespace ModSecurity { +class Assay; + +namespace actions { +namespace transformations { + +class ParityOdd7bit : public Transformation { + public: + explicit ParityOdd7bit(std::string action); + std::string& evaluate(std::string exp, + Assay *assay) override; +}; + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity + +#endif + +#endif // SRC_ACTIONS_TRANSFORMATIONS_PARITY_EVEN_7BIT_H_ diff --git a/src/actions/transformations/parity_zero_7bit.cc b/src/actions/transformations/parity_zero_7bit.cc new file mode 100644 index 00000000..01e409a9 --- /dev/null +++ b/src/actions/transformations/parity_zero_7bit.cc @@ -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. + * + */ + +#include "actions/transformations/parity_zero_7bit.h" + +#include +#include +#include +#include +#include +#include + +#include "modsecurity/assay.h" +#include "actions/transformations/transformation.h" + + +namespace ModSecurity { +namespace actions { +namespace transformations { + +ParityZero7bit::ParityZero7bit(std::string action) + : Transformation(action) { + this->action_kind = 1; +} + +std::string& ParityZero7bit::evaluate(std::string value, + Assay *assay) { + /** + * @todo Implement the transformation ParityZero7bit + */ + assay->debug(4, "Transformation ParityZero7bit is not implemented yet."); + return value; +} + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity diff --git a/src/actions/transformations/parity_zero_7bit.h b/src/actions/transformations/parity_zero_7bit.h new file mode 100644 index 00000000..1bfddd3b --- /dev/null +++ b/src/actions/transformations/parity_zero_7bit.h @@ -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 + +#include "actions/action.h" +#include "actions/transformations/transformation.h" + +#ifndef SRC_ACTIONS_TRANSFORMATIONS_PARITY_ZERO_7BIT_H_ +#define SRC_ACTIONS_TRANSFORMATIONS_PARITY_ZERO_7BIT_H_ + +#ifdef __cplusplus +namespace ModSecurity { +class Assay; + +namespace actions { +namespace transformations { + +class ParityZero7bit : public Transformation { + public: + explicit ParityZero7bit(std::string action); + std::string& evaluate(std::string exp, + Assay *assay) override; +}; + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity + +#endif + +#endif // SRC_ACTIONS_TRANSFORMATIONS_PARITY_ZERO_7BIT_H_ diff --git a/src/actions/transformations/remove_comments.cc b/src/actions/transformations/remove_comments.cc new file mode 100644 index 00000000..997d0860 --- /dev/null +++ b/src/actions/transformations/remove_comments.cc @@ -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. + * + */ + +#include "actions/transformations/remove_comments.h" + +#include +#include +#include +#include +#include +#include + +#include "modsecurity/assay.h" +#include "actions/transformations/transformation.h" + + +namespace ModSecurity { +namespace actions { +namespace transformations { + +RemoveComments::RemoveComments(std::string action) + : Transformation(action) { + this->action_kind = 1; +} + +std::string& RemoveComments::evaluate(std::string value, + Assay *assay) { + /** + * @todo Implement the transformation RemoveComments + */ + assay->debug(4, "Transformation RemoveComments is not implemented yet."); + return value; +} + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity diff --git a/src/actions/transformations/remove_comments.h b/src/actions/transformations/remove_comments.h new file mode 100644 index 00000000..87794e64 --- /dev/null +++ b/src/actions/transformations/remove_comments.h @@ -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 + +#include "actions/action.h" +#include "actions/transformations/transformation.h" + +#ifndef SRC_ACTIONS_TRANSFORMATIONS_REMOVE_COMMENTS_H_ +#define SRC_ACTIONS_TRANSFORMATIONS_REMOVE_COMMENTS_H_ + +#ifdef __cplusplus +namespace ModSecurity { +class Assay; + +namespace actions { +namespace transformations { + +class RemoveComments : public Transformation { + public: + explicit RemoveComments(std::string action); + std::string& evaluate(std::string exp, + Assay *assay) override; +}; + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity + +#endif + +#endif // SRC_ACTIONS_TRANSFORMATIONS_REMOVE_COMMENTS_H_ diff --git a/src/actions/transformations/remove_comments_char.cc b/src/actions/transformations/remove_comments_char.cc new file mode 100644 index 00000000..f4833bc2 --- /dev/null +++ b/src/actions/transformations/remove_comments_char.cc @@ -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. + * + */ + +#include "actions/transformations/remove_comments_char.h" + +#include +#include +#include +#include +#include +#include + +#include "modsecurity/assay.h" +#include "actions/transformations/transformation.h" + + +namespace ModSecurity { +namespace actions { +namespace transformations { + +RemoveCommentsChar::RemoveCommentsChar(std::string action) + : Transformation(action) { + this->action_kind = 1; +} + +std::string& RemoveCommentsChar::evaluate(std::string value, + Assay *assay) { + /** + * @todo Implement the transformation RemoveCommentsChar + */ + assay->debug(4, "Transformation RemoveCommentsChar is not implemented yet."); + return value; +} + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity diff --git a/src/actions/transformations/remove_comments_char.h b/src/actions/transformations/remove_comments_char.h new file mode 100644 index 00000000..22a8b18b --- /dev/null +++ b/src/actions/transformations/remove_comments_char.h @@ -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 + +#include "actions/action.h" +#include "actions/transformations/transformation.h" + +#ifndef SRC_ACTIONS_TRANSFORMATIONS_REMOVE_COMMENTS_CHAR_H_ +#define SRC_ACTIONS_TRANSFORMATIONS_REMOVE_COMMENTS_CHAR_H_ + +#ifdef __cplusplus +namespace ModSecurity { +class Assay; + +namespace actions { +namespace transformations { + +class RemoveCommentsChar : public Transformation { + public: + explicit RemoveCommentsChar(std::string action); + std::string& evaluate(std::string exp, + Assay *assay) override; +}; + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity + +#endif + +#endif // SRC_ACTIONS_TRANSFORMATIONS_REMOVE_COMMENTS_CHAR_H_ diff --git a/src/actions/transformations/remove_nulls.cc b/src/actions/transformations/remove_nulls.cc new file mode 100644 index 00000000..0e7acb34 --- /dev/null +++ b/src/actions/transformations/remove_nulls.cc @@ -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. + * + */ + +#include "actions/transformations/remove_nulls.h" + +#include +#include +#include +#include +#include +#include + +#include "modsecurity/assay.h" +#include "actions/transformations/transformation.h" + + +namespace ModSecurity { +namespace actions { +namespace transformations { + +RemoveNulls::RemoveNulls(std::string action) + : Transformation(action) { + this->action_kind = 1; +} + +std::string& RemoveNulls::evaluate(std::string value, + Assay *assay) { + /** + * @todo Implement the transformation RemoveNulls + */ + assay->debug(4, "Transformation RemoveNulls is not implemented yet."); + return value; +} + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity diff --git a/src/actions/transformations/remove_nulls.h b/src/actions/transformations/remove_nulls.h new file mode 100644 index 00000000..45240bb3 --- /dev/null +++ b/src/actions/transformations/remove_nulls.h @@ -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 + +#include "actions/action.h" +#include "actions/transformations/transformation.h" + +#ifndef SRC_ACTIONS_TRANSFORMATIONS_REMOVE_NULLS_H_ +#define SRC_ACTIONS_TRANSFORMATIONS_REMOVE_NULLS_H_ + +#ifdef __cplusplus +namespace ModSecurity { +class Assay; + +namespace actions { +namespace transformations { + +class RemoveNulls : public Transformation { + public: + explicit RemoveNulls(std::string action); + std::string& evaluate(std::string exp, + Assay *assay) override; +}; + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity + +#endif + +#endif // SRC_ACTIONS_TRANSFORMATIONS_REMOVE_NULLS_H_ diff --git a/src/actions/transformations/remove_whitespace.cc b/src/actions/transformations/remove_whitespace.cc new file mode 100644 index 00000000..2b7cdfab --- /dev/null +++ b/src/actions/transformations/remove_whitespace.cc @@ -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. + * + */ + +#include "actions/transformations/remove_whitespace.h" + +#include +#include +#include +#include +#include +#include + +#include "modsecurity/assay.h" +#include "actions/transformations/transformation.h" + + +namespace ModSecurity { +namespace actions { +namespace transformations { + +RemoveWhitespace::RemoveWhitespace(std::string action) + : Transformation(action) { + this->action_kind = 1; +} + +std::string& RemoveWhitespace::evaluate(std::string value, + Assay *assay) { + /** + * @todo Implement the transformation RemoveWhitespace + */ + assay->debug(4, "Transformation RemoveWhitespace is not implemented yet."); + return value; +} + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity diff --git a/src/actions/transformations/remove_whitespace.h b/src/actions/transformations/remove_whitespace.h new file mode 100644 index 00000000..be3f7e9a --- /dev/null +++ b/src/actions/transformations/remove_whitespace.h @@ -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 + +#include "actions/action.h" +#include "actions/transformations/transformation.h" + +#ifndef SRC_ACTIONS_TRANSFORMATIONS_REMOVE_WHITESPACE_H_ +#define SRC_ACTIONS_TRANSFORMATIONS_REMOVE_WHITESPACE_H_ + +#ifdef __cplusplus +namespace ModSecurity { +class Assay; + +namespace actions { +namespace transformations { + +class RemoveWhitespace : public Transformation { + public: + explicit RemoveWhitespace(std::string action); + std::string& evaluate(std::string exp, + Assay *assay) override; +}; + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity + +#endif + +#endif // SRC_ACTIONS_TRANSFORMATIONS_REMOVE_WHITESPACE_H_ diff --git a/src/actions/transformations/replace_comments.cc b/src/actions/transformations/replace_comments.cc new file mode 100644 index 00000000..3866f9f1 --- /dev/null +++ b/src/actions/transformations/replace_comments.cc @@ -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. + * + */ + +#include "actions/transformations/replace_comments.h" + +#include +#include +#include +#include +#include +#include + +#include "modsecurity/assay.h" +#include "actions/transformations/transformation.h" + + +namespace ModSecurity { +namespace actions { +namespace transformations { + +ReplaceComments::ReplaceComments(std::string action) + : Transformation(action) { + this->action_kind = 1; +} + +std::string& ReplaceComments::evaluate(std::string value, + Assay *assay) { + /** + * @todo Implement the transformation ReplaceComments + */ + assay->debug(4, "Transformation ReplaceComments is not implemented yet."); + return value; +} + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity diff --git a/src/actions/transformations/replace_comments.h b/src/actions/transformations/replace_comments.h new file mode 100644 index 00000000..1f1d6ecf --- /dev/null +++ b/src/actions/transformations/replace_comments.h @@ -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 + +#include "actions/action.h" +#include "actions/transformations/transformation.h" + +#ifndef SRC_ACTIONS_TRANSFORMATIONS_REPLACE_COMMENTS_H_ +#define SRC_ACTIONS_TRANSFORMATIONS_REPLACE_COMMENTS_H_ + +#ifdef __cplusplus +namespace ModSecurity { +class Assay; + +namespace actions { +namespace transformations { + +class ReplaceComments : public Transformation { + public: + explicit ReplaceComments(std::string action); + std::string& evaluate(std::string exp, + Assay *assay) override; +}; + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity + +#endif + +#endif // SRC_ACTIONS_TRANSFORMATIONS_REPLACE_COMMENTS_H_ diff --git a/src/actions/transformations/replace_nulls.cc b/src/actions/transformations/replace_nulls.cc new file mode 100644 index 00000000..c6714ba0 --- /dev/null +++ b/src/actions/transformations/replace_nulls.cc @@ -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. + * + */ + +#include "actions/transformations/replace_nulls.h" + +#include +#include +#include +#include +#include +#include + +#include "modsecurity/assay.h" +#include "actions/transformations/transformation.h" + + +namespace ModSecurity { +namespace actions { +namespace transformations { + +ReplaceNulls::ReplaceNulls(std::string action) + : Transformation(action) { + this->action_kind = 1; +} + +std::string& ReplaceNulls::evaluate(std::string value, + Assay *assay) { + /** + * @todo Implement the transformation ReplaceNulls + */ + assay->debug(4, "Transformation ReplaceNulls is not implemented yet."); + return value; +} + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity diff --git a/src/actions/transformations/replace_nulls.h b/src/actions/transformations/replace_nulls.h new file mode 100644 index 00000000..11fcb455 --- /dev/null +++ b/src/actions/transformations/replace_nulls.h @@ -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 + +#include "actions/action.h" +#include "actions/transformations/transformation.h" + +#ifndef SRC_ACTIONS_TRANSFORMATIONS_REPLACE_NULLS_H_ +#define SRC_ACTIONS_TRANSFORMATIONS_REPLACE_NULLS_H_ + +#ifdef __cplusplus +namespace ModSecurity { +class Assay; + +namespace actions { +namespace transformations { + +class ReplaceNulls : public Transformation { + public: + explicit ReplaceNulls(std::string action); + std::string& evaluate(std::string exp, + Assay *assay) override; +}; + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity + +#endif + +#endif // SRC_ACTIONS_TRANSFORMATIONS_REPLACE_NULLS_H_ diff --git a/src/actions/transformations/sha1.cc b/src/actions/transformations/sha1.cc new file mode 100644 index 00000000..622d7fa0 --- /dev/null +++ b/src/actions/transformations/sha1.cc @@ -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. + * + */ + +#include "actions/transformations/sha1.h" + +#include +#include +#include +#include +#include +#include + +#include "modsecurity/assay.h" +#include "actions/transformations/transformation.h" + + +namespace ModSecurity { +namespace actions { +namespace transformations { + +Sha1::Sha1(std::string action) + : Transformation(action) { + this->action_kind = 1; +} + +std::string& Sha1::evaluate(std::string value, + Assay *assay) { + /** + * @todo Implement the transformation Sha1 + */ + assay->debug(4, "Transformation Sha1 is not implemented yet."); + return value; +} + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity diff --git a/src/actions/transformations/sha1.h b/src/actions/transformations/sha1.h new file mode 100644 index 00000000..ce4a6d8b --- /dev/null +++ b/src/actions/transformations/sha1.h @@ -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 + +#include "actions/action.h" +#include "actions/transformations/transformation.h" + +#ifndef SRC_ACTIONS_TRANSFORMATIONS_SHA1_H_ +#define SRC_ACTIONS_TRANSFORMATIONS_SHA1_H_ + +#ifdef __cplusplus +namespace ModSecurity { +class Assay; + +namespace actions { +namespace transformations { + +class Sha1 : public Transformation { + public: + explicit Sha1(std::string action); + std::string& evaluate(std::string exp, + Assay *assay) override; +}; + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity + +#endif + +#endif // SRC_ACTIONS_TRANSFORMATIONS_SHA1_H_ diff --git a/src/actions/transformations/sql_hex_decode.cc b/src/actions/transformations/sql_hex_decode.cc new file mode 100644 index 00000000..ed48dd01 --- /dev/null +++ b/src/actions/transformations/sql_hex_decode.cc @@ -0,0 +1,48 @@ +/** + * 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 "actions/transformations/sql_hex_decode.h" + +#include +#include +#include +#include +#include +#include + +#include "modsecurity/assay.h" +#include "actions/transformations/transformation.h" + + +namespace ModSecurity { +namespace actions { +namespace transformations { + +SqlHexDecode::SqlHexDecode(std::string action) + : Transformation(action) { + this->action_kind = 1; +} + +std::string& SqlHexDecode::evaluate(std::string value, + Assay *assay) { + /** + * @todo Implement the transformation SqlHexDecode + */ + assay->debug(4, "Transformation SqlHexDecode is not implemented yet."); +} + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity diff --git a/src/actions/transformations/sql_hex_decode.h b/src/actions/transformations/sql_hex_decode.h new file mode 100644 index 00000000..f46a9868 --- /dev/null +++ b/src/actions/transformations/sql_hex_decode.h @@ -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 + +#include "actions/action.h" +#include "actions/transformations/transformation.h" + +#ifndef SRC_ACTIONS_TRANSFORMATIONS_SQL_HEX_DECODE_H_ +#define SRC_ACTIONS_TRANSFORMATIONS_SQL_HEX_DECODE_H_ + +#ifdef __cplusplus +namespace ModSecurity { +class Assay; + +namespace actions { +namespace transformations { + +class SqlHexDecode : public Transformation { + public: + explicit SqlHexDecode(std::string action); + std::string& evaluate(std::string exp, + Assay *assay) override; +}; + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity + +#endif + +#endif // SRC_ACTIONS_TRANSFORMATIONS_SQL_HEX_DECODE_H_ diff --git a/src/actions/transformations/transformation.cc b/src/actions/transformations/transformation.cc index 944e2e93..bb166b66 100644 --- a/src/actions/transformations/transformation.cc +++ b/src/actions/transformations/transformation.cc @@ -15,13 +15,52 @@ #include "actions/transformations/transformation.h" +#include + #include #include #include "modsecurity/assay.h" -#include "actions/transformations/trim.h" -#include "actions/transformations/lowercase.h" #include "actions/action.h" +#include "actions/transformations/base64_decode_ext.h" +#include "actions/transformations/base64_decode.h" +#include "actions/transformations/cmd_line.h" +#include "actions/transformations/compress_whitespace.h" +#include "actions/transformations/css_decode.h" +#include "actions/transformations/escape_seq_decode.h" +#include "actions/transformations/hex_decode.h" +#include "actions/transformations/hex_encode.h" +#include "actions/transformations/html_entity_decode.h" +#include "actions/transformations/js_decode.h" +#include "actions/transformations/length.h" +#include "actions/transformations/lowercase.h" +#include "actions/transformations/md5.h" +#include "actions/transformations/none.h" +#include "actions/transformations/normalise_path.h" +#include "actions/transformations/normalise_path_win.h" +#include "actions/transformations/parity_even_7bit.h" +#include "actions/transformations/parity_odd_7bit.h" +#include "actions/transformations/parity_zero_7bit.h" +#include "actions/transformations/remove_comments_char.h" +#include "actions/transformations/remove_comments.h" +#include "actions/transformations/remove_nulls.h" +#include "actions/transformations/remove_whitespace.h" +#include "actions/transformations/replace_comments.h" +#include "actions/transformations/replace_nulls.h" +#include "actions/transformations/sha1.h" +#include "actions/transformations/sql_hex_decode.h" +#include "actions/transformations/transformation.h" +#include "actions/transformations/trim.h" +#include "actions/transformations/trim_left.h" +#include "actions/transformations/trim_right.h" +#include "actions/transformations/url_decode.h" +#include "actions/transformations/url_decode_uni.h" +#include "actions/transformations/url_encode.h" +#include "actions/transformations/utf8_to_unicode.h" + +#define IF_MATCH(b) \ + if (a.compare(2, std::strlen(#b), #b) == 0) + namespace ModSecurity { namespace actions { @@ -40,13 +79,43 @@ std::string &Transformation::evaluate(std::string value, } Transformation* Transformation::instantiate(std::string a) { - if (a == "t:trim") { - return new transformations::Trim(a); - } - if (a == "t:lowercase") { - return new LowerCase(a); - } - + + IF_MATCH(base64_decode_ext) { return new Base64DecodeExt(a); } + IF_MATCH(base64_decode) { return new Base64Decode(a); } + IF_MATCH(cmd_line) { return new CmdLine(a); } + IF_MATCH(compress_whitespace) { return new CompressWhitespace(a); } + IF_MATCH(css_decode) { return new CssDecode(a); } + IF_MATCH(escape_seq_decode) { return new EscapeSeqDecode(a); } + IF_MATCH(hex_decode) { return new HexDecode(a); } + IF_MATCH(hex_encode) { return new HexEncode(a); } + IF_MATCH(html_entity_decode) { return new HtmlEntityDecode(a); } + IF_MATCH(js_decode) { return new JsDecode(a); } + IF_MATCH(length) { return new Length(a); } + IF_MATCH(lowercase) { return new LowerCase(a); } + IF_MATCH(md5) { return new Md5(a); } + IF_MATCH(none) { return new None(a); } + IF_MATCH(normalise_path) { return new NormalisePath(a); } + IF_MATCH(normalise_path_win) { return new NormalisePathWin(a); } + IF_MATCH(parity_even_7bit) { return new ParityEven7bit(a); } + IF_MATCH(parity_odd_7bit) { return new ParityOdd7bit(a); } + IF_MATCH(parity_zero_7bit) { return new ParityZero7bit(a); } + IF_MATCH(remove_comments_char) { return new RemoveCommentsChar(a); } + IF_MATCH(remove_comments) { return new RemoveComments(a); } + IF_MATCH(remove_nulls) { return new RemoveNulls(a); } + IF_MATCH(remove_whitespace) { return new RemoveWhitespace(a); } + IF_MATCH(replace_comments) { return new ReplaceComments(a); } + IF_MATCH(replace_nulls) { return new ReplaceNulls(a); } + IF_MATCH(sha1) { return new Sha1(a); } + IF_MATCH(sql_hex_decode) { return new SqlHexDecode(a); } + IF_MATCH(transformation) { return new Transformation(a); } + IF_MATCH(trim) { return new Trim(a); } + IF_MATCH(trim_left) { return new TrimLeft(a); } + IF_MATCH(trim_right) { return new TrimRight(a); } + IF_MATCH(url_decode) { return new UrlDecode(a); } + IF_MATCH(url_decode_uni) { return new UrlDecodeUni(a); } + IF_MATCH(url_encode) { return new UrlEncode(a); } + IF_MATCH(utf8_to_unicode) { return new Utf8Unicode(a); } + return new Transformation(a); } diff --git a/src/actions/transformations/trim.cc b/src/actions/transformations/trim.cc index a31dd88f..e4850ac7 100644 --- a/src/actions/transformations/trim.cc +++ b/src/actions/transformations/trim.cc @@ -30,32 +30,38 @@ namespace ModSecurity { namespace actions { namespace transformations { -static inline std::string *ltrim(std::string *s) { + +std::string *Trim::ltrim(std::string *s) { s->erase(s->begin(), std::find_if(s->begin(), s->end(), std::not1(std::ptr_fun(std::isspace)))); return s; } -static inline std::string *rtrim(std::string *s) { + +std::string *Trim::rtrim(std::string *s) { s->erase(std::find_if(s->rbegin(), s->rend(), std::not1(std::ptr_fun(std::isspace))).base(), s->end()); return s; } -static inline std::string *trim(std::string *s) { + +std::string *Trim::trim(std::string *s) { return ltrim(rtrim(s)); } + Trim::Trim(std::string action) : Transformation(action) { this->action_kind = 1; } -std::string & Trim::evaluate(std::string value, + +std::string& Trim::evaluate(std::string value, Assay *assay) { - return *trim(&value); + return *this->trim(&value); } + } // namespace transformations } // namespace actions } // namespace ModSecurity diff --git a/src/actions/transformations/trim.h b/src/actions/transformations/trim.h index 19ed0c49..6d5179f8 100644 --- a/src/actions/transformations/trim.h +++ b/src/actions/transformations/trim.h @@ -33,6 +33,10 @@ class Trim : public Transformation { explicit Trim(std::string action); std::string& evaluate(std::string exp, Assay *assay) override; + + std::string *ltrim(std::string *s); + std::string *rtrim(std::string *s); + std::string *trim(std::string *s); }; } // namespace transformations diff --git a/src/actions/transformations/trim_left.cc b/src/actions/transformations/trim_left.cc new file mode 100644 index 00000000..becfa1e9 --- /dev/null +++ b/src/actions/transformations/trim_left.cc @@ -0,0 +1,48 @@ +/** + * 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 "actions/transformations/trim_left.h" + +#include +#include +#include +#include +#include +#include + +#include "modsecurity/assay.h" +#include "actions/transformations/transformation.h" +#include "actions/transformations/trim.h" +#include "actions/action.h" + +namespace ModSecurity { +namespace actions { +namespace transformations { + + + +TrimLeft::TrimLeft(std::string action) + : Trim(action) { + this->action_kind = 1; +} + +std::string& TrimLeft::evaluate(std::string value, + Assay *assay) { + return *trim(&value); +} + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity diff --git a/src/actions/transformations/trim_left.h b/src/actions/transformations/trim_left.h new file mode 100644 index 00000000..e9a99326 --- /dev/null +++ b/src/actions/transformations/trim_left.h @@ -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 + +#include "actions/action.h" +#include "actions/transformations/transformation.h" +#include "actions/transformations/trim.h" + +#ifndef SRC_ACTIONS_TRANSFORMATIONS_TRIM_LEFT_H_ +#define SRC_ACTIONS_TRANSFORMATIONS_TRIM_LEFT_H_ + +#ifdef __cplusplus +namespace ModSecurity { +class Assay; + +namespace actions { +namespace transformations { + +class TrimLeft : public Trim { + public: + explicit TrimLeft(std::string action); + std::string& evaluate(std::string exp, + Assay *assay) override; +}; + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity + +#endif + +#endif // SRC_ACTIONS_TRANSFORMATIONS_TRIM_LEFT_H_ diff --git a/src/actions/transformations/trim_right.cc b/src/actions/transformations/trim_right.cc new file mode 100644 index 00000000..05bc5125 --- /dev/null +++ b/src/actions/transformations/trim_right.cc @@ -0,0 +1,46 @@ +/** + * 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 "actions/transformations/trim_right.h" + +#include +#include +#include +#include +#include +#include + +#include "modsecurity/assay.h" +#include "actions/transformations/transformation.h" +#include "actions/action.h" + +namespace ModSecurity { +namespace actions { +namespace transformations { + + +TrimRight::TrimRight(std::string action) + : Trim(action) { + this->action_kind = 1; +} + +std::string& TrimRight::evaluate(std::string value, + Assay *assay) { + return *this->trim(&value); +} + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity diff --git a/src/actions/transformations/trim_right.h b/src/actions/transformations/trim_right.h new file mode 100644 index 00000000..a2d93a2f --- /dev/null +++ b/src/actions/transformations/trim_right.h @@ -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 + +#include "actions/action.h" +#include "actions/transformations/transformation.h" +#include "actions/transformations/trim.h" + +#ifndef SRC_ACTIONS_TRANSFORMATIONS_TRIM_RIGHT_H_ +#define SRC_ACTIONS_TRANSFORMATIONS_TRIM_RIGHT_H_ + +#ifdef __cplusplus +namespace ModSecurity { +class Assay; + +namespace actions { +namespace transformations { + +class TrimRight : public Trim { + public: + explicit TrimRight(std::string action); + std::string& evaluate(std::string exp, + Assay *assay) override; +}; + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity + +#endif + +#endif // SRC_ACTIONS_TRANSFORMATIONS_TRIM_H_ diff --git a/src/actions/transformations/url_decode.cc b/src/actions/transformations/url_decode.cc new file mode 100644 index 00000000..d071b178 --- /dev/null +++ b/src/actions/transformations/url_decode.cc @@ -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. + * + */ + +#include "actions/transformations/url_decode.h" + +#include +#include +#include +#include +#include +#include + +#include "modsecurity/assay.h" +#include "actions/transformations/transformation.h" + + +namespace ModSecurity { +namespace actions { +namespace transformations { + +UrlDecode::UrlDecode(std::string action) + : Transformation(action) { + this->action_kind = 1; +} + +std::string& UrlDecode::evaluate(std::string value, + Assay *assay) { + /** + * @todo Implement the transformation UrlDecode + */ + assay->debug(4, "Transformation UrlDecode is not implemented yet."); + return value; +} + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity diff --git a/src/actions/transformations/url_decode.h b/src/actions/transformations/url_decode.h new file mode 100644 index 00000000..3cb8d259 --- /dev/null +++ b/src/actions/transformations/url_decode.h @@ -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 + +#include "actions/action.h" +#include "actions/transformations/transformation.h" + +#ifndef SRC_ACTIONS_TRANSFORMATIONS_URL_DECODE_H_ +#define SRC_ACTIONS_TRANSFORMATIONS_URL_DECODE_H_ + +#ifdef __cplusplus +namespace ModSecurity { +class Assay; + +namespace actions { +namespace transformations { + +class UrlDecode : public Transformation { + public: + explicit UrlDecode(std::string action); + std::string& evaluate(std::string exp, + Assay *assay) override; +}; + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity + +#endif + +#endif // SRC_ACTIONS_TRANSFORMATIONS_URL_DECODE_H_ diff --git a/src/actions/transformations/url_decode_uni.cc b/src/actions/transformations/url_decode_uni.cc new file mode 100644 index 00000000..c41f34f3 --- /dev/null +++ b/src/actions/transformations/url_decode_uni.cc @@ -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. + * + */ + +#include "actions/transformations/url_decode_uni.h" + +#include +#include +#include +#include +#include +#include + +#include "modsecurity/assay.h" +#include "actions/transformations/transformation.h" + + +namespace ModSecurity { +namespace actions { +namespace transformations { + +UrlDecodeUni::UrlDecodeUni(std::string action) + : Transformation(action) { + this->action_kind = 1; +} + +std::string& UrlDecodeUni::evaluate(std::string value, + Assay *assay) { + /** + * @todo Implement the transformation UrlDecodeUni + */ + assay->debug(4, "Transformation UrlDecodeUni is not implemented yet."); + return value; +} + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity diff --git a/src/actions/transformations/url_decode_uni.h b/src/actions/transformations/url_decode_uni.h new file mode 100644 index 00000000..8e9f14bb --- /dev/null +++ b/src/actions/transformations/url_decode_uni.h @@ -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 + +#include "actions/action.h" +#include "actions/transformations/transformation.h" + +#ifndef SRC_ACTIONS_TRANSFORMATIONS_URL_DECODE_UNI_H_ +#define SRC_ACTIONS_TRANSFORMATIONS_URL_DECODE_UNI_H_ + +#ifdef __cplusplus +namespace ModSecurity { +class Assay; + +namespace actions { +namespace transformations { + +class UrlDecodeUni : public Transformation { + public: + explicit UrlDecodeUni(std::string action); + std::string& evaluate(std::string exp, + Assay *assay) override; +}; + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity + +#endif + +#endif // SRC_ACTIONS_TRANSFORMATIONS_URL_DECODE_UNI_H_ diff --git a/src/actions/transformations/url_encode.cc b/src/actions/transformations/url_encode.cc new file mode 100644 index 00000000..baf8eeb5 --- /dev/null +++ b/src/actions/transformations/url_encode.cc @@ -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. + * + */ + +#include "actions/transformations/url_encode.h" + +#include +#include +#include +#include +#include +#include + +#include "modsecurity/assay.h" +#include "actions/transformations/transformation.h" + + +namespace ModSecurity { +namespace actions { +namespace transformations { + +UrlEncode::UrlEncode(std::string action) + : Transformation(action) { + this->action_kind = 1; +} + +std::string& UrlEncode::evaluate(std::string value, + Assay *assay) { + /** + * @todo Implement the transformation UrlEncode + */ + assay->debug(4, "Transformation UrlEncode is not implemented yet."); + return value; +} + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity diff --git a/src/actions/transformations/url_encode.h b/src/actions/transformations/url_encode.h new file mode 100644 index 00000000..e0a64d2f --- /dev/null +++ b/src/actions/transformations/url_encode.h @@ -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 + +#include "actions/action.h" +#include "actions/transformations/transformation.h" + +#ifndef SRC_ACTIONS_TRANSFORMATIONS_URL_ENCODE_H_ +#define SRC_ACTIONS_TRANSFORMATIONS_URL_ENCODE_H_ + +#ifdef __cplusplus +namespace ModSecurity { +class Assay; + +namespace actions { +namespace transformations { + +class UrlEncode : public Transformation { + public: + explicit UrlEncode(std::string action); + std::string& evaluate(std::string exp, + Assay *assay) override; +}; + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity + +#endif + +#endif // SRC_ACTIONS_TRANSFORMATIONS_URL_ENCODE_H_ diff --git a/src/actions/transformations/utf8_to_unicode.cc b/src/actions/transformations/utf8_to_unicode.cc new file mode 100644 index 00000000..0cb759e3 --- /dev/null +++ b/src/actions/transformations/utf8_to_unicode.cc @@ -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. + * + */ + +#include "actions/transformations/utf8_to_unicode.h" + +#include +#include +#include +#include +#include +#include + +#include "modsecurity/assay.h" +#include "actions/transformations/transformation.h" + + +namespace ModSecurity { +namespace actions { +namespace transformations { + +Utf8Unicode::Utf8Unicode(std::string action) + : Transformation(action) { + this->action_kind = 1; +} + +std::string& Utf8Unicode::evaluate(std::string value, + Assay *assay) { + /** + * @todo Implement the transformation Utf8Unicode + */ + assay->debug(4, "Transformation Utf8Unicode is not implemented yet."); + return value; +} + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity diff --git a/src/actions/transformations/utf8_to_unicode.h b/src/actions/transformations/utf8_to_unicode.h new file mode 100644 index 00000000..a6904503 --- /dev/null +++ b/src/actions/transformations/utf8_to_unicode.h @@ -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 + +#include "actions/action.h" +#include "actions/transformations/transformation.h" + +#ifndef SRC_ACTIONS_TRANSFORMATIONS_UTF8_UNICODE_H_ +#define SRC_ACTIONS_TRANSFORMATIONS_UTF8_UNICODE_H_ + +#ifdef __cplusplus +namespace ModSecurity { +class Assay; + +namespace actions { +namespace transformations { + +class Utf8Unicode : public Transformation { + public: + explicit Utf8Unicode(std::string action); + std::string& evaluate(std::string exp, + Assay *assay) override; +}; + +} // namespace transformations +} // namespace actions +} // namespace ModSecurity + +#endif + +#endif // SRC_ACTIONS_TRANSFORMATIONS_UTF8_UNICODE_H_