mirror of https://github.com/MISP/PyMISP
Fix last commit
parent
dd3591f87c
commit
208091dc47
|
@ -14,7 +14,7 @@ def init(url, key):
|
||||||
|
|
||||||
|
|
||||||
def upload_files(m, eid, paths, distrib, ids, categ, info, analysis, threat):
|
def upload_files(m, eid, paths, distrib, ids, categ, info, analysis, threat):
|
||||||
out = m.upload_sample(eid, paths, distrib, ids, categ, info, analysis, threat)
|
out = m.upload_samplelist(paths, eid, distrib, ids, categ, info, analysis, threat)
|
||||||
if out.status_code == 200:
|
if out.status_code == 200:
|
||||||
print("Files uploaded sucessfully")
|
print("Files uploaded sucessfully")
|
||||||
else:
|
else:
|
||||||
|
@ -41,5 +41,8 @@ if __name__ == '__main__':
|
||||||
files = [args.upload]
|
files = [args.upload]
|
||||||
elif os.path.isdir(args.upload):
|
elif os.path.isdir(args.upload):
|
||||||
files = [f for f in glob.iglob(os.path.join(args.upload + '*'))]
|
files = [f for f in glob.iglob(os.path.join(args.upload + '*'))]
|
||||||
|
else:
|
||||||
|
print('invalid file')
|
||||||
|
exit(0)
|
||||||
|
|
||||||
upload_files(misp, args.event, files, args.distrib, args.ids, args.categ, args.info, args.analysis, args.threat)
|
upload_files(misp, args.event, files, args.distrib, args.ids, args.categ, args.info, args.analysis, args.threat)
|
||||||
|
|
|
@ -147,12 +147,11 @@ class PyMISP(object):
|
||||||
|
|
||||||
def prepare_attribute(self, event_id, distribution, to_ids, category, info,
|
def prepare_attribute(self, event_id, distribution, to_ids, category, info,
|
||||||
analysis, threat_level_id):
|
analysis, threat_level_id):
|
||||||
to_post = {'request': {'files': []}}
|
to_post = {'request': {}}
|
||||||
if not isinstance(event_id, int):
|
if not isinstance(event_id, int):
|
||||||
# New event
|
# New event
|
||||||
postcontent = self._create_event(distribution, threat_level_id,
|
to_post['request'].update(self._create_event(distribution, threat_level_id,
|
||||||
analysis, info)
|
analysis, info))
|
||||||
to_post['request'].update(postcontent)
|
|
||||||
else:
|
else:
|
||||||
to_post['request'].update({'event_id': int(event_id)})
|
to_post['request'].update({'event_id': int(event_id)})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue