dmarc-report 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dmarc_report-0.1.0/.gitignore +98 -0
- dmarc_report-0.1.0/.pre-commit-config.yaml +23 -0
- dmarc_report-0.1.0/.vscode/launch.json +15 -0
- dmarc_report-0.1.0/.vscode/settings.json +8 -0
- dmarc_report-0.1.0/LICENSE +21 -0
- dmarc_report-0.1.0/PKG-INFO +48 -0
- dmarc_report-0.1.0/README.md +35 -0
- dmarc_report-0.1.0/justfile +72 -0
- dmarc_report-0.1.0/noxfile.py +10 -0
- dmarc_report-0.1.0/pyproject.toml +40 -0
- dmarc_report-0.1.0/src/dmarc_report/__init__.py +1 -0
- dmarc_report-0.1.0/src/dmarc_report/dmarc_parser.py +565 -0
- dmarc_report-0.1.0/src/dmarc_report/report.py +34 -0
- dmarc_report-0.1.0/tests/__init__.py +1 -0
- dmarc_report-0.1.0/tests/reports/dmarc-invalid-1.xml +9 -0
- dmarc_report-0.1.0/tests/reports/dmarc-invalid-1.xml.gz +0 -0
- dmarc_report-0.1.0/tests/reports/dmarc-invalid-1.xml.zip +0 -0
- dmarc_report-0.1.0/tests/reports/dmarc-invalid-2.xml +16 -0
- dmarc_report-0.1.0/tests/reports/dmarc-invalid-2.xml.gz +0 -0
- dmarc_report-0.1.0/tests/reports/dmarc-invalid-2.xml.zip +0 -0
- dmarc_report-0.1.0/tests/reports/dmarc-invalid-3.xml +26 -0
- dmarc_report-0.1.0/tests/reports/dmarc-invalid-3.xml.gz +0 -0
- dmarc_report-0.1.0/tests/reports/dmarc-invalid-3.xml.zip +0 -0
- dmarc_report-0.1.0/tests/reports/dmarc-invalid-4.xml +3 -0
- dmarc_report-0.1.0/tests/reports/dmarc-invalid-4.xml.gz +0 -0
- dmarc_report-0.1.0/tests/reports/dmarc-invalid-4.xml.zip +0 -0
- dmarc_report-0.1.0/tests/reports/dmarc-sample-1.xml +48 -0
- dmarc_report-0.1.0/tests/reports/dmarc-sample-1.xml.gz +0 -0
- dmarc_report-0.1.0/tests/reports/dmarc-sample-1.xml.zip +0 -0
- dmarc_report-0.1.0/tests/reports/dmarc-sample-2.xml +48 -0
- dmarc_report-0.1.0/tests/reports/dmarc-sample-2.xml.gz +0 -0
- dmarc_report-0.1.0/tests/reports/dmarc-sample-2.xml.zip +0 -0
- dmarc_report-0.1.0/tests/reports/dmarc-sample-3.xml +70 -0
- dmarc_report-0.1.0/tests/reports/dmarc-sample-3.xml.gz +0 -0
- dmarc_report-0.1.0/tests/reports/dmarc-sample-3.xml.zip +0 -0
- dmarc_report-0.1.0/tests/reports/multiple-invalid-directory-with-valid.zip +0 -0
- dmarc_report-0.1.0/tests/reports/multiple-invalid.zip +0 -0
- dmarc_report-0.1.0/tests/reports/multiple_reports.zip +0 -0
- dmarc_report-0.1.0/tests/test_reports.py +91 -0
- dmarc_report-0.1.0/uv.lock +319 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Django #
|
|
2
|
+
*.log
|
|
3
|
+
*.pot
|
|
4
|
+
*.pyc
|
|
5
|
+
__pycache__
|
|
6
|
+
*.sqlite3
|
|
7
|
+
media
|
|
8
|
+
staticfiles
|
|
9
|
+
|
|
10
|
+
# Backup files #
|
|
11
|
+
*.bak
|
|
12
|
+
|
|
13
|
+
# Python #
|
|
14
|
+
*.py[cod]
|
|
15
|
+
*$py.class
|
|
16
|
+
|
|
17
|
+
# Distribution / packaging
|
|
18
|
+
.Python build/
|
|
19
|
+
develop-eggs/
|
|
20
|
+
dist/
|
|
21
|
+
downloads/
|
|
22
|
+
eggs/
|
|
23
|
+
.eggs/
|
|
24
|
+
lib/
|
|
25
|
+
lib64/
|
|
26
|
+
parts/
|
|
27
|
+
sdist/
|
|
28
|
+
var/
|
|
29
|
+
wheels/
|
|
30
|
+
*.egg-info/
|
|
31
|
+
.installed.cfg
|
|
32
|
+
*.egg
|
|
33
|
+
*.manifest
|
|
34
|
+
*.spec
|
|
35
|
+
|
|
36
|
+
# Installer logs
|
|
37
|
+
pip-log.txt
|
|
38
|
+
pip-delete-this-directory.txt
|
|
39
|
+
|
|
40
|
+
# Unit test / coverage reports
|
|
41
|
+
htmlcov/
|
|
42
|
+
.tox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
.pytest_cache/
|
|
47
|
+
nosetests.xml
|
|
48
|
+
coverage.xml
|
|
49
|
+
*.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
|
|
52
|
+
# Jupyter Notebook
|
|
53
|
+
.ipynb_checkpoints
|
|
54
|
+
|
|
55
|
+
# pyenv
|
|
56
|
+
.python-version
|
|
57
|
+
|
|
58
|
+
# celery
|
|
59
|
+
celerybeat-schedule.*
|
|
60
|
+
|
|
61
|
+
# SageMath parsed files
|
|
62
|
+
*.sage.py
|
|
63
|
+
|
|
64
|
+
# Environments
|
|
65
|
+
.env
|
|
66
|
+
.venv
|
|
67
|
+
env/
|
|
68
|
+
venv/
|
|
69
|
+
ENV/
|
|
70
|
+
env.bak/
|
|
71
|
+
venv.bak/
|
|
72
|
+
|
|
73
|
+
# mkdocs documentation
|
|
74
|
+
/site
|
|
75
|
+
|
|
76
|
+
# mypy
|
|
77
|
+
.mypy_cache/
|
|
78
|
+
|
|
79
|
+
# sftp configuration file
|
|
80
|
+
sftp-config.json
|
|
81
|
+
|
|
82
|
+
# Package control specific files Package
|
|
83
|
+
Control.last-run
|
|
84
|
+
Control.ca-list
|
|
85
|
+
Control.ca-bundle
|
|
86
|
+
Control.system-ca-bundle
|
|
87
|
+
GitHub.sublime-settings
|
|
88
|
+
|
|
89
|
+
# Visual Studio Code #
|
|
90
|
+
.vscode/*
|
|
91
|
+
!.vscode/settings.json
|
|
92
|
+
!.vscode/tasks.json
|
|
93
|
+
!.vscode/launch.json
|
|
94
|
+
!.vscode/extensions.json
|
|
95
|
+
.history
|
|
96
|
+
|
|
97
|
+
# Macos
|
|
98
|
+
.DS_Store
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
default_language_version:
|
|
2
|
+
python: python3.13
|
|
3
|
+
|
|
4
|
+
repos:
|
|
5
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
6
|
+
rev: v5.0.0
|
|
7
|
+
hooks:
|
|
8
|
+
- id: check-added-large-files
|
|
9
|
+
- id: check-ast
|
|
10
|
+
- id: check-case-conflict
|
|
11
|
+
- id: check-merge-conflict
|
|
12
|
+
- id: check-toml
|
|
13
|
+
- id: check-yaml
|
|
14
|
+
- id: detect-private-key
|
|
15
|
+
- id: end-of-file-fixer
|
|
16
|
+
- id: trailing-whitespace
|
|
17
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
18
|
+
# Ruff version.
|
|
19
|
+
rev: v0.8.2
|
|
20
|
+
hooks:
|
|
21
|
+
- id: ruff
|
|
22
|
+
args: [--fix]
|
|
23
|
+
- id: ruff-format
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Use IntelliSense to learn about possible attributes.
|
|
3
|
+
// Hover to view descriptions of existing attributes.
|
|
4
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
+
"version": "0.2.0",
|
|
6
|
+
"configurations": [
|
|
7
|
+
{
|
|
8
|
+
"name": "Python Debugger: Current File",
|
|
9
|
+
"type": "debugpy",
|
|
10
|
+
"request": "launch",
|
|
11
|
+
"program": "${file}",
|
|
12
|
+
"console": "integratedTerminal"
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Stuart Maxwell
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: dmarc-report
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Displays a nicely formatted report in your terminal from a DMARC XML report.
|
|
5
|
+
Author-email: Stuart Maxwell <stuart@amanzi.nz>
|
|
6
|
+
Requires-Python: >=3.9
|
|
7
|
+
Requires-Dist: defusedxml>=0.7.1
|
|
8
|
+
Requires-Dist: rich>=13.9.4
|
|
9
|
+
Provides-Extra: test
|
|
10
|
+
Requires-Dist: nox>=2024.10.9; extra == 'test'
|
|
11
|
+
Requires-Dist: pytest>=8.3.4; extra == 'test'
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# DMARC Report Tool
|
|
15
|
+
|
|
16
|
+
Displays a nicely formatted report in your terminal from a DMARC XML report.
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
This works best when installed with `uvx` or `pipx`.
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# With uvx:
|
|
24
|
+
uvx install dmarc-report
|
|
25
|
+
|
|
26
|
+
# Or with pipx:
|
|
27
|
+
|
|
28
|
+
pipx install dmarc-report
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
Run the `dmarc-report` command-line utility followed by a DMARC report file.
|
|
34
|
+
The DMARC report can have one of the following file extensions:
|
|
35
|
+
|
|
36
|
+
- `.xml.gz`
|
|
37
|
+
- `.zip`
|
|
38
|
+
- `.xml`
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
dmarc-report long-dmarc-report-filename.xml.gz
|
|
42
|
+
# or
|
|
43
|
+
dmarc-report long-dmarc-report-filename.xml
|
|
44
|
+
# or
|
|
45
|
+
dmarc-report long-dmarc-report-filename.zip
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Note: if using a zip file, it will only parse the first xml file found in the zip file.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# DMARC Report Tool
|
|
2
|
+
|
|
3
|
+
Displays a nicely formatted report in your terminal from a DMARC XML report.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
This works best when installed with `uvx` or `pipx`.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# With uvx:
|
|
11
|
+
uvx install dmarc-report
|
|
12
|
+
|
|
13
|
+
# Or with pipx:
|
|
14
|
+
|
|
15
|
+
pipx install dmarc-report
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
Run the `dmarc-report` command-line utility followed by a DMARC report file.
|
|
21
|
+
The DMARC report can have one of the following file extensions:
|
|
22
|
+
|
|
23
|
+
- `.xml.gz`
|
|
24
|
+
- `.zip`
|
|
25
|
+
- `.xml`
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
dmarc-report long-dmarc-report-filename.xml.gz
|
|
29
|
+
# or
|
|
30
|
+
dmarc-report long-dmarc-report-filename.xml
|
|
31
|
+
# or
|
|
32
|
+
dmarc-report long-dmarc-report-filename.zip
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Note: if using a zip file, it will only parse the first xml file found in the zip file.
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Set the default recipe to list all available commands
|
|
2
|
+
@default:
|
|
3
|
+
@just --list
|
|
4
|
+
|
|
5
|
+
#Set the uv command to run a tool
|
|
6
|
+
uv-tool := "uv tool run"
|
|
7
|
+
|
|
8
|
+
# Run Ruff linting
|
|
9
|
+
@lint:
|
|
10
|
+
{{uv-tool}} ruff check
|
|
11
|
+
|
|
12
|
+
# Run tests wth pytest
|
|
13
|
+
@test:
|
|
14
|
+
uv run pytest
|
|
15
|
+
|
|
16
|
+
# Run nox
|
|
17
|
+
@nox:
|
|
18
|
+
{{uv-tool}} nox --session test
|
|
19
|
+
|
|
20
|
+
# Run Ruff formatting
|
|
21
|
+
@format:
|
|
22
|
+
{{uv-tool}} ruff format
|
|
23
|
+
|
|
24
|
+
# Sync the package
|
|
25
|
+
@sync:
|
|
26
|
+
uv sync --all-extras
|
|
27
|
+
|
|
28
|
+
# Sync the package
|
|
29
|
+
@sync-up:
|
|
30
|
+
uv sync --all-extras --upgrade
|
|
31
|
+
|
|
32
|
+
# Lock the package version
|
|
33
|
+
@lock:
|
|
34
|
+
uv lock
|
|
35
|
+
|
|
36
|
+
# Build the package
|
|
37
|
+
@build:
|
|
38
|
+
uv build
|
|
39
|
+
|
|
40
|
+
# Publish the package - this requires a $HOME/.pypirc file with your credentials
|
|
41
|
+
@publish:
|
|
42
|
+
rm -rf ./dist/*
|
|
43
|
+
uv build
|
|
44
|
+
{{uv-tool}} twine check dist/*
|
|
45
|
+
{{uv-tool}} twine upload dist/*
|
|
46
|
+
|
|
47
|
+
# Install pre-commit hooks
|
|
48
|
+
@pc-install:
|
|
49
|
+
{{uv-tool}} pre-commit install
|
|
50
|
+
|
|
51
|
+
# Upgrade pre-commit hooks
|
|
52
|
+
@pc-up:
|
|
53
|
+
{{uv-tool}} pre-commit autoupdate
|
|
54
|
+
|
|
55
|
+
# Run pre-commit hooks
|
|
56
|
+
@pc-run:
|
|
57
|
+
{{uv-tool}} pre-commit run --all-files
|
|
58
|
+
|
|
59
|
+
# Use BumpVer to increase the patch version number. Use just bump -d to view a dry-run.
|
|
60
|
+
@bump *ARGS:
|
|
61
|
+
uv run bumpver update --patch {{ ARGS }}
|
|
62
|
+
uv sync
|
|
63
|
+
|
|
64
|
+
# Use BumpVer to increase the minor version number. Use just bump -d to view a dry-run.
|
|
65
|
+
@bump-minor *ARGS:
|
|
66
|
+
uv run bumpver update --minor {{ ARGS }}
|
|
67
|
+
uv sync
|
|
68
|
+
|
|
69
|
+
# Use BumpVer to increase the major version number. Use just bump -d to view a dry-run.
|
|
70
|
+
@bump-major *ARGS:
|
|
71
|
+
uv run bumpver update --major {{ ARGS }}
|
|
72
|
+
uv sync
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""Nox file."""
|
|
2
|
+
|
|
3
|
+
import nox
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@nox.session(venv_backend="uv", python=["3.9", "3.10", "3.11", "3.12", "3.13"])
|
|
7
|
+
def test(session: nox.Session) -> None:
|
|
8
|
+
"""Run the test suite."""
|
|
9
|
+
session.install("-e", ".", "--extra", "test", "-r", "pyproject.toml")
|
|
10
|
+
session.run("pytest")
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "dmarc-report"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Displays a nicely formatted report in your terminal from a DMARC XML report."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
authors = [{ name = "Stuart Maxwell", email = "stuart@amanzi.nz" }]
|
|
7
|
+
requires-python = ">=3.9"
|
|
8
|
+
dependencies = ["defusedxml>=0.7.1", "rich>=13.9.4"]
|
|
9
|
+
|
|
10
|
+
[project.scripts]
|
|
11
|
+
dmarc-report = "dmarc_report.report:report"
|
|
12
|
+
|
|
13
|
+
[dependency-groups]
|
|
14
|
+
dev = ["bumpver>=2024.1130"]
|
|
15
|
+
|
|
16
|
+
[project.optional-dependencies]
|
|
17
|
+
test = ["nox>=2024.10.9", "pytest>=8.3.4"]
|
|
18
|
+
|
|
19
|
+
[build-system]
|
|
20
|
+
requires = ["hatchling"]
|
|
21
|
+
build-backend = "hatchling.build"
|
|
22
|
+
|
|
23
|
+
[tool.ruff]
|
|
24
|
+
line-length = 120
|
|
25
|
+
target-version = "py313"
|
|
26
|
+
select = ["ALL"]
|
|
27
|
+
ignore = [
|
|
28
|
+
"D203", # https://docs.astral.sh/ruff/rules/one-blank-line-before-class/
|
|
29
|
+
"D213", # https://docs.astral.sh/ruff/rules/multi-line-summary-second-line/
|
|
30
|
+
"UP007",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[tool.ruff.lint.pydocstyle]
|
|
34
|
+
convention = "google" # Accepts: "google", "numpy", or "pep257".
|
|
35
|
+
|
|
36
|
+
[tool.ruff.per-file-ignores]
|
|
37
|
+
"test*" = ["ALL"]
|
|
38
|
+
|
|
39
|
+
[tool.pytest.ini_options]
|
|
40
|
+
python_files = "test_*.py"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""DMARC report parser and display tool."""
|