2016-11-03 11:23:48 +01: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
|
2016-11-03 11:23:48 +01:00
|
|
|
import argparse
|
|
|
|
|
|
|
|
# For python2 & 3 compat, a bit dirty, but it seems to be the least bad one
|
|
|
|
try:
|
|
|
|
input = raw_input
|
|
|
|
except NameError:
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
def init(url, key):
|
2018-10-14 19:26:03 +02:00
|
|
|
return PyMISP(url, key, misp_verifycert, 'json')
|
2016-11-03 11:23:48 +01:00
|
|
|
|
|
|
|
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()
|
|
|
|
|
|
|
|
misp = init(misp_url, misp_key)
|
|
|
|
|
2016-11-04 11:58:21 +01:00
|
|
|
print (misp.add_user(args.email, args.org_id, args.role_id))
|