Skip to content

Commit c79aed4

Browse files
authored
Ignore empty gzip timestamp in yearless log format helper (#4829)
1 parent e9af2a6 commit c79aed4

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

config/dpkg/changelog

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
plaso (20240303-1) unstable; urgency=low
1+
plaso (20240308-1) unstable; urgency=low
22

33
* Auto-generated
44

5-
-- Log2Timeline maintainers <[email protected]> Sun, 03 Mar 2024 11:10:05 +0100
5+
-- Log2Timeline maintainers <[email protected]> Fri, 08 Mar 2024 20:01:17 +0100

plaso/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
of log2timeline.
77
"""
88

9-
__version__ = '20240303'
9+
__version__ = '20240308'

plaso/lib/yearless_helper.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,24 @@ def _GetYearsFromFileEntry(self, file_entry):
4444
Returns:
4545
set[int]: years of the file entry.
4646
"""
47+
if file_entry.type_indicator == dfvfs_definitions.TYPE_INDICATOR_GZIP:
48+
# Ignore a gzip file that contains a modification timestamp of 0.
49+
if (file_entry.modification_time and
50+
file_entry.modification_time.timestamp > 0):
51+
year, _, _ = file_entry.modification_time.GetDate()
52+
return set([year])
53+
4754
years = set()
4855

4956
for attribute_name in ('change_time', 'creation_time', 'modification_time'):
5057
date_time = getattr(file_entry, attribute_name, None)
5158
if date_time:
5259
year, _, _ = date_time.GetDate()
60+
61+
if year == 1970 and file_entry.type_indicator == (
62+
dfvfs_definitions.TYPE_INDICATOR_GZIP):
63+
continue
64+
5365
years.add(year)
5466

5567
return years
@@ -149,7 +161,7 @@ def _UpdateYear(self, month):
149161
# Account for log formats that allow out-of-order date and time values
150162
# (Apr->May->Apr) such as rsyslog with the RepeatedMsgReduction setting
151163
# enabled.
152-
if (month + 1) < self._month:
164+
if month + 1 < self._month:
153165
self._relative_year += 1
154166
self._year += 1
155167

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = plaso
3-
version = 20240303
3+
version = 20240308
44
description = Plaso (log2timeline) - Super timeline all the things
55
long_description = Plaso (log2timeline) is a framework to create super timelines. Its purpose is to extract timestamps from various files found on typical computer systems and aggregate them.
66
long_description_content_type = text/plain

0 commit comments

Comments
 (0)