fix: Fixed pattern parsing + made the module hover only

pull/340/head
chrisr3d 2019-10-07 16:46:32 +02:00
parent b9b78d1606
commit 662e58da88
No known key found for this signature in database
GPG Key ID: 6BBED1B63A6D639F
1 changed files with 2 additions and 2 deletions

View File

@ -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: