PyMISP/examples/add_user.py

23 lines
832 B
Python
Raw Normal View History

2016-11-03 11:23:48 +01:00
#!/usr/bin/env python
# -*- coding: utf-8 -*-
2019-07-17 16:46:47 +02:00
from pymisp import ExpandedPyMISP, MISPUser
from keys import misp_url, misp_key, misp_verifycert
2016-11-03 11:23:48 +01:00
import argparse
if __name__ == '__main__':
2016-11-04 11:58:21 +01:00
parser = argparse.ArgumentParser(description='Add a new user by setting the mandory fields.')
parser.add_argument("-e", "--email", required=True, help="Email linked to the account.")
parser.add_argument("-o", "--org_id", required=True, help="Organisation linked to the user.")
parser.add_argument("-r", "--role_id", required=True, help="Role linked to the user.")
2016-11-03 11:23:48 +01:00
args = parser.parse_args()
2019-07-17 16:46:47 +02:00
misp = ExpandedPyMISP(misp_url, misp_key, misp_verifycert, 'json')
user = MISPUser()
user.email = args.email
user.org_id = args.org_id
user.role_id = args.role_id
2016-11-03 11:23:48 +01:00
2019-07-17 16:46:47 +02:00
print(misp.add_user(user, pythonify=True))