@@ -0,0 +1,2177 @@
+# -*- coding: utf-8 -*-%0A#%0A#  This file is part of TinyIDS.%0A#%0A#  TinyIDS is a distributed Intrusion Detection System (IDS) for Unix systems. %0A#%0A#  Project development web site:%0A#%0A#      http://www.codetrax.org/projects/tinyids%0A#%0A#  Copyright (c) 2010 George Notaras, G-Loaded.eu, CodeTRAX.org%0A#%0A#  Licensed under the Apache License, Version 2.0 (the %22License%22);%0A#  you may not use this file except in compliance with the License.%0A#  You may obtain a copy of the License at%0A#%0A#      http://www.apache.org/licenses/LICENSE-2.0%0A#%0A#  Unless required by applicable law or agreed to in writing, software%0A#  distributed under the License is distributed on an %22AS IS%22 BASIS,%0A#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A#  See the License for the specific language governing permissions and%0A#  limitations under the License.%0A#%0A%0ADEFAULT_PATHS = (%0A    '/usr/local/sbin/*',%0A    '/usr/local/bin/*',%0A    '/sbin/*',%0A    '/bin/*',%0A    '/usr/sbin/*',%0A    '/usr/bin/*',%0A    '/root/bin/*',%0A    '/lib/*',%0A    '/usr/lib/*',%0A    '/usr/local/lib/*',%0A)%0A%0A%0Aimport os%0Aimport glob%0Aimport logging%0A%0Afrom TinyIDS.config import TinyIDSConfigParser%0A%0A%0Alogger = logging.getLogger()%0A%0A%0Aclass BaseCollector:%0A    %22%22%22%0A    self.config_path = os.path.join(backend_conf_dir, __name__ + '.conf')%0A    %22%22%22%0A    %0A    def __init__(self, config_path=None):%0A        %0A        self.config_path = config_path%0A        self.cfg = TinyIDSConfigParser()%0A        if self.config_path:%0A            if os.path.exists(self.config_path):%0A                self.cfg.read(self.config_path)%0A                logger.debug('Using configuration for %25s backend from: %25s' %25 (__name__, self.config_path))%0A        %0A    def file_paths(self):%0A        if not self.cfg.has_section('main'):%0A            paths = DEFAULT_PATHS%0A        elif not self.cfg.has_option('main', 'paths'):%0A            paths = DEFAULT_PATHS%0A        else:%0A            paths = self.cfg.getlist('main', 'paths')%0A        for path in paths:%0A            file_list = glob.glob(path)%0A            for fpath in file_list:%0A                if os.path.isfile(fpath):   # Follows symbolic links%0A                    yield fpath%0A    %0A    def collect(self):%0A        pass%0A%0A

Define a first concept of the backend API