mirror of
https://github.com/valitydev/Cortex-Analyzers.git
synced 2024-11-06 09:05:19 +00:00
Fixes #286: Correct handling of ssl parameter
This commit is contained in:
parent
e94f6f698f
commit
05b78fcda9
@ -44,21 +44,18 @@ class MISPClient:
|
||||
if isinstance(ssl, list):
|
||||
if isinstance(ssl[idx], str) and os.path.isfile(ssl[idx]):
|
||||
verify = ssl[idx]
|
||||
elif isinstance(ssl[idx], str) and not os.path.isfile(ssl[idx]):
|
||||
elif isinstance(ssl[idx], str) and not os.path.isfile(ssl[idx]) and ssl[idx] != "":
|
||||
raise CertificateNotFoundError('Certificate not found under {}.'.format(ssl[idx]))
|
||||
elif isinstance(ssl[idx], bool):
|
||||
verify = ssl[idx]
|
||||
else:
|
||||
raise TypeError('SSL parameter is a not expected type: {}'.format(type(ssl[idx])))
|
||||
|
||||
# Do the same checks again, for the non-list type
|
||||
elif isinstance(ssl, str) and os.path.isfile(ssl):
|
||||
verify = ssl
|
||||
elif isinstance(ssl, str) and not os.path.isfile(ssl):
|
||||
elif isinstance(ssl, str) and not os.path.isfile(ssl) and ssl != "":
|
||||
raise CertificateNotFoundError('Certificate not found under {}.'.format(ssl))
|
||||
elif isinstance(ssl, bool):
|
||||
verify = ssl
|
||||
else:
|
||||
raise TypeError('SSL parameter is a not expected type: {}'.format(type(ssl)))
|
||||
self.misp_connections.append(pymisp.PyMISP(url=server,
|
||||
key=key[idx],
|
||||
ssl=verify,
|
||||
@ -67,7 +64,7 @@ class MISPClient:
|
||||
verify = True
|
||||
if isinstance(ssl, str) and os.path.isfile(ssl):
|
||||
verify = ssl
|
||||
elif isinstance(ssl, str)and not os.path.isfile(ssl):
|
||||
elif isinstance(ssl, str) and not os.path.isfile(ssl) and ssl != "":
|
||||
raise CertificateNotFoundError('Certificate not found under {}.'.format(ssl))
|
||||
elif isinstance(ssl, bool):
|
||||
verify = ssl
|
||||
|
Loading…
Reference in New Issue
Block a user