)
target_link_libraries( snort2lua
- converrsion_data
+ conversion_data
keyword_states
output_states
preprocessor_states
protected:
Converter* converter;
- inline bool add_int_option(std::string keyword, std::stringstream& stream)
+ inline bool parse_int_option(std::string opt_name, std::stringstream& stream)
{
int val;
if(stream >> val)
{
- converter->add_option_to_table(keyword, val);
+ converter->add_option_to_table(opt_name, val);
return true;
}
- converter->add_comment_to_table("snort.conf missing argument for: " + keyword + " <int>");
+ converter->add_comment_to_table("snort.conf missing argument for: " + opt_name + " <int>");
+ return false;
+ }
+
+ // parse adn add a curly bracketed list to the table
+ inline bool parse_curly_bracket_list(std::string list_name, std::stringstream& stream)
+ {
+ std::string elem;
+ bool retval = true;
+
+ if(!(stream >> elem) || (elem != "{"))
+ return false;
+
+ while (stream >> elem && elem != "}")
+ retval = converter->add_list_to_table(list_name, elem) && retval;
+
+ return retval;
+ }
+
+ // parse and add a yes/no boolean option.
+ inline bool parse_yn_bool_option(std::string opt_name, std::stringstream& stream)
+ {
+ std::string val;
+
+ if(!(stream >> val))
+ return false;
+
+ else if(!val.compare("yes"))
+ return converter->add_option_to_table(opt_name, true);
+
+ else if (!val.compare("no"))
+ return converter->add_option_to_table(opt_name, false);
+
+ converter->add_comment_to_table("Unable to convert_option: " + opt_name + ' ' + val);
return false;
}
-add_library(converrsion_data
+add_library(conversion_data
cv_data.h
cv_data.cc
cv_var.h
// cv_var.cc author Josh Rosenbaum <jorosenba@cisco.com>
#include "data/cv_var.h"
-
+#include "snort2lua_util.h"
#if 0
static inline bool var_exists(std::vector<std::string> vec, std::string name)
out << std::endl << whitespace << " ";
length += v.size();
- out << " " << v << " ..";
+ out << v << " .. ";
}
if (var.strs.size() == 0)
- out << " ''";
+ out << "''";
+
+
else if(var.count < var.max_line_length || var.strs.size() == 1)
{
- out << "'";
+ std::string tmp_str = "";
for (auto s : var.strs)
{
if ( 0 < length && length + s.size() > var.max_line_length )
- out << std::endl << whitespace << " ";
+ tmp_str += "\n" + whitespace + " ";
length += s.size();
- out << " " << s;
+ tmp_str += s + ' ';
}
- out << "'";
+ util::trim(tmp_str);
+ out << "'" << tmp_str << "'";
}
else
{
- out << std::endl << whitespace << "[[" << std::endl;
- out << whitespace << " ";
length = 4 + whitespace.size();
+ std::string tmp_str = "";
for (auto s : var.strs)
{
if ( 0 < length && length + s.size() > var.max_line_length )
{
- out << std::endl << whitespace << " ";
+ tmp_str += "\n" + whitespace + " ";
length = 4 + whitespace.size();
}
length += s.size();
- out << " " << s;
+ tmp_str += s + " ";
}
- out << std::endl << whitespace << "]]";
+ util::trim(tmp_str);
+ out << std::endl << whitespace << "[[" << std::endl;
+ out << whitespace << " " << tmp_str << std::endl;
+ out << whitespace << "]]";
}
return out;
#include <sstream>
#include <vector>
-#include <iomanip>
#include "conversion_state.h"
#include "converter.h"
#include <sstream>
#include <vector>
-#include <iomanip>
#include "conversion_state.h"
#include "converter.h"
#include <sstream>
#include <vector>
-#include <iomanip>
#include "conversion_state.h"
#include "converter.h"
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-// suppress.cc author Josh Rosenbaum <jorosenba@cisco.com>
+// kws_suppress.cc author Josh Rosenbaum <jorosenba@cisco.com>
#include <sstream>
#include <vector>
-#include <iomanip>
#include "conversion_state.h"
#include "converter.h"
#include <sstream>
#include <vector>
-#include <iomanip>
#include "conversion_state.h"
#include "converter.h"
pps_normalizers.cc
pps_sfportscan.cc
pps_ftp_telnet.cc
+ pps_ftp_telnet_protocol.cc
+ pps_bo.cc
preprocessor_api.h
preprocessor_api.cc
)
+
--- /dev/null
+/*
+** Copyright (C) 2014 Cisco and/or its affiliates. All rights reserved.
+ * Copyright (C) 2002-2013 Sourcefire, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation. You may not use, modify or
+ * distribute this program under any other version of the GNU General
+ * Public License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+// pps_bo.cc author Josh Rosenbaum <jorosenba@cisco.com>
+
+#include <sstream>
+#include <vector>
+#include <iomanip>
+
+#include "conversion_state.h"
+#include "converter.h"
+#include "snort2lua_util.h"
+
+
+
+static ConversionState* bo_ctor(Converter* cv)
+{
+ cv->open_table("bo");
+ cv->close_table();
+ return nullptr;
+}
+
+static const ConvertMap preprocessor_bo =
+{
+ "bo",
+ bo_ctor,
+};
+
+const ConvertMap* bo_map = &preprocessor_bo;
+
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-// config.cc author Josh Rosenbaum <jorosenba@cisco.com>
+// pps_ftp_telnet.cc author Josh Rosenbaum <jorosenba@cisco.com>
#include <sstream>
#include <vector>
-#include <iomanip>
#include "conversion_state.h"
#include "converter.h"
FtpTelnet(Converter* cv) : ConversionState(cv) {};
virtual ~FtpTelnet() {};
virtual bool convert(std::stringstream& data_stream);
+private:
+ bool add_ftp_n_telnet_option(std::string opt_name, bool val);
+ void add_ftp_n_telnet_deprecated(std::string opt_name);
};
} // namespace
+bool FtpTelnet::add_ftp_n_telnet_option(std::string opt_name, bool val)
+{
+ bool retval;
+
+ converter->open_table("telnet");
+ retval = converter->add_option_to_table(opt_name, val);
+ converter->close_table();
+ converter->open_table("ftp_server");
+ retval = converter->add_option_to_table(opt_name, val) && retval;
+ converter->close_table();
+ return retval;
+}
+
+void FtpTelnet::add_ftp_n_telnet_deprecated(std::string opt_name)
+{
+ converter->open_table("telnet");
+ converter->add_deprecated_comment(opt_name);
+ converter->close_table();
+ converter->open_table("ftp_server");
+ converter->add_deprecated_comment(opt_name);
+ converter->close_table();
+}
bool FtpTelnet::convert(std::stringstream& data_stream)
{
-#if 0
-# FTP / Telnet normalization and anomaly detection. For more information, see README.ftptelnet
-preprocessor ftp_telnet: global inspection_type stateful encrypted_traffic no check_encrypted
-preprocessor ftp_telnet_protocol: telnet \
- ayt_attack_thresh 20 \
- normalize ports { 23 } \
- detect_anomalies
-preprocessor ftp_telnet_protocol: ftp server default \
- def_max_param_len 100 \
- ports { 21 2100 3535 } \
- telnet_cmds yes \
- ignore_telnet_erase_cmds yes \
- ftp_cmds { ABOR ACCT ADAT ALLO APPE AUTH CCC CDUP } \
- ftp_cmds { CEL CLNT CMD CONF CWD DELE ENC EPRT } \
- ftp_cmds { EPSV ESTA ESTP FEAT HELP LANG LIST LPRT } \
- ftp_cmds { LPSV MACB MAIL MDTM MIC MKD MLSD MLST } \
- ftp_cmds { MODE NLST NOOP OPTS PASS PASV PBSZ PORT } \
- ftp_cmds { PROT PWD QUIT REIN REST RETR RMD RNFR } \
- ftp_cmds { RNTO SDUP SITE SIZE SMNT STAT STOR STOU } \
- ftp_cmds { STRU SYST TEST TYPE USER XCUP XCRC XCWD } \
- ftp_cmds { XMAS XMD5 XMKD XPWD XRCP XRMD XRSQ XSEM } \
- ftp_cmds { XSEN XSHA1 XSHA256 } \
- alt_max_param_len 0 { ABOR CCC CDUP ESTA FEAT LPSV NOOP PASV PWD QUIT REIN STOU SYST XCUP XPWD } \
- alt_max_param_len 200 { ALLO APPE CMD HELP NLST RETR RNFR STOR STOU XMKD } \
- alt_max_param_len 256 { CWD RNTO } \
- alt_max_param_len 400 { PORT } \
- alt_max_param_len 512 { SIZE } \
- chk_str_fmt { ACCT ADAT ALLO APPE AUTH CEL CLNT CMD } \
- chk_str_fmt { CONF CWD DELE ENC EPRT EPSV ESTP HELP } \
- chk_str_fmt { LANG LIST LPRT MACB MAIL MDTM MIC MKD } \
- chk_str_fmt { MLSD MLST MODE NLST OPTS PASS PBSZ PORT } \
- chk_str_fmt { PROT REST RETR RMD RNFR RNTO SDUP SITE } \
- chk_str_fmt { SIZE SMNT STAT STOR STRU TEST TYPE USER } \
- chk_str_fmt { XCRC XCWD XMAS XMD5 XMKD XRCP XRMD XRSQ } \
- chk_str_fmt { XSEM XSEN XSHA1 XSHA256 } \
- cmd_validity ALLO < int [ char R int ] > \
- cmd_validity EPSV < [ { char 12 | char A char L char L } ] > \
- cmd_validity MACB < string > \
- cmd_validity MDTM < [ date nnnnnnnnnnnnnn[.n[n[n]]] ] string > \
- cmd_validity MODE < char ASBCZ > \
- cmd_validity PORT < host_port > \
- cmd_validity PROT < char CSEP > \
- cmd_validity STRU < char FRPO [ string ] > \
- cmd_validity TYPE < { char AE [ char NTC ] | char I | char L [ number ] } >
-preprocessor ftp_telnet_protocol: ftp client default \
- max_resp_len 256 \
- bounce yes \
- ignore_telnet_erase_cmds yes \
- telnet_cmds yes
-#endif
-
- data_stream.setstate(std::basic_ios<char>::eofbit);
- return true;
+
+ std::string keyword;
+ std::string s_value;
+
+ // using this to keep track of any errors. I want to convert as much
+ // as possible while being aware something went wrong
+ bool retval = true;
+
+ if(data_stream >> keyword)
+ {
+ if(keyword.compare("global"))
+ {
+ converter->log_error("preprocessor ftp_telnet: requires the 'global' keyword");
+ return false;
+ }
+ }
+
+ while(data_stream >> keyword)
+ {
+ if(!keyword.compare("check_encrypted"))
+ retval = add_ftp_n_telnet_option("check_encrypted", true);
+
+ else if(!keyword.compare("inspection_type"))
+ add_ftp_n_telnet_deprecated("inspection_type");
+
+ else if(!keyword.compare("encrypted_traffic"))
+ {
+ data_stream >> s_value;
+
+ if(s_value.compare("yes"))
+ retval = add_ftp_n_telnet_option("encrypted_traffic", true) && retval;
+
+ else
+ retval = add_ftp_n_telnet_option("encrypted_traffic", false) && retval;
+
+ }
+
+ else
+ retval = false;
+
+ }
+
+ return retval;
}
/**************************
return new FtpTelnet(cv);
}
-static const ConvertMap keyword_preprocessor =
+static const ConvertMap preprocessor_ftptelnet =
{
"ftp_telnet",
ctor,
};
-const ConvertMap* preprocessor_map = &keyword_preprocessor;
+const ConvertMap* ftptelnet_map = &preprocessor_ftptelnet;
--- /dev/null
+/*
+** Copyright (C) 2014 Cisco and/or its affiliates. All rights reserved.
+ * Copyright (C) 2002-2013 Sourcefire, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation. You may not use, modify or
+ * distribute this program under any other version of the GNU General
+ * Public License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+// pps_ftp_telnet_protocol.cc author Josh Rosenbaum <jorosenba@cisco.com>
+
+#include <sstream>
+#include <vector>
+
+#include "conversion_state.h"
+#include "converter.h"
+#include "snort2lua_util.h"
+
+namespace {
+
+class FtpServer : public ConversionState
+{
+public:
+ FtpServer(Converter* cv);
+ virtual ~FtpServer() {};
+ virtual bool convert(std::stringstream& data_stream);
+private:
+ bool parse_alt_max_cmd(std::stringstream& data_stream);
+ bool parse_cmd_validity_cmd(std::stringstream& data_stream);
+ static int ftpsever_binding_id;
+};
+
+class FtpClient : public ConversionState
+{
+public:
+ FtpClient(Converter* cv) : ConversionState(cv) {};
+ virtual ~FtpClient() {};
+ virtual bool convert(std::stringstream& data_stream);
+private:
+ static int ftpclient_binding_id;
+};
+
+class Telnet : public ConversionState
+{
+public:
+ Telnet(Converter* cv) : ConversionState(cv) {};
+ virtual ~Telnet() {};
+ virtual bool convert(std::stringstream& data_stream);
+};
+
+class FtpTelnetProtocol : public ConversionState
+{
+public:
+ FtpTelnetProtocol(Converter* cv) : ConversionState(cv) {};
+ virtual ~FtpTelnetProtocol() {};
+ virtual bool convert(std::stringstream& data_stream);
+};
+
+} // namespace
+
+
+/****************************************
+ ******* FtpServer Protocol ***********
+ ****************************************/
+
+int FtpServer::ftpsever_binding_id = 1;
+
+
+FtpServer::FtpServer(Converter* cv) : ConversionState(cv)
+{}
+
+bool FtpServer::parse_alt_max_cmd(std::stringstream& data_stream)
+{
+ int i_val;
+ bool tmpval;
+
+ if(!(data_stream >> i_val))
+ return false;
+
+ converter->open_table("alt_max_param");
+ converter->open_table();
+ converter->add_option_to_table("length", i_val);
+ tmpval = parse_curly_bracket_list("commands", data_stream);
+ converter->close_table();
+ converter->close_table();
+ return tmpval;
+}
+
+bool FtpServer::parse_cmd_validity_cmd(std::stringstream& data_stream)
+{
+ std::string val;
+ std::string elem;
+ bool tmpval;
+
+ if(!(data_stream >> val))
+ return false;
+
+ if(!(data_stream >> elem) || (elem != "<"))
+ return false;
+
+
+ converter->open_table("cmd_validity");
+ converter->open_table();
+ tmpval = converter->add_option_to_table("command", val);
+ tmpval = converter->add_list_to_table("format", elem) && tmpval;
+
+ while((data_stream >> elem) && (elem != ">"))
+ tmpval = converter->add_list_to_table("format", elem) && tmpval;
+
+ converter->add_list_to_table("format", elem);
+ converter->close_table(); // anonymouse table
+ converter->close_table(); // "cmd_validity" table
+ return tmpval;
+}
+
+bool FtpServer::convert(std::stringstream& data_stream)
+{
+ std::string keyword;
+ bool retval = true;
+
+ if (data_stream >> keyword)
+ {
+ if(!keyword.compare("default"))
+ converter->open_table("ftp_server");
+ else
+ {
+ converter->open_table("ftp_server_target_" + std::to_string(ftpsever_binding_id));
+ ftpsever_binding_id++;
+ converter->add_comment_to_table("Unable to create target based ftp configuration at this time!!!");
+ retval = false;
+ }
+ }
+ else
+ {
+ return false;
+ }
+
+ while(data_stream >> keyword)
+ {
+ bool tmpval = true;
+
+
+ if(!keyword.compare("print_cmds"))
+ converter->add_option_to_table("print_cmds", true);
+
+ else if(!keyword.compare("def_max_param_len"))
+ tmpval = parse_int_option("def_max_param_len", data_stream);
+
+ else if(!keyword.compare("telnet_cmds"))
+ tmpval = parse_yn_bool_option("telnet_cmds", data_stream);
+
+ else if(!keyword.compare("ignore_telnet_erase_cmds"))
+ tmpval = parse_yn_bool_option("ignore_telnet_erase_cmds", data_stream);
+
+ else if(!keyword.compare("ignore_data_chan"))
+ tmpval = parse_yn_bool_option("ignore_data_chan", data_stream);
+
+ else if(!keyword.compare("ftp_cmds"))
+ tmpval = parse_curly_bracket_list("ftp_cmds", data_stream);
+
+ else if(!keyword.compare("chk_str_fmt"))
+ tmpval = parse_curly_bracket_list("chk_str_fmt", data_stream);
+
+ else if(!keyword.compare("alt_max_param_len"))
+ tmpval = parse_alt_max_cmd(data_stream);
+
+ else if(!keyword.compare("cmd_validity"))
+ tmpval = parse_cmd_validity_cmd(data_stream);
+
+ else if(!keyword.compare("data_chan"))
+ {
+ converter->add_deprecated_comment("data_chan", "ignore_data_chan");
+ tmpval = converter->add_option_to_table("ignore_data_chan", true);
+ }
+
+ else if (!keyword.compare("ports"))
+ {
+ converter->add_deprecated_comment("ports", "bindings");
+ converter->add_comment_to_table("check bindings table for port information");
+ // add commented list for now
+ std::string tmp = "";
+ while (data_stream >> keyword && keyword != "}")
+ tmp += " " + keyword;
+ tmpval = converter->add_option_to_table("--ports", tmp + "}");
+ }
+
+ else
+ {
+ tmpval = false;
+ }
+
+ retval = retval && tmpval;
+ }
+ return retval;
+}
+
+/****************************************
+ ******* FtpClient Protocol ***********
+ ****************************************/
+
+int FtpClient::ftpclient_binding_id = 1;
+
+bool FtpClient::convert(std::stringstream& data_stream)
+{
+ std::string keyword;
+ bool retval = true;
+
+ if (data_stream >> keyword)
+ {
+ if(!keyword.compare("default"))
+ converter->open_table("ftp_client");
+ else
+ {
+ converter->open_table("ftp_client_target_" + std::to_string(ftpclient_binding_id));
+ ftpclient_binding_id++;
+ converter->add_comment_to_table("Unable to create target based ftp configuration at this time!!!");
+ retval = false;
+ }
+ }
+ else
+ {
+ return false;
+ }
+
+ while(data_stream >> keyword)
+ {
+ bool tmpval = true;
+
+
+ if(!keyword.compare("telnet_cmds"))
+ tmpval = parse_yn_bool_option("telnet_cmds", data_stream);
+
+ else if(!keyword.compare("ignore_telnet_erase_cmds"))
+ tmpval = parse_yn_bool_option("ignore_telnet_erase_cmds", data_stream);
+
+ else if(!keyword.compare("max_resp_len"))
+ tmpval = parse_int_option("max_resp_len", data_stream);
+
+ else if(!keyword.compare("bounce"))
+ tmpval = parse_yn_bool_option("bounce", data_stream);
+
+ // add bounce_to as a commented list
+ else if(!keyword.compare("bounce_to"))
+ {
+ std::string tmp = "";
+ while (data_stream >> keyword && keyword != "}")
+ tmp += " " + keyword;
+ tmpval = converter->add_option_to_table("--bounce_to", tmp + "}");
+ }
+
+ else
+ {
+ tmpval = false;
+ }
+
+ retval = retval && tmpval;
+ }
+
+
+ return retval;
+}
+
+/****************************************
+ ********* Telnet Protocol ************
+ ****************************************/
+
+bool Telnet::convert(std::stringstream& data_stream)
+{
+ std::string keyword;
+ int i_val;
+ bool retval = true;
+
+ converter->open_table("telnet");
+
+ while(data_stream >> keyword)
+ {
+ bool tmpval;
+ if(!keyword.compare("ayt_attack_thresh"))
+ {
+ if(data_stream >> i_val)
+ tmpval = converter->add_option_to_table("ayt_attack_thresh", i_val);
+ else
+ tmpval = false;
+ }
+
+ else if(!keyword.compare("normalize"))
+ tmpval = converter->add_option_to_table("normalize", true);
+
+ else if(!keyword.compare("ports"))
+ {
+ converter->add_deprecated_comment("ports", "bindings");
+ converter->add_comment_to_table("check bindings table for port information");
+ // vvvv defined in ConversionState vvvv
+ parse_curly_bracket_list("--ports", data_stream); // create a commented list of the ports
+ }
+
+ else if(!keyword.compare("detect_anomalies"))
+ tmpval = converter->add_option_to_table("detect_anomalies", true);
+
+ else
+ tmpval = false;
+
+ retval = tmpval && retval;
+ }
+
+
+ converter->close_table(); // not necessary but
+ return retval;
+}
+
+/****************************************
+ ******* FtpTelnetProtocol ************
+ ****************************************/
+
+
+bool FtpTelnetProtocol::convert(std::stringstream& data_stream)
+{
+ std::string protocol;
+
+ if(data_stream >> protocol)
+ {
+ if(!protocol.compare("telnet"))
+ {
+ converter->set_state(new Telnet(converter));
+ }
+ else if (!protocol.compare("ftp"))
+ {
+ if(data_stream >> protocol)
+ {
+ if(!protocol.compare("client"))
+ converter->set_state(new FtpClient(converter));
+
+ else if (!protocol.compare("server"))
+ converter->set_state(new FtpServer(converter));
+
+ else
+ return false;
+ }
+ }
+ else
+ return false;
+
+ return true;
+ }
+
+ return false;
+}
+
+/******* PUBLIC API ************/
+
+static ConversionState* ctor(Converter* cv)
+{
+ return new FtpTelnetProtocol(cv);
+}
+
+static const ConvertMap ftptelnet_protocol_preprocessor =
+{
+ "ftp_telnet_protocol",
+ ctor,
+};
+
+const ConvertMap* ftptelnet_protocol_map = &ftptelnet_protocol_preprocessor;
while(data_stream >> keyword)
{
if(!keyword.compare("compress_depth"))
- retval = add_int_option("compress_depth", data_stream) && retval;
+ retval = parse_int_option("compress_depth", data_stream) && retval;
else if(!keyword.compare("decompress_depth"))
- retval = add_int_option("decompress_depth", data_stream) && retval;
+ retval = parse_int_option("decompress_depth", data_stream) && retval;
else if(!keyword.compare("detect_anomalous_servers"))
converter->add_option_to_table("detect_anomalous_servers", true);
converter->add_option_to_table("proxy_alert", true);
else if(!keyword.compare("max_gzip_mem"))
- retval = add_int_option("max_gzip_mem", data_stream) && retval;
+ retval = parse_int_option("max_gzip_mem", data_stream) && retval;
else if(!keyword.compare("memcap"))
- retval = add_int_option("memcap", data_stream) && retval;
+ retval = parse_int_option("memcap", data_stream) && retval;
else if(!keyword.compare("disabled"))
converter->add_comment_to_table("'disabled' is deprecated");
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-// config.cc author Josh Rosenbaum <jorosenba@cisco.com>
+// pps_http_inspect_server.cc author Josh Rosenbaum <jorosenba@cisco.com>
#include <sstream>
#include <vector>
-#include <iomanip>
#include "conversion_state.h"
#include "converter.h"
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-// portscan.cc author Josh Rosenbaum <jorosenba@cisco.com>
+// pps_sfportscan.cc author Josh Rosenbaum <jorosenba@cisco.com>
#include <sstream>
#include <vector>
-#include <iomanip>
#include "conversion_state.h"
#include "converter.h"
if(!keyword.compare("proto"))
{
converter->add_deprecated_comment("proto", "protos");
- retval = parse_list("protos", data_stream) && retval;
+ // defined in ConversionState vvvv
+ retval = parse_curly_bracket_list("protos", data_stream) && retval;
}
if(!keyword.compare("scan_type"))
{
converter->add_deprecated_comment("scan_type", "scan_types");
- retval = parse_list("scan_types", data_stream) && retval;
+ // defined in ConversionState vvvv
+ retval = parse_curly_bracket_list("scan_types", data_stream) && retval;
}
else if(!keyword.compare("sense_level"))
retval = parse_option("sense_level", data_stream) && retval;
extern const ConvertMap *arpspoof_map;
extern const ConvertMap *arpspoof_host_map;
+extern const ConvertMap *bo_map;
+extern const ConvertMap *ftptelnet_map;
+extern const ConvertMap *ftptelnet_protocol_map;
extern const ConvertMap *httpinspect_map;
extern const ConvertMap *normalizer_icmp4_map;
extern const ConvertMap *normalizer_icmp6_map;
{
arpspoof_map,
arpspoof_host_map,
+ bo_map,
+ ftptelnet_map,
httpinspect_map,
+ ftptelnet_protocol_map,
normalizer_icmp4_map,
normalizer_icmp6_map,
normalizer_ip4_map,
static void show_usage()
{
- std::cout << "usage: snort2lua <input_conf_file> <output_lua_file" << std::endl;
+ std::cout << "usage: snort2lua <input_conf_file> <output_lua_file>" << std::endl;
}
int main (int argc, char* argv[])
{
-// trim from start
-std::string <rim(std::string &s) {
- s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
- return s;
-}
-
-// trim from end
-std::string &rtrim(std::string &s) {
- s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end());
- return s;
-}
-
-// trim from both ends
-std::string &trim(std::string &s) {
- return ltrim(rtrim(s));
-}
std::vector<std::string> &split(const std::string &s,
#include <string>
#include <vector>
+#include <algorithm>
+#include <functional>
+#include <cctype>
+#include <locale>
struct ConvertMap;
std::string &rtrim(std::string &s);
// trim from both ends
std::string &trim(std::string &s);
+
+
+// trim from start
+inline std::string <rim(std::string &s) {
+ s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
+ return s;
+}
+
+// trim from end
+inline std::string &rtrim(std::string &s) {
+ s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end());
+ return s;
+}
+
+// trim from both ends
+inline std::string &trim(std::string &s) {
+ return ltrim(rtrim(s));
+}
+
} // namespace util
#endif
#include <sstream>
#include <vector>
-#include <iomanip>
#include "conversion_state.h"
#include "converter.h"