Fix typo in variable name.

pull/100/head
Raphaël Vinot 2017-07-27 17:14:49 +02:00
parent 0c86d489b6
commit 622a5701ee
3 changed files with 15 additions and 15 deletions

View File

@ -101,7 +101,7 @@ class PyMISP(object):
warnings.warn("You turned on Async, but don't have requests_futures installed") warnings.warn("You turned on Async, but don't have requests_futures installed")
self.asynch = False self.asynch = False
self.ressources_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'data') self.resources_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'data')
if out_type != 'json': if out_type != 'json':
raise PyMISPError('The only output type supported by PyMISP is JSON. If you still rely on XML, use PyMISP v2.4.49') raise PyMISPError('The only output type supported by PyMISP is JSON. If you still rely on XML, use PyMISP v2.4.49')
if debug is not None: if debug is not None:
@ -136,7 +136,7 @@ class PyMISP(object):
if not self.describe_types.get('sane_defaults'): if not self.describe_types.get('sane_defaults'):
raise PyMISPError('The MISP server your are trying to reach is outdated (<2.4.52). Please use PyMISP v2.4.51.1 (pip install -I PyMISP==v2.4.51.1) and/or contact your administrator.') raise PyMISPError('The MISP server your are trying to reach is outdated (<2.4.52). Please use PyMISP v2.4.51.1 (pip install -I PyMISP==v2.4.51.1) and/or contact your administrator.')
except Exception: except Exception:
with open(os.path.join(self.ressources_path, 'describeTypes.json'), 'r') as f: with open(os.path.join(self.resources_path, 'describeTypes.json'), 'r') as f:
describe_types = json.load(f) describe_types = json.load(f)
self.describe_types = describe_types['result'] self.describe_types = describe_types['result']

View File

@ -52,8 +52,8 @@ class MISPAttribute(object):
def __init__(self, describe_types=None): def __init__(self, describe_types=None):
if not describe_types: if not describe_types:
self.ressources_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'data') self.resources_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'data')
with open(os.path.join(self.ressources_path, 'describeTypes.json'), 'r') as f: with open(os.path.join(self.resources_path, 'describeTypes.json'), 'r') as f:
t = json.load(f) t = json.load(f)
describe_types = t['result'] describe_types = t['result']
self.describe_types = describe_types self.describe_types = describe_types
@ -289,15 +289,15 @@ def _int_to_str(d):
class MISPEvent(object): class MISPEvent(object):
def __init__(self, describe_types=None, strict_validation=False): def __init__(self, describe_types=None, strict_validation=False):
self.ressources_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'data') self.resources_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'data')
if strict_validation: if strict_validation:
with open(os.path.join(self.ressources_path, 'schema.json'), 'r') as f: with open(os.path.join(self.resources_path, 'schema.json'), 'r') as f:
self.json_schema = json.load(f) self.json_schema = json.load(f)
else: else:
with open(os.path.join(self.ressources_path, 'schema-lax.json'), 'r') as f: with open(os.path.join(self.resources_path, 'schema-lax.json'), 'r') as f:
self.json_schema = json.load(f) self.json_schema = json.load(f)
if not describe_types: if not describe_types:
with open(os.path.join(self.ressources_path, 'describeTypes.json'), 'r') as f: with open(os.path.join(self.resources_path, 'describeTypes.json'), 'r') as f:
t = json.load(f) t = json.load(f)
describe_types = t['result'] describe_types = t['result']
self.describe_types = describe_types self.describe_types = describe_types

View File

@ -25,8 +25,8 @@ class TestOffline(unittest.TestCase):
self.event = {'Event': json.load(f)} self.event = {'Event': json.load(f)}
with open('tests/new_misp_event.json', 'r') as f: with open('tests/new_misp_event.json', 'r') as f:
self.new_misp_event = {'Event': json.load(f)} self.new_misp_event = {'Event': json.load(f)}
self.ressources_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), '../pymisp/data') self.resources_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), '../pymisp/data')
with open(os.path.join(self.ressources_path, 'describeTypes.json'), 'r') as f: with open(os.path.join(self.resources_path, 'describeTypes.json'), 'r') as f:
self.types = json.load(f) self.types = json.load(f)
with open('tests/sharing_groups.json', 'r') as f: with open('tests/sharing_groups.json', 'r') as f:
self.sharing_groups = json.load(f) self.sharing_groups = json.load(f)
@ -155,12 +155,12 @@ class TestOffline(unittest.TestCase):
p = MockPyMISP(self.domain, self.key) p = MockPyMISP(self.domain, self.key)
evt = p.get(1) evt = p.get(1)
self.assertEqual(3, p.add_hashes(evt, md5='68b329da9893e34099c7d8ad5cb9c940', self.assertEqual(3, p.add_hashes(evt, md5='68b329da9893e34099c7d8ad5cb9c940',
sha1='adc83b19e793491b1c6ea0fd8b46cd9f32e592fc', sha1='adc83b19e793491b1c6ea0fd8b46cd9f32e592fc',
sha256='01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b', sha256='01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b',
filename='foobar.exe')) filename='foobar.exe'))
self.assertEqual(3, p.add_hashes(evt, md5='68b329da9893e34099c7d8ad5cb9c940', self.assertEqual(3, p.add_hashes(evt, md5='68b329da9893e34099c7d8ad5cb9c940',
sha1='adc83b19e793491b1c6ea0fd8b46cd9f32e592fc', sha1='adc83b19e793491b1c6ea0fd8b46cd9f32e592fc',
sha256='01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b')) sha256='01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b'))
p.av_detection_link(evt, 'https://foocorp.com') p.av_detection_link(evt, 'https://foocorp.com')
p.add_detection_name(evt, 'WATERMELON') p.add_detection_name(evt, 'WATERMELON')
p.add_filename(evt, 'foobar.exe') p.add_filename(evt, 'foobar.exe')