Skip to content

Commit df00bfe

Browse files
authored
Added Python 3.13 CI test target (#4913)
1 parent 868aa0f commit df00bfe

31 files changed

+933
-36
lines changed

.github/workflows/test_tox.yml

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ jobs:
2424
toxenv: 'py311,wheel'
2525
- python-version: '3.12'
2626
toxenv: 'py312,wheel'
27+
- python-version: '3.13'
28+
toxenv: 'py313,wheel'
2729
container:
2830
image: ubuntu:22.04
2931
steps:

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = plaso
3-
version = 20241006
3+
version = 20241012
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

tests/cli/extraction_tool.py

+137-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""Tests for the extraction tool object."""
44

55
import argparse
6+
import sys
67
import unittest
78

89
try:
@@ -20,7 +21,24 @@ class ExtractionToolTest(test_lib.CLIToolTestCase):
2021

2122
# pylint: disable=protected-access
2223

23-
_EXPECTED_PERFORMANCE_OPTIONS = """\
24+
_PYTHON3_13_OR_LATER = sys.version_info[0:2] >= (3, 13)
25+
26+
if _PYTHON3_13_OR_LATER:
27+
_EXPECTED_PERFORMANCE_OPTIONS = """\
28+
usage: extraction_tool_test.py [--buffer_size BUFFER_SIZE]
29+
[--queue_size QUEUE_SIZE]
30+
31+
Test argument parser.
32+
33+
{0:s}:
34+
--buffer_size, --buffer-size, --bs BUFFER_SIZE
35+
The buffer size for the output (defaults to 196MiB).
36+
--queue_size, --queue-size QUEUE_SIZE
37+
The maximum number of queued items per worker
38+
(defaults to 125000)
39+
""".format(test_lib.ARGPARSE_OPTIONS)
40+
else:
41+
_EXPECTED_PERFORMANCE_OPTIONS = """\
2442
usage: extraction_tool_test.py [--buffer_size BUFFER_SIZE]
2543
[--queue_size QUEUE_SIZE]
2644
@@ -35,7 +53,43 @@ class ExtractionToolTest(test_lib.CLIToolTestCase):
3553
""".format(test_lib.ARGPARSE_OPTIONS)
3654

3755
if resource is None:
38-
_EXPECTED_PROCESSING_OPTIONS = """\
56+
if _PYTHON3_13_OR_LATER:
57+
_EXPECTED_PROCESSING_OPTIONS = """\
58+
usage: extraction_tool_test.py [--single_process]
59+
[--temporary_directory DIRECTORY]
60+
[--vfs_back_end TYPE]
61+
[--worker_memory_limit SIZE]
62+
[--worker_timeout MINUTES] [--workers WORKERS]
63+
64+
Test argument parser.
65+
66+
{0:s}:
67+
--single_process, --single-process
68+
Indicate that the tool should run in a single process.
69+
--temporary_directory, --temporary-directory DIRECTORY
70+
Path to the directory that should be used to store
71+
temporary files created during processing.
72+
--vfs_back_end, --vfs-back-end TYPE
73+
The preferred dfVFS back-end: "auto", "fsext",
74+
"fsfat", "fshfs", "fsntfs", "tsk" or "vsgpt".
75+
--worker_memory_limit, --worker-memory-limit SIZE
76+
Maximum amount of memory (data segment and shared
77+
memory) a worker process is allowed to consume in
78+
bytes, where 0 represents no limit. The default limit
79+
is 2147483648 (2 GiB). If a worker process exceeds
80+
this limit it is killed by the main (foreman) process.
81+
--worker_timeout, --worker-timeout MINUTES
82+
Number of minutes before a worker process that is not
83+
providing status updates is considered inactive. The
84+
default timeout is 15.0 minutes. If a worker process
85+
exceeds this timeout it is killed by the main
86+
(foreman) process.
87+
--workers WORKERS Number of worker processes. The default is the number
88+
of available system CPUs minus one, for the main
89+
(foreman) process.
90+
""".format(test_lib.ARGPARSE_OPTIONS)
91+
else:
92+
_EXPECTED_PROCESSING_OPTIONS = """\
3993
usage: extraction_tool_test.py [--single_process]
4094
[--temporary_directory DIRECTORY]
4195
[--vfs_back_end TYPE]
@@ -71,7 +125,53 @@ class ExtractionToolTest(test_lib.CLIToolTestCase):
71125
""".format(test_lib.ARGPARSE_OPTIONS)
72126

73127
else:
74-
_EXPECTED_PROCESSING_OPTIONS = """\
128+
if _PYTHON3_13_OR_LATER:
129+
_EXPECTED_PROCESSING_OPTIONS = """\
130+
usage: extraction_tool_test.py [--single_process]
131+
[--process_memory_limit SIZE]
132+
[--temporary_directory DIRECTORY]
133+
[--vfs_back_end TYPE]
134+
[--worker_memory_limit SIZE]
135+
[--worker_timeout MINUTES] [--workers WORKERS]
136+
137+
Test argument parser.
138+
139+
{0:s}:
140+
--process_memory_limit, --process-memory-limit SIZE
141+
Maximum amount of memory (data segment) a process is
142+
allowed to allocate in bytes, where 0 represents no
143+
limit. The default limit is 4294967296 (4 GiB). This
144+
applies to both the main (foreman) process and the
145+
worker processes. This limit is enforced by the
146+
operating system and will supersede the worker memory
147+
limit (--worker_memory_limit).
148+
--single_process, --single-process
149+
Indicate that the tool should run in a single process.
150+
--temporary_directory, --temporary-directory DIRECTORY
151+
Path to the directory that should be used to store
152+
temporary files created during processing.
153+
--vfs_back_end, --vfs-back-end TYPE
154+
The preferred dfVFS back-end: "auto", "fsext",
155+
"fsfat", "fshfs", "fsntfs", "tsk" or "vsgpt".
156+
--worker_memory_limit, --worker-memory-limit SIZE
157+
Maximum amount of memory (data segment and shared
158+
memory) a worker process is allowed to consume in
159+
bytes, where 0 represents no limit. The default limit
160+
is 2147483648 (2 GiB). If a worker process exceeds
161+
this limit it is killed by the main (foreman) process.
162+
--worker_timeout, --worker-timeout MINUTES
163+
Number of minutes before a worker process that is not
164+
providing status updates is considered inactive. The
165+
default timeout is 15.0 minutes. If a worker process
166+
exceeds this timeout it is killed by the main
167+
(foreman) process.
168+
--workers WORKERS Number of worker processes. The default is the number
169+
of available system CPUs minus one, for the main
170+
(foreman) process.
171+
""".format(test_lib.ARGPARSE_OPTIONS)
172+
173+
else:
174+
_EXPECTED_PROCESSING_OPTIONS = """\
75175
usage: extraction_tool_test.py [--single_process]
76176
[--process_memory_limit SIZE]
77177
[--temporary_directory DIRECTORY]
@@ -115,7 +215,40 @@ class ExtractionToolTest(test_lib.CLIToolTestCase):
115215
(foreman) process.
116216
""".format(test_lib.ARGPARSE_OPTIONS)
117217

118-
_EXPECTED_TIME_ZONE_OPTION = """\
218+
219+
if _PYTHON3_13_OR_LATER:
220+
_EXPECTED_TIME_ZONE_OPTION = """\
221+
usage: extraction_tool_test.py [--codepage CODEPAGE] [--language LANGUAGE_TAG]
222+
[--no_extract_winevt_resources] [-z TIME_ZONE]
223+
224+
Test argument parser.
225+
226+
{0:s}:
227+
--codepage CODEPAGE The preferred codepage, which is used for decoding
228+
single-byte or multi-byte character extracted strings.
229+
--language LANGUAGE_TAG
230+
The preferred language, which is used for extracting
231+
and formatting Windows EventLog message strings. Use "
232+
--language list" to see a list of supported language
233+
tags. The en-US (LCID 0x0409) language is used as
234+
fallback if preprocessing could not determine the
235+
system language or no language information is
236+
available in the winevt-rc.db database.
237+
--no_extract_winevt_resources, --no-extract-winevt-resources
238+
Do not extract Windows EventLog resources such as
239+
event message template strings. By default Windows
240+
EventLog resources will be extracted when a Windows
241+
EventLog parser is enabled.
242+
-z, --zone, --timezone TIME_ZONE
243+
preferred time zone of extracted date and time values
244+
that are stored without a time zone indicator. The
245+
time zone is determined based on the source data where
246+
possible otherwise it will default to UTC. Use "list"
247+
to see a list of available time zones.
248+
""".format(test_lib.ARGPARSE_OPTIONS)
249+
250+
else:
251+
_EXPECTED_TIME_ZONE_OPTION = """\
119252
usage: extraction_tool_test.py [--codepage CODEPAGE] [--language LANGUAGE_TAG]
120253
[--no_extract_winevt_resources] [-z TIME_ZONE]
121254

tests/cli/helpers/artifact_definitions.py

+25-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""Tests for the artifact definitions CLI arguments helper."""
44

55
import argparse
6+
import sys
67
import unittest
78

89
from plaso.cli import tools
@@ -17,7 +18,8 @@ class ArtifactDefinitionsArgumentsHelperTest(cli_test_lib.CLIToolTestCase):
1718

1819
# pylint: disable=no-member,protected-access
1920

20-
_EXPECTED_OUTPUT = """\
21+
if sys.version_info[0:2] < (3, 13):
22+
_EXPECTED_OUTPUT = """\
2123
usage: cli_helper.py [--artifact_definitions PATH]
2224
[--custom_artifact_definitions PATH]
2325
@@ -38,6 +40,28 @@ class ArtifactDefinitionsArgumentsHelperTest(cli_test_lib.CLIToolTestCase):
3840
Windows Registry keys.
3941
""".format(cli_test_lib.ARGPARSE_OPTIONS)
4042

43+
else:
44+
_EXPECTED_OUTPUT = """\
45+
usage: cli_helper.py [--artifact_definitions PATH]
46+
[--custom_artifact_definitions PATH]
47+
48+
Test argument parser.
49+
50+
{0:s}:
51+
--artifact_definitions, --artifact-definitions PATH
52+
Path to a directory or file containing artifact
53+
definitions, which are .yaml files. Artifact
54+
definitions can be used to describe and quickly
55+
collect data of interest, such as specific files or
56+
Windows Registry keys.
57+
--custom_artifact_definitions, --custom-artifact-definitions PATH
58+
Path to a directory or file containing custom artifact
59+
definitions, which are .yaml files. Artifact
60+
definitions can be used to describe and quickly
61+
collect data of interest, such as specific files or
62+
Windows Registry keys.
63+
""".format(cli_test_lib.ARGPARSE_OPTIONS)
64+
4165
def testAddArguments(self):
4266
"""Tests the AddArguments function."""
4367
argument_parser = argparse.ArgumentParser(

tests/cli/helpers/artifact_filters.py

+35-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""Tests for the filter file CLI arguments helper."""
44

55
import argparse
6+
import sys
67
import unittest
78

89
from plaso.cli import tools
@@ -17,7 +18,40 @@ class ArtifactFiltersArgumentsHelperTest(cli_test_lib.CLIToolTestCase):
1718

1819
# pylint: disable=no-member,protected-access
1920

20-
_EXPECTED_OUTPUT = """\
21+
_PYTHON3_13_OR_LATER = sys.version_info[0:2] >= (3, 13)
22+
23+
if _PYTHON3_13_OR_LATER:
24+
_EXPECTED_OUTPUT = """\
25+
usage: cli_helper.py [--artifact_filters ARTIFACT_FILTERS]
26+
[--artifact_filters_file PATH]
27+
28+
Test argument parser.
29+
30+
{0:s}:
31+
--artifact_filters, --artifact-filters ARTIFACT_FILTERS
32+
Names of forensic artifact definitions, provided on
33+
the command command line (comma separated). Forensic
34+
artifacts are stored in .yaml files that are directly
35+
pulled from the artifact definitions project. You can
36+
also specify a custom artifacts yaml file (see
37+
--custom_artifact_definitions). Artifact definitions
38+
can be used to describe and quickly collect data of
39+
interest, such as specific files or Windows Registry
40+
keys.
41+
--artifact_filters_file, --artifact-filters_file PATH
42+
Names of forensic artifact definitions, provided in a
43+
file with one artifact name per line. Forensic
44+
artifacts are stored in .yaml files that are directly
45+
pulled from the artifact definitions project. You can
46+
also specify a custom artifacts yaml file (see
47+
--custom_artifact_definitions). Artifact definitions
48+
can be used to describe and quickly collect data of
49+
interest, such as specific files or Windows Registry
50+
keys.
51+
""".format(cli_test_lib.ARGPARSE_OPTIONS)
52+
53+
else:
54+
_EXPECTED_OUTPUT = """\
2155
usage: cli_helper.py [--artifact_filters ARTIFACT_FILTERS]
2256
[--artifact_filters_file PATH]
2357

tests/cli/helpers/bloom_analysis.py

+26-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""Tests for the bloom database analysis plugin CLI arguments helper."""
44

55
import argparse
6+
import sys
67
import unittest
78

89
try:
@@ -25,7 +26,31 @@ class BloomAnalysisArgumentsHelperTest(
2526

2627
# pylint: disable=no-member,protected-access
2728

28-
_EXPECTED_OUTPUT = """\
29+
_PYTHON3_13_OR_LATER = sys.version_info[0:2] >= (3, 13)
30+
31+
if _PYTHON3_13_OR_LATER:
32+
_EXPECTED_OUTPUT = """\
33+
usage: cli_helper.py [--bloom-file PATH] [--bloom-hash HASH]
34+
[--bloom-label LABEL]
35+
36+
Test argument parser.
37+
38+
{0:s}:
39+
--bloom-file, --bloom_file PATH
40+
Path to the bloom database file, the default is:
41+
hashlookup-full.bloom
42+
--bloom-hash, --bloom_hash HASH
43+
Type of hash to use to query the bloom database file
44+
(note that hash values must be stored in upper case),
45+
the default is: sha1. Supported options: md5, sha1,
46+
sha256.
47+
--bloom-label, --bloom_label LABEL
48+
Label to apply to events, the default is:
49+
bloom_present.
50+
""".format(cli_test_lib.ARGPARSE_OPTIONS)
51+
52+
else:
53+
_EXPECTED_OUTPUT = """\
2954
usage: cli_helper.py [--bloom-file PATH] [--bloom-hash HASH]
3055
[--bloom-label LABEL]
3156

tests/cli/helpers/date_filters.py

+33-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""Tests for the date filters CLI arguments helper."""
44

55
import argparse
6+
import sys
67
import unittest
78

89
from plaso.cli import tools
@@ -18,7 +19,38 @@ class DateFiltersArgumentsHelperTest(cli_test_lib.CLIToolTestCase):
1819

1920
# pylint: disable=no-member,protected-access
2021

21-
_EXPECTED_OUTPUT = """\
22+
_PYTHON3_13_OR_LATER = sys.version_info[0:2] >= (3, 13)
23+
24+
if _PYTHON3_13_OR_LATER:
25+
_EXPECTED_OUTPUT = """\
26+
usage: cli_helper.py [--date-filter TYPE_START_END]
27+
28+
Test argument parser.
29+
30+
{0:s}:
31+
--date-filter, --date_filter TYPE_START_END
32+
Filter based on file entry date and time ranges. This
33+
parameter is formatted as
34+
"TIME_VALUE,START_DATE_TIME,END_DATE_TIME" where
35+
TIME_VALUE defines which file entry timestamp the
36+
filter applies to e.g. atime, ctime, crtime, bkup,
37+
etc. START_DATE_TIME and END_DATE_TIME define
38+
respectively the start and end of the date time range.
39+
A date time range requires at minimum start or end to
40+
time of the boundary and END defines the end time.
41+
Both timestamps be set. The date time values are
42+
formatted as: YYYY-MM-DD hh:mm:ss.######[+-]##:##
43+
Where # are numeric digits ranging from 0 to 9 and the
44+
seconds fraction can be either 3 or 6 digits. The time
45+
of day, seconds fraction and time zone offset are
46+
optional. The default time zone is UTC. E.g. "atime,
47+
2013-01-01 23:12:14, 2013-02-23". This parameter can
48+
be repeated as needed to add additional date
49+
boundaries, e.g. once for atime, once for crtime, etc.
50+
""".format(cli_test_lib.ARGPARSE_OPTIONS)
51+
52+
else:
53+
_EXPECTED_OUTPUT = """\
2254
usage: cli_helper.py [--date-filter TYPE_START_END]
2355
2456
Test argument parser.

0 commit comments

Comments
 (0)