diff --git a/utils/flow2template.py b/utils/flow2template.py new file mode 100755 index 0000000000000000000000000000000000000000..570a1ef23d0606d7ef2db44b7133d5a6ec9f43b2 --- /dev/null +++ b/utils/flow2template.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python + +import argparse,gzip,xml.etree.ElementTree + +parser = argparse.ArgumentParser() +parser.add_argument("flowfile", help="input gziped flowfile") +parser.add_argument("templatefile", help="output template file") +args = parser.parse_args() + +f=gzip.open(args.flowfile,'rb') +et = xml.etree.ElementTree.parse(f) + +for v in et.findall(".//variable"): + a=v.attrib + if a['name']=="misp_token": + a['value']="{{ misp_token }}" + elif a['name']=="misp_url": + a['value']="{{ misp_url }}" + elif a['name']=="maxmind_key": + a['value']="{{ maxmind_key }}" + elif a['name']=="elastic_url": + a['value']="https://{{ dslproxy }}:9200" + elif a['name']=="elastic_username": + a['value']="{{ elastic_username }}" + elif a['name']=="elastic_password": + a['value']="{{ odfees_adminpass }}" + +et.write(args.templatefile) +