59 lines
1.7 KiB
Python
59 lines
1.7 KiB
Python
#!/usr/bin/python
|
|
# -*- coding: utf-8 -*-
|
|
#
|
|
# Copyright 2012 The Plaso Project Authors.
|
|
# Please see the AUTHORS file for details on individual authors.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
"""This file contains few methods for Plaso."""
|
|
|
|
import logging
|
|
|
|
from plaso.lib import output
|
|
|
|
|
|
# TODO: Refactor the putils library so it does not end up being a trash can
|
|
# for all things core/front-end. We don't want this to be end up being a
|
|
# collection for all methods that have no other home.
|
|
class Options(object):
|
|
"""A simple configuration object."""
|
|
|
|
|
|
def _FindClasses(class_object, *args):
|
|
"""Find all registered classes.
|
|
|
|
A method to find all registered classes of a particular
|
|
class.
|
|
|
|
Args:
|
|
class_object: The parent class.
|
|
|
|
Returns:
|
|
A list of registered classes of that class.
|
|
"""
|
|
results = []
|
|
for cls in class_object.classes:
|
|
try:
|
|
results.append(class_object.classes[cls](*args))
|
|
except Exception:
|
|
logging.error(
|
|
u'_FindClasses: exception while appending: {0:s}'.format(cls))
|
|
raise
|
|
|
|
return results
|
|
|
|
|
|
def FindAllOutputs():
|
|
"""Find all available output modules."""
|
|
return _FindClasses(output.LogOutputFormatter, None)
|