From: Russ Combs Date: Mon, 4 Aug 2014 04:04:53 +0000 (-0400) Subject: updated help X-Git-Tag: 3.0.0-233~1430^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d394229fe7646e12b81acaecb4d45084c95e4bed;p=thirdparty%2Fsnort3.git updated help --- diff --git a/ChangeLog b/ChangeLog index e45a9162b..8f2f1912f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 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 diff --git a/src/framework/module.h b/src/framework/module.h index 5ada9b2fe..9b2a7bf9c 100644 --- a/src/framework/module.h +++ b/src/framework/module.h @@ -54,6 +54,7 @@ struct RuleMap struct ProfileStats; +// FIXIT add brief help string to modules class Module { public: diff --git a/src/framework/parameter.h b/src/framework/parameter.h index f80867855..2aba31a7f 100644 --- a/src/framework/parameter.h +++ b/src/framework/parameter.h @@ -50,7 +50,7 @@ struct Parameter 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; diff --git a/src/loggers/alert_full.cc b/src/loggers/alert_full.cc index 30cdf083e..ba9ed71de 100644 --- a/src/loggers/alert_full.cc +++ b/src/loggers/alert_full.cc @@ -77,7 +77,7 @@ static const Parameter full_params[] = "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 } }; diff --git a/src/managers/module_manager.cc b/src/managers/module_manager.cc index d428693b5..ebd43a3ab 100644 --- a/src/managers/module_manager.cc +++ b/src/managers/module_manager.cc @@ -483,30 +483,21 @@ void ModuleManager::dump_modules() 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 ) diff --git a/src/managers/plugin_manager.cc b/src/managers/plugin_manager.cc index cfcd9457e..c3a9187ad 100644 --- a/src/managers/plugin_manager.cc +++ b/src/managers/plugin_manager.cc @@ -81,16 +81,24 @@ struct Symbol 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; diff --git a/src/managers/plugin_manager.h b/src/managers/plugin_manager.h index e65852e0c..73d573b4c 100644 --- a/src/managers/plugin_manager.h +++ b/src/managers/plugin_manager.h @@ -51,6 +51,7 @@ public: 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 diff --git a/src/network_inspectors/arp_spoof/arp_module.cc b/src/network_inspectors/arp_spoof/arp_module.cc index f7ece3f95..49c5fe7f8 100644 --- a/src/network_inspectors/arp_spoof/arp_module.cc +++ b/src/network_inspectors/arp_spoof/arp_module.cc @@ -51,11 +51,8 @@ static const Parameter arp_spoof_hosts_params[] = 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 } }; @@ -85,8 +82,6 @@ ArpSpoofModule::ArpSpoofModule() : Module(mod_name, arp_spoof_params) { config = new ArpSpoofConfig; - - config->check_unicast_arp = false; config->check_overwrite = false; } @@ -104,10 +99,7 @@ ProfileStats* ArpSpoofModule::get_profile() const 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") ) diff --git a/src/network_inspectors/arp_spoof/arp_module.h b/src/network_inspectors/arp_spoof/arp_module.h index 7390bcef7..1a0c8bb2e 100644 --- a/src/network_inspectors/arp_spoof/arp_module.h +++ b/src/network_inspectors/arp_spoof/arp_module.h @@ -49,7 +49,6 @@ typedef std::vector IPMacEntryList; struct ArpSpoofConfig { - bool check_unicast_arp; bool check_overwrite; IPMacEntryList ipmel; diff --git a/src/network_inspectors/arp_spoof/arp_spoof.cc b/src/network_inspectors/arp_spoof/arp_spoof.cc index 1c9d9ee7f..e71955286 100644 --- a/src/network_inspectors/arp_spoof/arp_spoof.cc +++ b/src/network_inspectors/arp_spoof/arp_spoof.cc @@ -199,16 +199,13 @@ void ArpSpoof::eval(Packet *p) 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) diff --git a/src/parser/cmd_line.cc b/src/parser/cmd_line.cc index df6a00ab2..370aca133 100644 --- a/src/parser/cmd_line.cc +++ b/src/parser/cmd_line.cc @@ -75,13 +75,13 @@ static const char* snort_help = "Snort has several options to get more help:\n" "\n" "--help this overview of help\n" -"--help-builtin output matching builtin rules\n" +"--help-builtin [] output matching builtin rules\n" "--help-buffers output available inspection buffers\n" -"--help-commands output matching commands\n" -"--help-config output matching config options\n" -"--help-gids output matching generators\n" -"--help-module output description of given module\n" -"--help-options