109
-- changed --help to give overview of help
-- fixed stream_ip alerts (defrag -> stream_ip)
+-- added missing help to parameters
108
-- added IpsAction for ips rule action plugins
struct ProfileStats;
+// FIXIT add brief help string to modules
class Module
{
public:
const char* name;
Type type;
const void* range; // nullptr|const char*|const Parameter*
- const char* deflt;
+ const char* deflt; // FIXIT add defaults for tables and lists
const char* help;
const char* get_type() const;
"set limit (0 is unlimited)" },
{ "units", Parameter::PT_ENUM, "B | K | M | G", "B",
- "help" },
+ "limit is in bytes | KB | MB | GB" },
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
d.dump(p->mod->get_name());
}
-static const char* mod_types[PT_MAX] =
-{
- "data",
- "codec",
- "logger",
- "ips option",
- "so rule",
- "inspector",
- "search engine"
-};
-
static const char* mod_type(const BaseApi* api)
{
if ( !api )
return "basic";
- if ( api->type > PT_MAX )
- return "error";
-
- return mod_types[api->type];
+ return PluginManager::get_type_name(api->type);
}
void ModuleManager::show_module(const char* name)
{
+ if ( !name || !*name )
+ {
+ cerr << "module name required" << endl;
+ return;
+ }
s_modules.sort(comp_gids);
for ( auto p : s_modules )
static Symbol symbols[PT_MAX] =
{
// sequence must match PlugType definition
- { "module", 0 },
+ { "data", 0 },
{ "codec", CDAPI_VERSION },
{ "inspector", INSAPI_VERSION },
{ "ips_action", ACTAPI_VERSION },
{ "ips_option", IPSAPI_VERSION },
{ "search_engine", SEAPI_VERSION },
{ "so_rule", SOAPI_VERSION },
- { "event_handler", LOGAPI_VERSION }
+ { "logger", LOGAPI_VERSION }
};
-
+
+const char* PluginManager::get_type_name(PlugType pt)
+{
+ if ( pt >= PT_MAX )
+ return "error";
+
+ return symbols[pt].name;
+}
+
struct Plugin
{
string key;
static void release_plugins();
static const BaseApi* get_api(PlugType, const char* name);
static void instantiate(const BaseApi*, Module*, SnortConfig*);
+ static const char* get_type_name(PlugType);
};
#endif
static const Parameter arp_spoof_params[] =
{
- { "unicast", Parameter::PT_BOOL, nullptr, "false",
- "help" },
-
{ "hosts", Parameter::PT_LIST, arp_spoof_hosts_params, nullptr,
- "help" },
+ "configure ARP cache overwrite attacks" },
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
Module(mod_name, arp_spoof_params)
{
config = new ArpSpoofConfig;
-
- config->check_unicast_arp = false;
config->check_overwrite = false;
}
bool ArpSpoofModule::set(const char*, Value& v, SnortConfig*)
{
- if ( v.is("unicast") )
- config->check_unicast_arp = v.get_bool();
-
- else if ( v.is("ip") )
+ if ( v.is("ip") )
host.ipv4_addr = v.get_ip4();
else if ( v.is("mac") )
struct ArpSpoofConfig
{
- bool check_unicast_arp;
bool check_overwrite;
IPMacEntryList ipmel;
switch(ntohs(ah->ea_hdr.ar_op))
{
case ARPOP_REQUEST:
- if (config->check_unicast_arp)
+ if (memcmp((u_char *)eh->ether_dst, (u_char *)bcast, 6) != 0)
{
- if (memcmp((u_char *)eh->ether_dst, (u_char *)bcast, 6) != 0)
- {
- SnortEventqAdd(GID_ARP_SPOOF,
- ARPSPOOF_UNICAST_ARP_REQUEST);
-
- DEBUG_WRAP(DebugMessage(DEBUG_PLUGIN,
- "MODNAME: Unicast request\n"););
- }
+ SnortEventqAdd(GID_ARP_SPOOF,
+ ARPSPOOF_UNICAST_ARP_REQUEST);
+
+ DEBUG_WRAP(DebugMessage(DEBUG_PLUGIN,
+ "MODNAME: Unicast request\n"););
}
else if (memcmp((u_char *)eh->ether_src,
(u_char *)ah->arp_sha, 6) != 0)
"Snort has several options to get more help:\n"
"\n"
"--help this overview of help\n"
-"--help-builtin <module prefix> output matching builtin rules\n"
+"--help-builtin [<module prefix>] output matching builtin rules\n"
"--help-buffers output available inspection buffers\n"
-"--help-commands <module prefix> output matching commands\n"
-"--help-config <module prefix> output matching config options\n"
-"--help-gids <module prefix> output matching generators\n"
-"--help-module output description of given module\n"
-"--help-options <option prefix> output matching command line option quick help\n"
+"--help-commands [<module prefix>] output matching commands\n"
+"--help-config [<module prefix>] output matching config options\n"
+"--help-gids [<module prefix>] output matching generators\n"
+"--help-module <module> output description of given module\n"
+"--help-options [<option prefix>] output matching command line options\n"
"--help-signals dump available control signals\n"
"--list-modules list all known modules\n"
"--list-plugins list all known modules\n"
"output available inspection buffers" },
{ "help-commands", help_commands,
- "<module prefix> output matching commands" },
+ "[<module prefix>] output matching commands" },
{ "help-config", help_config,
- "<module prefix> output matching config options" },
+ "[<module prefix>] output matching config options" },
{ "help-gids", help_gids,
- "<module prefix> output matching generators" },
+ "[<module prefix>] output matching generators" },
{ "help-module", help_module,
- "output description of given module" },
+ "<module> output description of given module" },
{ "help-options", help_options,
"<option prefix> output matching command line option quick help" },
break;
}
}
+ return -1;
}
int get_inner_ip_lyr(const Packet* const p)
{
normalize = check_encrypted_data = 0;
ayt_threshold = FTPP_UI_CONFIG_TELNET_DEF_AYT_THRESHOLD;
-
detect_encrypted = 0;
- detect_anomalies = 0;
}
/*
bool normalize;
bool check_encrypted_data;
bool detect_encrypted;
- bool detect_anomalies;
TELNET_PROTO_CONF();
};
LogMessage(" Are You There Threshold: %d\n",
TelnetConf->ayt_threshold);
LogMessage(" Normalize: %s\n", TelnetConf->normalize ? "YES" : "NO");
- LogMessage(" Detect Anomalies: %s\n",
- TelnetConf->detect_anomalies ? "YES" : "NO");
PrintConfOpt(TelnetConf->detect_encrypted, "Check for Encrypted Traffic");
LogMessage(" Continue to check encrypted data: %s\n",
TelnetConf->check_encrypted_data ? "YES" : "NO");
{ "check_encrypted", Parameter::PT_BOOL, nullptr, "false",
"check for end of encryption" },
- { "detect_anomalies", Parameter::PT_BOOL, nullptr, "false",
- "help" },
-
{ "encrypted_traffic", Parameter::PT_BOOL, nullptr, "false",
"check for encrypted telnet and ftp" },
else if ( v.is("check_encrypted") )
conf->detect_encrypted = v.get_bool();
- else if ( v.is("detect_anomalies") )
- conf->detect_anomalies = v.get_bool();
-
else if ( v.is("encrypted_traffic") )
conf->check_encrypted_data = v.get_bool();
static const Parameter hi_umap_params[] =
{
{ "code_page", Parameter::PT_INT, "0:", "1252",
- "help" },
+ "select code page in map file" },
{ "map_file", Parameter::PT_STRING, nullptr, nullptr,
- "help" },
+ "unicode map file" },
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
"maximum amount of packet payload to decompress" },
{ "decode", Parameter::PT_TABLE, hi_decode_params, nullptr,
- "help" },
+ "decode parameters" },
{ "decompress_depth", Parameter::PT_INT, "1:65535", "2920",
"maximum amount of decompressed data to process" },
"alert on proxy usage for servers without allow_proxy_use" },
{ "unicode_map", Parameter::PT_TABLE, hi_umap_params, nullptr,
- "help" },
+ "default unicode map configuration" },
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
"log True-Client-IP and X-Forwarded-For headers with unified2 alerts as extra data" },
{ "extended_ascii_uri", Parameter::PT_BOOL, nullptr, "false",
- "help" },
+ "allow extended ASCII codes in the request URI" },
{ "extended_response_inspection", Parameter::PT_BOOL, nullptr, "false",
"extract resonse headers" },
"enable unicode code point mapping using unicode_map settings" },
{ "iis_unicode_map", Parameter::PT_TABLE, hi_umap_params, nullptr,
- "help" },
+ "server unicode map configuration" },
{ "inspect_gzip", Parameter::PT_BOOL, nullptr, "false",
"enable gzip decompression of compressed bodies" },
"maximum allowd client request headers" },
{ "max_spaces", Parameter::PT_INT, "0:65535", "200",
- "help" },
+ "maximum allowed whitespaces when folding" },
{ "multi_slash", Parameter::PT_BOOL, nullptr, "true",
"normalize out consecutive slashes in URI" },
"allows HTTP 0.9 processing" },
{ "normalize_cookies", Parameter::PT_BOOL, nullptr, "false",
- "help" },
+ "normalize cookies similar to URI" },
{ "normalize_headers", Parameter::PT_BOOL, nullptr, "false",
- "help" },
+ "normalize headers other than cookie similar to URI" },
{ "normalize_javascript", Parameter::PT_BOOL, nullptr, "false",
"normalize javascript between <script> tags" },
"maximum number of consecutive whitespaces" },
{ "normalize_utf", Parameter::PT_BOOL, nullptr, "false",
- "help" },
+ "normalize response bodies with UTF content-types" },
{ "oversize_dir_length", Parameter::PT_INT, "0:", "0",
"alert if a URL has a directory longer than this limit" },
"alert if more than small_chunk_count consecutive chunks below this limit" },
{ "tab_uri_delimiter", Parameter::PT_BOOL, nullptr, "false",
- "help" },
+ "whether a tab not preceded by a space is considered a delimiter or part of URI" },
{ "u_encode", Parameter::PT_BOOL, nullptr, "false",
"decode %uXXXX character sequences" },
-// { "unicode_map", Parameter::PT_TABLE, hi_umap_params, nullptr,
-// "help" },
-
{ "unlimited_decompress", Parameter::PT_BOOL, nullptr, "false",
"decompress across multiple packets" },
"alert on directory traversals past the top level (web server root)" },
{ "whitespace_chars", Parameter::PT_BIT_LIST, "255", "false",
- "help" },
+ "allowed white space characters" },
{ nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
};
if (rcv->small_seg_count > config->max_consec_small_segs)
{
- /* Above threshold, log it... requires detect_anomalies be
- * on in this TCP policy, action controlled by preprocessor
- * rule. */
+ /* Above threshold, log it... in this TCP policy,
+ * action controlled by preprocessor rule. */
EventMaxSmallSegsExceeded();
/* Reset counter, so we're not too noisy */
#include <iostream>
#include <string>
#include <cstring>
+#include <sstream>
#include "utils/snort2lua_util.h"
#include "conversion_state.h"
#include "data/dt_data.h"
}
return str_len;
}
-
-bool inline get_string_helper(std::istringstream& stream,
- std::string& option,
- const std::string& delimeters)
+
+bool get_string(std::istringstream& stream,
+ std::string& option,
+ const std::string delimeters)
{
if (delimeters.empty() || !stream.good())
{
}
}
-
-bool get_string(std::istringstream& stream,
- std::string& option,
- const std::string delimeters)
-{ return get_string_helper(stream, option, delimeters); }
-
std::string get_rule_option_args(std::istringstream& stream)
{
std::string args = std::string();