Beispiel #1
0
def _get_raw_history():
    raw_history = DefaultOrderedDict(default_factory=list)

    print_info(
        'Searching for log files: "/var/log/syslog*" or "/var/log/messages*"')

    syslog_files = sorted([
        filename for filename in list_files('/var/log/')
        if filename.rsplit('/', 1)[1].startswith('syslog')
    ])

    if syslog_files:
        for syslog in syslog_files:
            raw_history.update(_read_log_file(syslog))
    else:
        messages_files = sorted([
            filename for filename in list_files('/var/log/')
            if filename.rsplit('/', 1)[1].startswith('messages')
        ])

        if messages_files:
            for messages in messages_files:
                raw_history.update(_read_log_file(messages))
        else:
            raise USBRipError('None of log file types was found!')

    return raw_history
Beispiel #2
0
def _get_filtered_history():
    filtered_history = []

    print_info(
        'Searching for log files: "/var/log/syslog*" or "/var/log/messages*"')

    syslog_files = sorted([
        filename for filename in list_files('/var/log/')
        if filename.rsplit('/', 1)[1].startswith('syslog')
    ])

    if syslog_files:
        for syslog in syslog_files:
            filtered_history.extend(_read_log_file(syslog))
    else:
        messages_files = sorted([
            filename for filename in list_files('/var/log/')
            if filename.rsplit('/', 1)[1].startswith('messages')
        ])

        if messages_files:
            for messages in messages_files:
                filtered_history.extend(_read_log_file(messages))
        else:
            raise USBRipError('None of log file types was found!')

    return filtered_history
Beispiel #3
0
def _get_filtered_history():
    filtered_history = []

    print_info(
        'Searching for log files: C:\\Users\\eyver-dev\\Documents\\python\\usbrip\\test\\syslog* or C:\\Users\\eyver-dev\\Documents\\python\\usbrip\\test\\messages*'
    )

    syslog_files = sorted([
        filename for filename in list_files(
            'C:\\Users\\eyver-dev\\Documents\\python\\usbrip\\test')
        if filename.rsplit('\\', 1)[1].startswith('syslog')
    ])

    if syslog_files:
        for syslog in syslog_files:
            filtered_history.extend(_read_log_file(syslog))
    else:
        messages_files = sorted([
            filename for filename in list_files('/var/log/')
            if filename.rsplit('/', 1)[1].startswith('messages')
        ])

        if messages_files:
            for messages in messages_files:
                filtered_history.extend(_read_log_file(messages))
        else:
            raise USBRipError('None of log file types was found!')

    return filtered_history