Skip to content

Commit

Permalink
feat(inventory): add suppression rules count to Snort facts
Browse files Browse the repository at this point in the history
  • Loading branch information
stephdl committed Jan 15, 2025
1 parent e976ab4 commit bcf920f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/nethsec/inventory/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,14 +469,16 @@ def fact_wiregard(uci: EUci):


def fact_snort(uci: EUci):
ret = { 'enabled': False, 'policy': '', 'oink_enabled': False, 'disabled_rules': 0, 'bypass_src_ipv4': 0, 'bypass_src_ipv6': 0, 'bypass_dst_ipv4': 0, 'bypass_dst_ipv6': 0 }
ret = { 'enabled': False, 'policy': '', 'oink_enabled': False, 'disabled_rules': 0, 'suppress_rules': 0, 'bypass_src_ipv4': 0, 'bypass_src_ipv6': 0, 'bypass_dst_ipv4': 0, 'bypass_dst_ipv6': 0 }

ret['enabled'] = uci.get('snort', 'snort', 'enabled', dtype=bool, default=False)
ret['policy'] = uci.get('snort', 'snort', 'ns_policy', default='')
ret['oink_enabled'] = True if uci.get('snort', 'snort', 'oinkcode', default='') else False

# count list of ns_disabled_rules
ret['disabled_rules'] = len(uci.get('snort', 'snort', 'ns_disabled_rules', list=True, default=[]))
# count list of ns_suppress rules
ret['suppress_rules'] = len(uci.get('snort', 'snort', 'ns_suppress', list=True, default=[]))
# count the source bypass of ipv4 and ipv6
ret['bypass_src_ipv4'] = len(uci.get('snort', 'nfq', 'bypass_src_v4', list=True, default=[]))
ret['bypass_src_ipv6'] = len(uci.get('snort', 'nfq', 'bypass_src_v6', list=True, default=[]))
Expand Down

0 comments on commit bcf920f

Please sign in to comment.