PyMISP/examples/suricata.py

29 lines
765 B
Python
Raw Normal View History

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pymisp import PyMISP
2015-11-06 11:11:22 +01:00
from keys import misp_url, misp_key
import argparse
def init(url, key):
2016-08-11 17:45:32 +02:00
return PyMISP(url, key, True)
def fetch(m, all_events, event):
if all_events:
print(misp.download_all_suricata().text)
else:
print(misp.download_suricata_rule_event(event).text)
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Download Suricata events.')
parser.add_argument("-a", "--all", action='store_true', help="Download all suricata rules available.")
parser.add_argument("-e", "--event", help="Download suricata rules from one event.")
args = parser.parse_args()
2015-11-06 11:11:22 +01:00
misp = init(misp_url, misp_key)
fetch(misp, args.all, args.event)