Browse Source

fix: Fixed pattern parsing + made the module hover only

pull/340/head
chrisr3d 2 years ago
parent
commit
662e58da88
No known key found for this signature in database GPG Key ID: 6BBED1B63A6D639F
  1. 4
      misp_modules/modules/expansion/stix2_pattern_syntax_validator.py

4
misp_modules/modules/expansion/stix2_pattern_syntax_validator.py

@ -6,7 +6,7 @@ except ImportError:
misperrors = {'error': 'Error'}
mispattributes = {'input': ['stix2-pattern'], 'output': ['text']}
moduleinfo = {'version': '0.1', 'author': 'Christian Studer', 'module-type': ['expansion', 'hover'],
moduleinfo = {'version': '0.1', 'author': 'Christian Studer', 'module-type': ['hover'],
'description': 'An expansion hover module to perform a syntax check on stix2 patterns.'}
moduleconfig = []
@ -20,7 +20,7 @@ def handler(q=False):
return misperrors
pattern = request.get('stix2-pattern')
syntax_errors = []
for p in pattern[2:-2].split(' AND '):
for p in pattern[1:-1].split(' AND '):
syntax_validator = run_validator("[{}]".format(p))
if syntax_validator:
for error in syntax_validator:

Loading…
Cancel
Save