Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add revision to http rules - v1 #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions rules/traffic-id.rules
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ alert tls any any -> any any (msg:"SURICATA TRAFFIC-ID: twitter"; tls_sni; conte
alert tls any any -> any any (msg:"SURICATA TRAFFIC-ID: whatsapp"; tls_sni; content:"whatsapp.com"; isdataat:!1,relative; flow:to_server,established; flowbits: set,traffic/id/whatsapp; flowbits:set,traffic/label/im; flowbits:set,traffic/label/file-transfer; noalert; sid:300000029; rev:1;)
alert tls any any -> any any (msg:"SURICATA TRAFFIC-ID: instagram"; tls_sni; content:"instagram.com"; isdataat:!1,relative; flow:to_server,established; flowbits: set,traffic/id/instagram; flowbits:set,traffic/label/social-network; noalert; sid:300000030; rev:1;)
alert tls any any -> any any (msg:"SURICATA TRAFFIC-ID: instagram"; tls_sni; content:"cdninstagram.com"; isdataat:!1,relative; flow:to_server,established; flowbits: set,traffic/id/instagram; flowbits:set,traffic/label/social-network; noalert; sid:300000031; rev:1;)
alert http any any -> any any (msg:"SURICATA TRAFFIC-ID: Debian APT-GET"; content:"debian.org"; http_host; content:"Debian APT"; http_user_agent; flow:to_server,established; flowbits:set,traffic/id/debian-apt; flowbits:set,traffic/label/software-update; noalert; sid:300000032;)
alert http any any -> any any (msg:"SURICATA TRAFFIC-ID: Ubuntu APT-GET"; content:"ubuntu.com"; http_host; content:"Debian APT"; http_user_agent; flow:to_server,established; flowbits:set,traffic/id/ubuntu-apt; flowbits:set,traffic/label/software-update; noalert; sid:300000033;)
alert http any any -> any any (msg:"SURICATA TRAFFIC-ID: Debian APT-GET"; content:"debian.org"; http_host; content:"Debian APT"; http_user_agent; flow:to_server,established; flowbits:set,traffic/id/debian-apt; flowbits:set,traffic/label/software-update; noalert; sid:300000032; rev:1;)
alert http any any -> any any (msg:"SURICATA TRAFFIC-ID: Ubuntu APT-GET"; content:"ubuntu.com"; http_host; content:"Debian APT"; http_user_agent; flow:to_server,established; flowbits:set,traffic/id/ubuntu-apt; flowbits:set,traffic/label/software-update; noalert; sid:300000033; rev:1;)
4 changes: 2 additions & 2 deletions traffic-id.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def print_rules(args, output, config):
if not args.disable_noalert:
options.append("noalert")

options += ["sid:%d" % (SID)]
options += ["sid:%d" % (SID), "rev:1"]

print("alert %s any any -> any any (%s;)" % (
proto, "; ".join(options)), file=output)
Expand All @@ -149,7 +149,7 @@ def generate_rules(args):
if filename.endswith(".yaml"):
path = os.path.join(dirpath, filename)
with open(path) as fileobj:
config = yaml.load(fileobj)
config = yaml.load(fileobj, Loader=yaml.Loader)
if "labels" in config:
LABELS.update(config["labels"])
if "id-map" in config:
Expand Down