mirror of https://github.com/MISP/misp-modules
commit
f97359de6a
5 changed files with 46 additions and 4 deletions
@ -1,3 +1,3 @@ |
||||
from . import _vmray |
||||
|
||||
__all__ = ['vmray_submit', 'asn_history', 'circl_passivedns', 'circl_passivessl', 'countrycode', 'cve', 'dns', 'domaintools', 'eupi', 'farsight_passivedns', 'ipasn', 'passivetotal', 'sourcecache', 'virustotal', 'whois', 'shodan', 'reversedns', 'geoip_country', 'wiki', 'iprep', 'threatminer', 'otx', 'threatcrowd', 'vulndb', 'crowdstrike_falcon', 'yara_syntax_validator', 'hashdd'] |
||||
__all__ = ['vmray_submit', 'asn_history', 'circl_passivedns', 'circl_passivessl', 'countrycode', 'cve', 'dns', 'domaintools', 'eupi', 'farsight_passivedns', 'ipasn', 'passivetotal', 'sourcecache', 'virustotal', 'whois', 'shodan', 'reversedns', 'geoip_country', 'wiki', 'iprep', 'threatminer', 'otx', 'threatcrowd', 'vulndb', 'crowdstrike_falcon', 'yara_syntax_validator', 'hashdd', 'onyphe', 'onyphe_full', 'rbl', 'xforceexchange', 'sigma_syntax_validator'] |
||||
|
@ -0,0 +1,35 @@ |
||||
import json |
||||
try: |
||||
import yaml |
||||
from sigma.parser import SigmaParser |
||||
from sigma.config import SigmaConfiguration |
||||
except ModuleNotFoundError: |
||||
print("sigma or yaml is missing, use 'pip3 install sigmatools' to install it.") |
||||
|
||||
misperrors = {'error': 'Error'} |
||||
mispattributes = {'input': ['sigma'], 'output': ['text']} |
||||
moduleinfo = {'version': '0.1', 'author': 'Christian Studer', 'module-type': ['expansion', 'hover'], |
||||
'description': 'An expansion hover module to perform a syntax check on sigma rules'} |
||||
moduleconfig = [] |
||||
|
||||
def handler(q=False): |
||||
if q is False: |
||||
return False |
||||
request = json.loads(q) |
||||
if not request.get('sigma'): |
||||
misperrors['error'] = 'Sigma rule missing' |
||||
return misperrors |
||||
config = SigmaConfiguration() |
||||
try: |
||||
parser = SigmaParser(yaml.load(request.get('sigma')), config) |
||||
result = ("Syntax valid: {}".format(parser.values)) |
||||
except Exception as e: |
||||
result = ("Syntax error: {}".format(str(e))) |
||||
return {'results': [{'types': mispattributes['output'], 'values': result}]} |
||||
|
||||
def introspection(): |
||||
return mispattributes |
||||
|
||||
def version(): |
||||
moduleinfo['config'] = moduleconfig |
||||
return moduleinfo |
@ -1,4 +1,3 @@ |
||||
from . import _vmray |
||||
|
||||
__all__ = ['vmray_import', 'testimport', 'ocr', 'stiximport', 'cuckooimport', 'goamlimport', |
||||
'email_import', 'mispjson', 'openiocimport', 'threatanalyzer_import', 'csvimport'] |
||||
__all__ = ['vmray_import', 'testimport', 'ocr', 'cuckooimport', 'goamlimport', 'email_import', 'mispjson', 'openiocimport', 'threatanalyzer_import', 'csvimport'] |
||||
|
Loading…
Reference in new issue