Skip to main content

Parse Suricata rules

Project description

parsuricata

Parse Suricata rules

Installation

pip install parsuricata

Usage

from parsuricata import parse_rules

source = '''
  alert http $HOME_NET any -> !$HOME_NET any (msg: "hi mum!"; content: "heymum"; http_uri; sid: 1;)
'''

rules = parse_rules(source)
print(rules)
#
# alert http $HOME_NET any -> !$HOME_NET any ( \
#   msg: hi mum!; \
#   content: heymum; \
#   http_uri; \
#   sid: 1; \
# )

rule = rules[0]

print(rule.action)
# alert

print(rule.protocol)
# http

print(rule.src)
# $HOME_NET

print(rule.src_port)
# any

print(rule.direction)
# ->

print(rule.dst)
# !$HOME_NET

print(rule.dst_port)
# any

for option in rule.options:
    print(f'{option.keyword} = {option.settings}')
#
# msg = hi mum!
# content = heymum
# http_uri = None
# sid = 1

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

parsuricata-0.4.1.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

parsuricata-0.4.1-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file parsuricata-0.4.1.tar.gz.

File metadata

  • Download URL: parsuricata-0.4.1.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.12 Linux/5.13.0-52-generic

File hashes

Hashes for parsuricata-0.4.1.tar.gz
Algorithm Hash digest
SHA256 3757f4dac68625642e9a053f3fa8fe008b1f79406a3763c51efd16fa60db09ca
MD5 a0dc73d90be9028281b75a3c240d2440
BLAKE2b-256 299e7e79812e15b634698b527e6b6c88f9ea79dca856588e1ebfbf9568d9e3f6

See more details on using hashes here.

File details

Details for the file parsuricata-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: parsuricata-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.12 Linux/5.13.0-52-generic

File hashes

Hashes for parsuricata-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e6c4c46e2447d7067e67e170823a9a6fc7ae1faa8405333c9fb9c965dc481134
MD5 b1c6b40f22dbf42fbba344a7ccb1a7ae
BLAKE2b-256 96fcdfe0d0458c7c2843ffd1be5da1b4a6b2f790dd5c4a74a97a4a5b73597d02

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page