2015-08-28 17:03:35 +02:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
from pymisp import PyMISP
|
2018-10-14 19:26:03 +02:00
|
|
|
from keys import misp_url, misp_key, misp_verifycert
|
2015-08-28 17:03:35 +02:00
|
|
|
import argparse
|
|
|
|
|
|
|
|
|
|
|
|
def init(url, key):
|
2018-10-14 19:26:03 +02:00
|
|
|
return PyMISP(url, key, misp_verifycert)
|
2015-08-28 17:03:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
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)
|
2015-08-28 17:03:35 +02:00
|
|
|
|
|
|
|
fetch(misp, args.all, args.event)
|