std::size_t RuleApi::error_count = 0;
std::string RuleApi::remark;
-std::set<GidSid> RuleApi::address_anomaly_rules = {
- {"116", "403"},
- {"116", "411"},
- {"116", "412"},
- {"129", "9"},
- {"129", "10"},
- };
-
-RuleApi::RuleApi()
- : curr_rule(nullptr),
+std::set<GidSid> RuleApi::address_anomaly_rules =
+{
+ {"116", "403"},
+ {"116", "411"},
+ {"116", "412"},
+ {"129", "9"},
+ {"129", "10"},
+};
+
+RuleApi::RuleApi() :
+ curr_rule(nullptr),
curr_data_bad(false)
{
bad_rules = new Comments(start_bad_rules, 0,
bool RuleApi::enable_addr_anomaly_detection()
{
if (curr_rule != nullptr)
- return address_anomaly_rules.count({curr_rule->get_option("gid"),
- curr_rule->get_option("sid")}) != 0;
-
+ {
+ return address_anomaly_rules.count(
+ { curr_rule->get_option("gid"), curr_rule->get_option("sid") }) != 0;
+ }
return false;
}
public:
Gid(Converter& c) : ConversionState(c) { }
bool convert(std::istringstream& data_stream) override;
+
+private:
+ static bool rem_146;
};
class Sid : public ConversionState
// Gid
//
+bool Gid::rem_146 = false;
+
bool Gid::convert(std::istringstream& data_stream)
{
std::string gid = util::get_rule_option_args(data_stream);
-
const std::string old_http_gid("120");
- if (gid.compare(old_http_gid) == 0)
+ const std::string file_id = "146";
+
+ if ( gid == file_id )
+ {
+ if ( !rem_146 )
+ {
+ rule_api.add_comment("deleted all gid:" + file_id + " rules");
+ rem_146 = true;
+ }
+ rule_api.make_rule_a_comment();
+ }
+ else if (gid.compare(old_http_gid) == 0)
{
const std::string nhi_gid("119");
gid.assign(nhi_gid);
rule_api.update_option("sid", sid);
}
}
-
rule_api.add_option("gid", gid);
return set_next_rule_state(data_stream);
}