Suricata rule parser
Project description
Pure python parser for 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.3.tar.gz
(7.3 kB
view hashes)
Built Distribution
Close
Hashes for suricataparser-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb8b6161ab2548db07c6fa2fbbdda8a2a150a4e350795b26a4bd721c6162c5b3 |
|
MD5 | bd14b1f146eff246988b7fc72f5ffcdc |
|
BLAKE2b-256 | ffa04da6cb51d7ce8ec3d1aa59cadae8c082a7aebb47c4e4e0eff60bb1c6233b |