Skip to content

meltedinhex/analyst-ai-pack / skills/writing-suricata-and-snort-rules

writing-suricata-and-snort-rules

Verified

Writes and validates Suricata/Snort IDS rules for network-based malware detection, covering rule anatomy, content/pcre matching, flow and threshold options, and common mistakes that cause false positives or no matches. Activates for requests to write a Suricata rule, create Snort signatures, or build network detection rules from IOCs or C2 patterns.

FileKindSize
LICENSEother340 B
SKILL.mdskill md2.8 KB
references/api-reference.mdmarkdown1.1 KB
scripts/analyst.pyscript2.8 KB

references/api-reference.md

View on GitHub
# API Reference: Writing Suricata and Snort Rules

## Overview

`scripts/analyst.py` lints Suricata/Snort rule files for required metadata (`msg`, `sid`, `rev`,
`classtype`), balanced quotes/parentheses, duplicate SIDs, and short free-floating `content`
matches that cause false positives. It parses rule text only and does not load any IDS engine.

## Dependencies

| Package | Version | Purpose |
|---------|---------|---------|
| (stdlib) | — | regex, JSON, file IO |

## Core functions

### `lint(path)`
Returns rules checked, issue count, and per-line problems. Exit code is non-zero when issues exist
(useful in CI).

## Checks

- Presence of `msg`, `sid`, `rev`, `classtype`.
- Unique SIDs across the file.
- Balanced quotes and parentheses.
- `content` ≤ 3 chars must be anchored (`http.uri`, `flow:`, `offset`, `depth`, etc.).

## Usage

```bash
python scripts/analyst.py lint rules.rules
```

## Sources

- Suricata rules documentation — https://docs.suricata.io/en/latest/rules/intro.html
- Snort 3 rule writing guide — https://docs.snort.org/
- Rule anatomy and SID/anchoring best practices from official IDS documentation
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall