chg: Add controller argument to get_csv script

pull/681/head
Raphaël Vinot 2021-01-11 11:49:12 +01:00
parent 3745e7153d
commit c50bbd5d1c
2 changed files with 3 additions and 4 deletions

View File

@ -9,6 +9,7 @@ from keys import misp_url, misp_key, misp_verifycert
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Get MISP stuff as CSV.')
parser.add_argument("--controller", default='attributes', help="Attribute to use for the search (events, objects, attributes)")
parser.add_argument("-e", "--event_id", help="Event ID to fetch. Without it, it will fetch the whole database.")
parser.add_argument("-a", "--attribute", nargs='+', help="Attribute column names")
parser.add_argument("-o", "--object_attribute", nargs='+', help="Object attribute column names")
@ -26,7 +27,7 @@ if __name__ == '__main__':
if not attr:
attr = None
print(args.context)
response = pymisp.search(return_format='csv', eventid=args.event_id, requested_attributes=attr,
response = pymisp.search(return_format='csv', controller=args.controller, eventid=args.event_id, requested_attributes=attr,
type_attribute=args.misp_types, include_context=args.context)
if args.outfile:

View File

@ -14,9 +14,7 @@ faup = Faup()
class URLObject(AbstractMISPObjectGenerator):
def __init__(self, url: str, **kwargs):
# PY3 way:
# super().__init__('file')
super(URLObject, self).__init__('url', **kwargs)
super().__init__('url', **kwargs)
faup.decode(unquote_plus(url))
self.generate_attributes()