def __init__(self, options):
        """Constructor

        options[in]       dictionary of options (e.g. log_name and verbosity)
        """
        self.options = options
        AuditLogReader.__init__(self, options)
        self.header_rows = []
        self.connects = []
        self.rows = []
        self.connection_ids = []
Example #2
0
    def __init__(self, options):
        """Constructor

        options[in]       dictionary of options (e.g. log_name and verbosity)
        """
        self.options = options
        AuditLogReader.__init__(self, options)
        self.header_rows = []
        self.connects = []
        self.rows = []
        self.connection_ids = []
    def __init__(self, options):
        """Constructor

        options[in]       dictionary of options (e.g. log_name and verbosity)
        """
        self.options = options
        AuditLogReader.__init__(self, options)
        self.header_rows = []
        self.connects = []
        self.rows = []
        self.connection_ids = []

        # Compile regexp pattern
        self.regexp_pattern = None
        if self.options['pattern']:
            try:
                self.regexp_pattern = re.compile(self.options['pattern'])
            except:
                raise UtilError("Invalid Pattern: " + self.options['pattern'])

        # Add a space after the query type to reduce false positives.
        # Note: Although not perfect, this simple trick considerably reduce
        # false positives, avoiding the use of complex regex (with lower
        # performance).
        self.match_qtypes = []  # list of matching SQL statement/command types.
        self.regexp_comment = None
        self.regexp_quoted = None
        self.regexp_backtick = None
        if self.options['query_type']:
            # Generate strings to match query types
            for qt in self.options['query_type']:
                if qt == "commit":
                    # COMMIT is an exception (can appear alone without spaces)
                    self.match_qtypes.append(qt)
                else:
                    self.match_qtypes.append("{0} ".format(qt))
            # Compile regexp to match comments (/*...*/) to be ignored/removed.
            self.regexp_comment = re.compile(r'/\*.*?\*/', re.DOTALL)
            # Compile regexp to match single quoted text ('...') to be ignored.
            self.regexp_quoted = re.compile(r"'.*?'", re.DOTALL)
            # Compile regexp to match text between backticks (`) to be ignored.
            self.regexp_backtick = re.compile(r'`.*?`', re.DOTALL)
    def __init__(self, options):
        """Constructor

        options[in]       dictionary of options (e.g. log_name and verbosity)
        """
        self.options = options
        AuditLogReader.__init__(self, options)
        self.header_rows = []
        self.connects = []
        self.rows = []
        self.connection_ids = []

        # Compile regexp pattern
        self.regexp_pattern = None
        if self.options['pattern']:
            try:
                self.regexp_pattern = re.compile(self.options['pattern'])
            except:
                raise UtilError("Invalid Pattern: " + self.options['pattern'])

        # Add a space after the query type to reduce false positives.
        # Note: Although not perfect, this simple trick considerably reduce
        # false positives, avoiding the use of complex regex (with lower
        # performance).
        self.match_qtypes = []  # list of matching SQL statement/command types.
        self.regexp_comment = None
        self.regexp_quoted = None
        self.regexp_backtick = None
        if self.options['query_type']:
            # Generate strings to match query types
            for qt in self.options['query_type']:
                if qt == "commit":
                    # COMMIT is an exception (can appear alone without spaces)
                    self.match_qtypes.append(qt)
                else:
                    self.match_qtypes.append("{0} ".format(qt))
            # Compile regexp to match comments (/*...*/) to be ignored/removed.
            self.regexp_comment = re.compile(r'/\*.*?\*/', re.DOTALL)
            # Compile regexp to match single quoted text ('...') to be ignored.
            self.regexp_quoted = re.compile(r"'.*?'", re.DOTALL)
            # Compile regexp to match text between backticks (`) to be ignored.
            self.regexp_backtick = re.compile(r'`.*?`', re.DOTALL)