Files
blue-team-tools/tools/sigma/backends/discovery.py
T

38 lines
1.2 KiB
Python
Raw Normal View History

# Output backend discovery
# Copyright 2016-2019 Thomas Patzke, Florian Roth
2017-12-07 21:55:43 +01:00
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
2017-02-13 23:14:40 +01:00
2017-08-29 00:05:59 +02:00
import sys
2017-02-13 23:14:40 +01:00
import json
2017-02-22 22:47:12 +01:00
import re
import os
2018-07-20 23:30:32 +02:00
import sigma.backends
from .base import BaseBackend
from sigma.tools import getAllSubclasses, getClassDict
2017-02-13 23:14:40 +01:00
def getBackendList():
"""Return list of backend classes"""
2018-07-20 23:30:32 +02:00
path = os.path.dirname(__file__)
return getAllSubclasses(path, "backends", BaseBackend)
2017-02-13 23:14:40 +01:00
def getBackendDict():
return getClassDict(getBackendList())
2017-02-13 23:14:40 +01:00
2017-02-22 22:47:12 +01:00
def getBackend(name):
try:
return getBackendDict()[name]
except KeyError as e:
raise LookupError("Backend not found") from e