Skip to content

Commit

Permalink
Moved data files into Python module ForensicArtifacts#594 (ForensicAr…
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz authored Jan 7, 2024
1 parent 142c986 commit 86064d7
Show file tree
Hide file tree
Showing 45 changed files with 27 additions and 29 deletions.
3 changes: 1 addition & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ include dependencies.ini run_tests.py utils/__init__.py utils/dependencies.py
include utils/check_dependencies.py
include requirements.txt test_requirements.txt
recursive-include config *
recursive-include data *
recursive-include test_data *
exclude .gitignore
exclude *.pyc
recursive-exclude artifacts *.pyc
recursive-include tools *.py
recursive-exclude tools *.pyc
recursive-exclude artifacts *.pyc
# The test scripts are not required in a binary distribution package they
# are considered source distribution files and excluded in find_package()
# in setup.py.
Expand Down
2 changes: 1 addition & 1 deletion artifacts/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
"""ForensicArtifacts.com Artifact Repository."""

__version__ = '20230928'
__version__ = '20240107'
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions config/dpkg/changelog
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
artifacts (20230928-1) unstable; urgency=low
artifacts (20240107-1) unstable; urgency=low

* Auto-generated

-- Forensic artifacts <[email protected]> Thu, 28 Sep 2023 13:23:32 +0200
-- Forensic artifacts <[email protected]> Sun, 07 Jan 2024 10:05:41 +0100
9 changes: 1 addition & 8 deletions config/dpkg/control
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,9 @@ Standards-Version: 4.1.4
X-Python3-Version: >= 3.6
Homepage: https://github.com/ForensicArtifacts/artifacts

Package: artifacts-data
Architecture: all
Depends: ${misc:Depends}
Description: Data files for Digital Forensics Artifacts Repository
A free, community-sourced, machine-readable knowledge base of forensic
artifacts that the world can use both as an information source and within other tools.

Package: python3-artifacts
Architecture: all
Depends: artifacts-data (>= ${binary:Version}), python3-yaml (>= 3.10), ${misc:Depends}
Depends: python3-yaml (>= 3.10), ${misc:Depends}
Description: Python 3 module of Digital Forensics Artifacts Repository
A free, community-sourced, machine-readable knowledge base of forensic
artifacts that the world can use both as an information source and within other tools.
Expand Down
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
certifi >= 2023.11.17
docutils
Markdown
recommonmark
Expand Down
14 changes: 7 additions & 7 deletions docs/sources/background/Stats.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ The artifact definitions can be found in the
[data directory](https://github.com/ForensicArtifacts/artifacts/tree/main/data) and the format is described in detail
in the [Style Guide](https://artifacts.readthedocs.io/en/latest/sources/Format-specification.html).

Status of the repository as of 2023-09-28
Status of the repository as of 2024-01-07

Description | Number
--- | ---
Number of artifact definitions: | 801
Number of file paths: | 2047
Number of artifact definitions: | 808
Number of file paths: | 2058
Number of Windows Registry key paths: | 677

### Artifact definition source types
Expand All @@ -18,7 +18,7 @@ Identifier | Number
--- | ---
ARTIFACT_GROUP | 47
COMMAND | 10
FILE | 516
FILE | 523
PATH | 28
REGISTRY_KEY | 57
REGISTRY_VALUE | 116
Expand All @@ -28,8 +28,8 @@ WMI | 27

Identifier | Number
--- | ---
Darwin | 200
Darwin | 202
ESXi | 16
Linux | 243
Windows | 367
Linux | 246
Windows | 368

6 changes: 5 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = artifacts
version = 20231223
version = 20240107
description = ForensicArtifacts.com Artifact Repository.
long_description = A free, community-sourced, machine-readable knowledge base of forensic artifacts that the world can use both as an information source and within other tools.
long_description_content_type = text/plain
Expand All @@ -27,6 +27,10 @@ scripts =
tools/stats.py
tools/validator.py

[options.package_data]
artifacts.data =
data/*.yaml

[options.packages.find]
exclude =
docs
Expand Down
4 changes: 1 addition & 3 deletions tests/reader_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,8 @@ def testDefinitionsAsDict(self):
"""Tests the AsDict function."""
artifact_reader = reader.YamlArtifactsReader()

artifact_definitions = list(artifact_reader.ReadDirectory('data'))

last_artifact_definition = None
for artifact in artifact_definitions:
for artifact in artifact_reader.ReadDirectory(self._DATA_PATH):
try:
artifact_definition = artifact.AsDict()
except errors.FormatError:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class BaseTestCase(unittest.TestCase):
"""The base test case."""

_DATA_PATH = os.path.join(os.getcwd(), 'data')
_DATA_PATH = os.path.join(os.getcwd(), 'artifacts', 'data')
_TEST_DATA_PATH = os.path.join(os.getcwd(), 'test_data')

# Show full diff results, part of TestCase so does not follow our naming
Expand Down
3 changes: 2 additions & 1 deletion tests/validator_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ def testArtifactDefinitionsValidator(self):
"""Runs the validator over all the YAML artifact definitions files."""
validator_object = validator.ArtifactDefinitionsValidator()

for definitions_file in glob.glob(os.path.join('data', '*.yaml')):
data_files_glob = os.path.join(self._DATA_PATH, '*.yaml')
for definitions_file in glob.glob(data_files_glob):
result = validator_object.CheckFile(definitions_file)
self.assertTrue(
result, msg=f'in definitions file: {definitions_file:s}')
Expand Down
4 changes: 3 additions & 1 deletion tools/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""Report statistics about the artifact collection."""

import collections
import os
import sys
import time

Expand Down Expand Up @@ -70,7 +71,8 @@ def BuildStats(self):
self._source_type_counts = {}
self._total_count = 0

for artifact_definition in artifact_reader.ReadDirectory('data'):
data_files_path = os.path.join('artifacts', 'data')
for artifact_definition in artifact_reader.ReadDirectory(data_files_path):
sources_supported_os = set()
for source in artifact_definition.sources:
self._total_count += 1
Expand Down
2 changes: 1 addition & 1 deletion tools/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
class ArtifactDefinitionsValidator(object):
"""Artifact definitions validator."""

LEGACY_PATH = os.path.join('data', 'legacy.yaml')
LEGACY_PATH = os.path.join('artifacts', 'data', 'legacy.yaml')

_MACOS_PRIVATE_SUB_PATHS = ('etc', 'tftpboot', 'tmp', 'var')

Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ commands =
pylint --version
yamllint -v
pylint --rcfile=.pylintrc artifacts setup.py tests tools
yamllint -c .yamllint.yaml data test_data
yamllint -c .yamllint.yaml artifacts/data test_data

0 comments on commit 86064d7

Please sign in to comment.