Suricata rule parser
Project description
Pure python package for parsing and generating Snort/Suricata rules.
Install
Requires Python >= 3.6.
pip install suricataparser
Usage
>>> from suricataparser import parse_rule, parse_file
Parse rules file:
>>> rules = parse_file("suricata.rules")
Parse raw rule:
>>> rule = parse_rule('alert tcp any any -> any any (sid:1; gid:1;)') >>> print(rule) alert tcp any any -> any any (msg:"Msg"; sid:1; gid:1;)
View rule properties:
>>> rule.sid 1 >>> rule.action alert >>> rule.header tcp any any -> any any >>> rule.msg '"Msg"'
Turn on/off rule:
>>> rule.enabled True >>> rule.enabled = False >>> print(rule) # alert tcp any any -> any any (msg:"Msg"; sid:1; gid:1;)
Modify options:
>>> rule.add_option("http_uri") >>> rule.add_option("key", "value") >>> print(rule) alert tcp any any -> any any (msg: "Msg"; sid: 1; gid: 1; http_uri; key: value;) >>> rule.pop_option("key") >>> print(rule) alert tcp any any -> any any (msg: "Msg"; sid: 1; gid: 1; http_uri;)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
suricataparser-0.0.7.tar.gz
(7.7 kB
view hashes)
Built Distribution
Close
Hashes for suricataparser-0.0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2914af22dbf5a4bf0167d721755c019c18c778312d517a3081fe639fbcdcd64a |
|
MD5 | bd42cdfd0238dee1d467bbfa44505fc7 |
|
BLAKE2b-256 | 9e81e1d6e6a0b33bc4804a37b7f14c32b83432b2fd068e65ef37afd6b3ee1702 |