From mboxrd@z Thu Jan 1 00:00:00 1970 From: ramsdell@mitre.org (John D. Ramsdell) Subject: High-level audit parser module Date: 16 Jul 2007 14:01:28 -0400 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mx1.redhat.com (mx1.redhat.com [172.16.48.31]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id l6GI1hIU025477 for ; Mon, 16 Jul 2007 14:01:43 -0400 Received: from smtp-mclean.mitre.org (smtp-mclean.mitre.org [192.80.55.71]) by mx1.redhat.com (8.13.1/8.13.1) with ESMTP id l6GI1cNr018878 for ; Mon, 16 Jul 2007 14:01:38 -0400 Received: from smtp-mclean.mitre.org (localhost.localdomain [127.0.0.1]) by smtp-mclean.mitre.org (8.12.11.20060308/8.12.11) with SMTP id l6GI1So4007350 for ; Mon, 16 Jul 2007 14:01:28 -0400 Received: from smtp-mclean.mitre.org (localhost.localdomain [127.0.0.1]) by smtp-mclean.mitre.org (Postfix) with ESMTP id B68014F8D9 for ; Mon, 16 Jul 2007 14:01:28 -0400 (EDT) Received: from linus.mitre.org (linus.mitre.org [129.83.10.1]) by smtp-mclean.mitre.org (8.12.11.20060308/8.12.11) with ESMTP id l6GI1SA9007318 for ; Mon, 16 Jul 2007 14:01:28 -0400 Received: from oolong.mitre.org (oolong.mitre.org [129.83.162.84]) by linus.mitre.org (8.12.11/8.12.10) with ESMTP id l6GI1SJW018070 for ; Mon, 16 Jul 2007 14:01:28 -0400 (EDT) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-audit-bounces@redhat.com Errors-To: linux-audit-bounces@redhat.com To: linux-audit@redhat.com List-Id: linux-audit@redhat.com John, I'm working on a high-level audit reading Python library built on top of the auparse module. I suspect it could be made to be useful to others besides myself. I have enclosed the generated documentation for the relevant classes in my module. If you think it could be generally useful, the key question is what methods should be defined in the AuditEvent and AuditRecord classes. Some of the current ones are too specific to my needs. CLASSES class AuditEvent(__builtin__.list) | AuditEvent(AuEvent) | | An audit event is represented as a list of AuditRecord's. Each | AuditRecord is a dictionary that represents one of the records | that make up the event. | | Method resolution order: | AuditEvent | __builtin__.list | __builtin__.object | | Methods defined here: | | __init__(self, timestamp) | | find_record_of_type(self, typ) | Find record of type | | Returns a record in the event that has the given type. | Returns None when there is no such record. | | find_value(self, name) | Find a value | | Returns a value associated with the given name in some record | in the event. Raises KeyError if no field has the given name. | | get_timestamp(self) | Get the timestamp associated with this event. | | path_name(self, item) | Find name and security context in PATH record | | Return the name and the security context in a PATH record that | matches the given item number. Raises KeyError if PATH record | cannot be found. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Methods inherited from __builtin__.list: !!! inherited methods omitted !!! class AuditLog(__builtin__.object) | AuditLog(AuParser or file, bool) | | Encapsulates a log accessed by the auparse module. It provides an | interator to the log's events. Each call to the next method of | the interator returns an AuditEvent. The boolean determines if | numeric entities in fields are interpreted. | | Methods defined here: | | __init__(self, au, interpret=False) | | __iter__(self) | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) class AuditLogIter(__builtin__.object) | AuditLogIter(AuditLog) | | An iterator for an audit log. | | Methods defined here: | | __init__(self, aulog) | | next(self) | Returns an AuditEvent | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) class AuditRecord(__builtin__.dict) | AuditRecord(AuditEvent) | | An audit record is a dictionary. | | Method resolution order: | AuditRecord | __builtin__.dict | __builtin__.object | | Methods defined here: | | __init__(self, event) | | get_event(self) | Get the event associated with this record. | | path_name_record(self, item) | Find name and security context in PATH record | | Return the name and the security context in a PATH record that | matches the given item number. Raises KeyError if PATH record | cannot be found. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Methods inherited from __builtin__.dict: !!! inherited methods omitted !!!