mirror of https://github.com/MISP/misp-modules
fix: Fixed pattern parsing + made the module hover only
parent
b9b78d1606
commit
662e58da88
|
@ -6,7 +6,7 @@ except ImportError:
|
||||||
|
|
||||||
misperrors = {'error': 'Error'}
|
misperrors = {'error': 'Error'}
|
||||||
mispattributes = {'input': ['stix2-pattern'], 'output': ['text']}
|
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.'}
|
'description': 'An expansion hover module to perform a syntax check on stix2 patterns.'}
|
||||||
moduleconfig = []
|
moduleconfig = []
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ def handler(q=False):
|
||||||
return misperrors
|
return misperrors
|
||||||
pattern = request.get('stix2-pattern')
|
pattern = request.get('stix2-pattern')
|
||||||
syntax_errors = []
|
syntax_errors = []
|
||||||
for p in pattern[2:-2].split(' AND '):
|
for p in pattern[1:-1].split(' AND '):
|
||||||
syntax_validator = run_validator("[{}]".format(p))
|
syntax_validator = run_validator("[{}]".format(p))
|
||||||
if syntax_validator:
|
if syntax_validator:
|
||||||
for error in syntax_validator:
|
for error in syntax_validator:
|
||||||
|
|
Loading…
Reference in New Issue