check-msdefender 1.1.1__tar.gz → 1.1.2__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.
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/PKG-INFO +11 -12
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/check_msdefender/check_msdefender.py +0 -1
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/check_msdefender/cli/commands/alerts.py +0 -1
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/check_msdefender/cli/commands/detail.py +1 -6
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/check_msdefender/cli/commands/lastseen.py +0 -1
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/check_msdefender/cli/commands/machines.py +0 -1
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/check_msdefender/cli/commands/onboarding.py +0 -1
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/check_msdefender/cli/commands/vulnerabilities.py +0 -1
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/check_msdefender/cli/decorators.py +1 -1
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/check_msdefender/cli/handlers.py +0 -1
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/check_msdefender/services/alerts_service.py +2 -2
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/check_msdefender/services/machines_service.py +1 -1
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/check_msdefender/services/models.py +1 -1
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/pyproject.toml +59 -11
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/tests/fixtures/mock_defender_client.py +1 -1
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/tests/fixtures/test_lastseen_service.py +3 -3
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/tests/integration/test_cli_integration.py +1 -2
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/tests/unit/test_detail_service.py +4 -3
- check_msdefender-1.1.1/.claude/settings.local.json +0 -19
- check_msdefender-1.1.1/.env.example +0 -10
- check_msdefender-1.1.1/.github/workflows/python-package.yml +0 -40
- check_msdefender-1.1.1/.github/workflows/python-publish.yml +0 -70
- check_msdefender-1.1.1/.gitignore +0 -6
- check_msdefender-1.1.1/.idea/.gitignore +0 -5
- check_msdefender-1.1.1/.idea/check_msdefender.iml +0 -13
- check_msdefender-1.1.1/.idea/dictionaries/project.xml +0 -7
- check_msdefender-1.1.1/.idea/encodings.xml +0 -4
- check_msdefender-1.1.1/.idea/inspectionProfiles/profiles_settings.xml +0 -6
- check_msdefender-1.1.1/.idea/misc.xml +0 -7
- check_msdefender-1.1.1/.idea/modules.xml +0 -8
- check_msdefender-1.1.1/.idea/runConfigurations/Integration_Tests.xml +0 -23
- check_msdefender-1.1.1/.idea/vcs.xml +0 -6
- check_msdefender-1.1.1/check_msdefender.egg-info/PKG-INFO +0 -431
- check_msdefender-1.1.1/check_msdefender.egg-info/SOURCES.txt +0 -88
- check_msdefender-1.1.1/check_msdefender.egg-info/dependency_links.txt +0 -1
- check_msdefender-1.1.1/check_msdefender.egg-info/entry_points.txt +0 -2
- check_msdefender-1.1.1/check_msdefender.egg-info/requires.txt +0 -12
- check_msdefender-1.1.1/check_msdefender.egg-info/top_level.txt +0 -1
- check_msdefender-1.1.1/check_msdefender.ini.example +0 -18
- check_msdefender-1.1.1/doc/Feat-Click-Decorators-ErrorHandlers-Formatters.md +0 -66
- check_msdefender-1.1.1/doc/Feat-Click-Groups.md +0 -126
- check_msdefender-1.1.1/doc/Feat-Enhance-MsDefender-Vulnerabilities-Output.md +0 -35
- check_msdefender-1.1.1/doc/Feat-Fixture-Tests.md +0 -40
- check_msdefender-1.1.1/doc/Feat-Integration-Tests.md +0 -21
- check_msdefender-1.1.1/doc/Feat-MsDefender-Alerts.md +0 -116
- check_msdefender-1.1.1/doc/Feat-MsDefender-DetailMachine.md +0 -78
- check_msdefender-1.1.1/doc/Feat-MsDefender-ListMachines.md +0 -87
- check_msdefender-1.1.1/doc/Feat-MsDefender.md +0 -110
- check_msdefender-1.1.1/doc/Feat-Nagios-Detailed-Output.md +0 -31
- check_msdefender-1.1.1/doc/Feat-Nagios-Exit-Code.md +0 -21
- check_msdefender-1.1.1/doc/Feat-Nagios-Output.md +0 -53
- check_msdefender-1.1.1/doc/Feat-Pypi-Package.md +0 -306
- check_msdefender-1.1.1/doc/Feat-Verbose.md +0 -39
- check_msdefender-1.1.1/pytest.ini +0 -6
- check_msdefender-1.1.1/requirements-dev.txt +0 -9
- check_msdefender-1.1.1/requirements.txt +0 -3
- check_msdefender-1.1.1/setup.cfg +0 -4
- check_msdefender-1.1.1/test_verbose.py +0 -29
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/LICENSE +0 -0
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/README.md +0 -0
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/check_msdefender/__init__.py +0 -0
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/check_msdefender/__main__.py +0 -0
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/check_msdefender/cli/__init__.py +0 -0
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/check_msdefender/cli/__main__.py +0 -0
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/check_msdefender/cli/commands/__init__.py +0 -0
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/check_msdefender/core/__init__.py +0 -0
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/check_msdefender/core/auth.py +0 -0
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/check_msdefender/core/config.py +0 -0
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/check_msdefender/core/defender.py +0 -0
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/check_msdefender/core/exceptions.py +0 -0
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/check_msdefender/core/logging_config.py +0 -0
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/check_msdefender/core/nagios.py +0 -0
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/check_msdefender/services/__init__.py +0 -0
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/check_msdefender/services/detail_service.py +0 -0
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/check_msdefender/services/lastseen_service.py +0 -0
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/check_msdefender/services/onboarding_service.py +0 -0
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/check_msdefender/services/vulnerabilities_service.py +0 -0
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/tests/__init__.py +0 -0
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/tests/fixtures/__init__.py +0 -0
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/tests/fixtures/alerts_data.json +0 -0
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/tests/fixtures/machine_data.json +0 -0
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/tests/fixtures/test_alerts_service.py +0 -0
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/tests/fixtures/test_detail_service.py +0 -0
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/tests/fixtures/test_onboarding_service.py +0 -0
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/tests/fixtures/test_vulnerabilities_service.py +0 -0
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/tests/fixtures/vulnerability_data.json +0 -0
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/tests/integration/__init__.py +0 -0
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/tests/integration/test_lastseen_integration.py +0 -0
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/tests/unit/__init__.py +0 -0
- {check_msdefender-1.1.1 → check_msdefender-1.1.2}/tests/unit/test_alerts_service.py +0 -0
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
2
|
Name: check-msdefender
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.2
|
|
4
4
|
Summary: A Nagios plugin for monitoring Microsoft Defender API endpoints
|
|
5
|
-
Author-email: ldvchosal <ldvchosal@github.com>
|
|
6
|
-
License: MIT
|
|
7
|
-
Project-URL: Homepage, https://github.com/lduchosal/check_msdefender
|
|
8
|
-
Project-URL: Bug Reports, https://github.com/lduchosal/check_msdefender/issues
|
|
9
|
-
Project-URL: Source, https://github.com/lduchosal/check_msdefender
|
|
10
|
-
Project-URL: Documentation, https://github.com/lduchosal/check_msdefender/blob/main/README.md
|
|
11
5
|
Keywords: nagios,monitoring,microsoft,graph,api,azure
|
|
6
|
+
Author-Email: ldvchosal <ldvchosal@github.com>
|
|
7
|
+
License: MIT
|
|
12
8
|
Classifier: Development Status :: 5 - Production/Stable
|
|
13
9
|
Classifier: Intended Audience :: System Administrators
|
|
14
10
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -19,9 +15,11 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
19
15
|
Classifier: Programming Language :: Python :: 3.11
|
|
20
16
|
Classifier: Topic :: System :: Monitoring
|
|
21
17
|
Classifier: Topic :: System :: Systems Administration
|
|
18
|
+
Project-URL: Homepage, https://github.com/lduchosal/check_msdefender
|
|
19
|
+
Project-URL: Bug Reports, https://github.com/lduchosal/check_msdefender/issues
|
|
20
|
+
Project-URL: Source, https://github.com/lduchosal/check_msdefender
|
|
21
|
+
Project-URL: Documentation, https://github.com/lduchosal/check_msdefender/blob/main/README.md
|
|
22
22
|
Requires-Python: >=3.9
|
|
23
|
-
Description-Content-Type: text/markdown
|
|
24
|
-
License-File: LICENSE
|
|
25
23
|
Requires-Dist: nagiosplugin>=1.4.0
|
|
26
24
|
Requires-Dist: azure-identity>=1.12.0
|
|
27
25
|
Requires-Dist: click<9.0,>=8.0
|
|
@@ -33,7 +31,8 @@ Requires-Dist: black>=21.0; extra == "dev"
|
|
|
33
31
|
Requires-Dist: flake8>=3.8; extra == "dev"
|
|
34
32
|
Requires-Dist: mypy>=0.800; extra == "dev"
|
|
35
33
|
Requires-Dist: twine>=6.2.0; extra == "dev"
|
|
36
|
-
|
|
34
|
+
Requires-Dist: pdm>=2.0.0; extra == "dev"
|
|
35
|
+
Description-Content-Type: text/markdown
|
|
37
36
|
|
|
38
37
|
# 🛡️ Check MS Defender
|
|
39
38
|
|
|
@@ -428,4 +427,4 @@ This project is licensed under the **MIT License** - see the [LICENSE](LICENSE)
|
|
|
428
427
|
|
|
429
428
|
[🐛 Report Bug](https://github.com/lduchosal/check_msdefender/issues) • [💡 Request Feature](https://github.com/lduchosal/check_msdefender/issues) • [📖 Documentation](https://github.com/lduchosal/check_msdefender/blob/main/README.md)
|
|
430
429
|
|
|
431
|
-
</div>
|
|
430
|
+
</div>
|
|
@@ -16,7 +16,6 @@ def register_detail_commands(main_group: Any) -> None:
|
|
|
16
16
|
"""Register detail commands with the main CLI group."""
|
|
17
17
|
|
|
18
18
|
@main_group.command("detail")
|
|
19
|
-
@click.option("-i", "--id", "machine_id_alt", help="Machine ID (GUID)")
|
|
20
19
|
@common_options
|
|
21
20
|
def detail_cmd(
|
|
22
21
|
config: str,
|
|
@@ -25,7 +24,6 @@ def register_detail_commands(main_group: Any) -> None:
|
|
|
25
24
|
dns_name: Optional[str],
|
|
26
25
|
warning: Optional[float],
|
|
27
26
|
critical: Optional[float],
|
|
28
|
-
machine_id_alt: Optional[str],
|
|
29
27
|
) -> None:
|
|
30
28
|
"""Get detailed machine information from Microsoft Defender."""
|
|
31
29
|
try:
|
|
@@ -44,9 +42,6 @@ def register_detail_commands(main_group: Any) -> None:
|
|
|
44
42
|
# Create custom Nagios plugin for detail output
|
|
45
43
|
plugin = NagiosPlugin(service, "detail")
|
|
46
44
|
|
|
47
|
-
# Use -i option if provided, otherwise fallback to -m
|
|
48
|
-
final_machine_id = machine_id_alt or machine_id
|
|
49
|
-
|
|
50
45
|
# Set default thresholds for detail command to show proper performance data
|
|
51
46
|
# Based on expected test output patterns
|
|
52
47
|
if warning is not None and critical is None:
|
|
@@ -58,7 +53,7 @@ def register_detail_commands(main_group: Any) -> None:
|
|
|
58
53
|
|
|
59
54
|
# Execute check
|
|
60
55
|
result = plugin.check(
|
|
61
|
-
machine_id=
|
|
56
|
+
machine_id=machine_id,
|
|
62
57
|
dns_name=dns_name,
|
|
63
58
|
warning=warning,
|
|
64
59
|
critical=critical,
|
|
@@ -10,7 +10,7 @@ def common_options(func: Callable[..., Any]) -> Callable[..., Any]:
|
|
|
10
10
|
"-c", "--config", default="check_msdefender.ini", help="Configuration file path"
|
|
11
11
|
)(func)
|
|
12
12
|
func = click.option("-v", "--verbose", count=True, help="Increase verbosity")(func)
|
|
13
|
-
func = click.option("-m", "--machine-id", help="Machine ID (GUID)")(func)
|
|
13
|
+
func = click.option("-m", "--machine-id", "-i", "--id", help="Machine ID (GUID)")(func)
|
|
14
14
|
func = click.option("-d", "--dns-name", help="Computer DNS Name (FQDN)")(func)
|
|
15
15
|
func = click.option("-W", "--warning", type=float, help="Warning threshold")(func)
|
|
16
16
|
func = click.option("-C", "--critical", type=float, help="Critical threshold")(func)
|
{check_msdefender-1.1.1 → check_msdefender-1.1.2}/check_msdefender/services/alerts_service.py
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""Alerts service implementation."""
|
|
2
2
|
|
|
3
|
-
from
|
|
4
|
-
|
|
3
|
+
from typing import Dict, Optional, Any
|
|
4
|
+
|
|
5
5
|
from check_msdefender.core.exceptions import ValidationError
|
|
6
6
|
from check_msdefender.core.logging_config import get_verbose_logger
|
|
7
7
|
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = [
|
|
3
|
-
|
|
2
|
+
requires = [
|
|
3
|
+
"pdm-backend",
|
|
4
|
+
]
|
|
5
|
+
build-backend = "pdm.backend"
|
|
4
6
|
|
|
5
7
|
[project]
|
|
6
8
|
name = "check-msdefender"
|
|
7
|
-
version = "1.1.
|
|
9
|
+
version = "1.1.2"
|
|
8
10
|
authors = [
|
|
9
|
-
{name = "ldvchosal", email = "ldvchosal@github.com"},
|
|
11
|
+
{ name = "ldvchosal", email = "ldvchosal@github.com" },
|
|
10
12
|
]
|
|
11
13
|
description = "A Nagios plugin for monitoring Microsoft Defender API endpoints"
|
|
12
14
|
readme = "README.md"
|
|
13
|
-
license = {text = "MIT"}
|
|
14
15
|
requires-python = ">=3.9"
|
|
15
16
|
classifiers = [
|
|
16
17
|
"Development Status :: 5 - Production/Stable",
|
|
@@ -24,13 +25,23 @@ classifiers = [
|
|
|
24
25
|
"Topic :: System :: Monitoring",
|
|
25
26
|
"Topic :: System :: Systems Administration",
|
|
26
27
|
]
|
|
27
|
-
keywords = [
|
|
28
|
+
keywords = [
|
|
29
|
+
"nagios",
|
|
30
|
+
"monitoring",
|
|
31
|
+
"microsoft",
|
|
32
|
+
"graph",
|
|
33
|
+
"api",
|
|
34
|
+
"azure",
|
|
35
|
+
]
|
|
28
36
|
dependencies = [
|
|
29
37
|
"nagiosplugin>=1.4.0",
|
|
30
38
|
"azure-identity>=1.12.0",
|
|
31
|
-
"click>=8.0,<9.0"
|
|
39
|
+
"click>=8.0,<9.0",
|
|
32
40
|
]
|
|
33
41
|
|
|
42
|
+
[project.license]
|
|
43
|
+
text = "MIT"
|
|
44
|
+
|
|
34
45
|
[project.optional-dependencies]
|
|
35
46
|
dev = [
|
|
36
47
|
"pytest>=6.0",
|
|
@@ -40,6 +51,7 @@ dev = [
|
|
|
40
51
|
"flake8>=3.8",
|
|
41
52
|
"mypy>=0.800",
|
|
42
53
|
"twine>=6.2.0",
|
|
54
|
+
"pdm>=2.0.0",
|
|
43
55
|
]
|
|
44
56
|
|
|
45
57
|
[project.urls]
|
|
@@ -52,11 +64,15 @@ Documentation = "https://github.com/lduchosal/check_msdefender/blob/main/README.
|
|
|
52
64
|
check_msdefender = "check_msdefender.cli:main"
|
|
53
65
|
|
|
54
66
|
[tool.setuptools.package-data]
|
|
55
|
-
"*" = [
|
|
67
|
+
"*" = [
|
|
68
|
+
"*.ini",
|
|
69
|
+
]
|
|
56
70
|
|
|
57
71
|
[tool.black]
|
|
58
72
|
line-length = 100
|
|
59
|
-
target-version = [
|
|
73
|
+
target-version = [
|
|
74
|
+
"py39",
|
|
75
|
+
]
|
|
60
76
|
|
|
61
77
|
[tool.mypy]
|
|
62
78
|
python_version = "3.9"
|
|
@@ -65,8 +81,40 @@ warn_unused_configs = true
|
|
|
65
81
|
disallow_untyped_defs = true
|
|
66
82
|
|
|
67
83
|
[tool.pytest.ini_options]
|
|
68
|
-
testpaths = [
|
|
84
|
+
testpaths = [
|
|
85
|
+
"tests",
|
|
86
|
+
]
|
|
69
87
|
python_files = "test_*.py"
|
|
70
88
|
python_classes = "Test*"
|
|
71
89
|
python_functions = "test_*"
|
|
72
|
-
addopts = "-v"
|
|
90
|
+
addopts = "-v"
|
|
91
|
+
|
|
92
|
+
[tool.pdm.scripts]
|
|
93
|
+
format = "black ."
|
|
94
|
+
typecheck = "mypy check_msdefender/"
|
|
95
|
+
lint = "flake8 check_msdefender/"
|
|
96
|
+
build = "python -m build"
|
|
97
|
+
publish = "python -m twine upload dist/* --verbose"
|
|
98
|
+
test = "pytest -v tests/"
|
|
99
|
+
msdhelp = "check_msdefender --help"
|
|
100
|
+
msdmachines = "check_msdefender machines"
|
|
101
|
+
msdlastseen = "check_msdefender lastseen -d $MACHINE"
|
|
102
|
+
msddetail = "check_msdefender detail -d $MACHINE"
|
|
103
|
+
msdalerts = "check_msdefender alerts -d $MACHINE"
|
|
104
|
+
msdvulnerabilities = "check_msdefender vulnerabilities -d $MACHINE"
|
|
105
|
+
msdonboarding = "check_msdefender onboarding -d $MACHINE"
|
|
106
|
+
|
|
107
|
+
[tool.pdm.scripts.all]
|
|
108
|
+
composite = [
|
|
109
|
+
"format",
|
|
110
|
+
"build",
|
|
111
|
+
"test",
|
|
112
|
+
"typecheck",
|
|
113
|
+
"lint",
|
|
114
|
+
]
|
|
115
|
+
|
|
116
|
+
[tool.pdm.scripts.msdall]
|
|
117
|
+
composite = [
|
|
118
|
+
"msdhelp",
|
|
119
|
+
"msdmachines",
|
|
120
|
+
]
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"""Fixture tests for LastSeenService."""
|
|
2
2
|
|
|
3
|
-
import pytest
|
|
4
3
|
from datetime import datetime, timezone
|
|
5
4
|
from unittest.mock import patch
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
import pytest
|
|
7
|
+
|
|
8
8
|
from check_msdefender.core.exceptions import ValidationError
|
|
9
|
+
from check_msdefender.services.lastseen_service import LastSeenService
|
|
9
10
|
from tests.fixtures.mock_defender_client import MockDefenderClient
|
|
10
11
|
|
|
11
12
|
|
|
@@ -85,7 +86,6 @@ class TestLastSeenServiceFixtures:
|
|
|
85
86
|
|
|
86
87
|
def test_get_result_high_precision_microseconds_regression(self):
|
|
87
88
|
"""Test parsing timestamp with high precision microseconds - regression test."""
|
|
88
|
-
import re
|
|
89
89
|
|
|
90
90
|
# Create a mock client that returns timestamp with 7-digit microseconds
|
|
91
91
|
class MockClientHighPrecision:
|
|
@@ -397,6 +397,5 @@ class TestDetailCommand:
|
|
|
397
397
|
|
|
398
398
|
assert result.exit_code == 0
|
|
399
399
|
assert "Get detailed machine information from Microsoft Defender." in result.output
|
|
400
|
-
assert "-i, --id TEXT" in result.output
|
|
401
|
-
assert "-m, --machine-id TEXT" in result.output
|
|
400
|
+
assert "-m, -i, --machine-id, --id TEXT" in result.output
|
|
402
401
|
assert "-d, --dns-name TEXT" in result.output
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"""Unit tests for DetailService."""
|
|
2
2
|
|
|
3
|
-
import pytest
|
|
4
3
|
import json
|
|
5
|
-
from unittest.mock import Mock
|
|
4
|
+
from unittest.mock import Mock
|
|
5
|
+
|
|
6
|
+
import pytest
|
|
6
7
|
|
|
7
|
-
from check_msdefender.services.detail_service import DetailService
|
|
8
8
|
from check_msdefender.core.exceptions import ValidationError
|
|
9
|
+
from check_msdefender.services.detail_service import DetailService
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
class TestDetailService:
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"permissions": {
|
|
3
|
-
"allow": [
|
|
4
|
-
"Bash(mkdir:*)",
|
|
5
|
-
"Bash(python -m check_msdefender:*)",
|
|
6
|
-
"Bash(python.exe -m check_msdefender:*)",
|
|
7
|
-
"Bash(check_msdefender:*)",
|
|
8
|
-
"Bash(pip install:*)",
|
|
9
|
-
"Bash(pytest:*)",
|
|
10
|
-
"Bash(python:*)",
|
|
11
|
-
"Bash(find:*)",
|
|
12
|
-
"Bash(echo \"Exit code: $?\")",
|
|
13
|
-
"Bash(mypy:*)",
|
|
14
|
-
"Bash(black:*)"
|
|
15
|
-
],
|
|
16
|
-
"deny": [],
|
|
17
|
-
"ask": []
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
# Azure Active Directory credentials for integration testing
|
|
2
|
-
# Copy this file to .env and fill in your actual values
|
|
3
|
-
|
|
4
|
-
# Required for Microsoft Graph API authentication
|
|
5
|
-
AZURE_TENANT_ID=your-tenant-id-here
|
|
6
|
-
AZURE_CLIENT_ID=your-client-id-here
|
|
7
|
-
AZURE_CLIENT_SECRET=your-client-secret-here
|
|
8
|
-
|
|
9
|
-
# Optional: Set to 1 to run integration tests
|
|
10
|
-
RUN_INTEGRATION_TESTS=0
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
|
|
2
|
-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
|
|
3
|
-
|
|
4
|
-
name: Python package
|
|
5
|
-
|
|
6
|
-
on:
|
|
7
|
-
push:
|
|
8
|
-
branches: [ "master" ]
|
|
9
|
-
pull_request:
|
|
10
|
-
branches: [ "master" ]
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
build:
|
|
14
|
-
|
|
15
|
-
runs-on: ubuntu-latest
|
|
16
|
-
strategy:
|
|
17
|
-
fail-fast: false
|
|
18
|
-
matrix:
|
|
19
|
-
python-version: ["3.9", "3.10", "3.11"]
|
|
20
|
-
|
|
21
|
-
steps:
|
|
22
|
-
- uses: actions/checkout@v4
|
|
23
|
-
- name: Set up Python ${{ matrix.python-version }}
|
|
24
|
-
uses: actions/setup-python@v3
|
|
25
|
-
with:
|
|
26
|
-
python-version: ${{ matrix.python-version }}
|
|
27
|
-
- name: Install dependencies
|
|
28
|
-
run: |
|
|
29
|
-
python -m pip install --upgrade pip
|
|
30
|
-
python -m pip install flake8 pytest
|
|
31
|
-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
|
32
|
-
- name: Lint with flake8
|
|
33
|
-
run: |
|
|
34
|
-
# stop the build if there are Python syntax errors or undefined names
|
|
35
|
-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
|
36
|
-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
|
37
|
-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
|
38
|
-
- name: Test with pytest
|
|
39
|
-
run: |
|
|
40
|
-
pytest
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
# This workflow will upload a Python Package to PyPI when a release is created
|
|
2
|
-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
|
|
3
|
-
|
|
4
|
-
# This workflow uses actions that are not certified by GitHub.
|
|
5
|
-
# They are provided by a third-party and are governed by
|
|
6
|
-
# separate terms of service, privacy policy, and support
|
|
7
|
-
# documentation.
|
|
8
|
-
|
|
9
|
-
name: Upload Python Package
|
|
10
|
-
|
|
11
|
-
on:
|
|
12
|
-
release:
|
|
13
|
-
types: [published]
|
|
14
|
-
|
|
15
|
-
permissions:
|
|
16
|
-
contents: read
|
|
17
|
-
|
|
18
|
-
jobs:
|
|
19
|
-
release-build:
|
|
20
|
-
runs-on: ubuntu-latest
|
|
21
|
-
|
|
22
|
-
steps:
|
|
23
|
-
- uses: actions/checkout@v4
|
|
24
|
-
|
|
25
|
-
- uses: actions/setup-python@v5
|
|
26
|
-
with:
|
|
27
|
-
python-version: "3.x"
|
|
28
|
-
|
|
29
|
-
- name: Build release distributions
|
|
30
|
-
run: |
|
|
31
|
-
# NOTE: put your own distribution build steps here.
|
|
32
|
-
python -m pip install build
|
|
33
|
-
python -m build
|
|
34
|
-
|
|
35
|
-
- name: Upload distributions
|
|
36
|
-
uses: actions/upload-artifact@v4
|
|
37
|
-
with:
|
|
38
|
-
name: release-dists
|
|
39
|
-
path: dist/
|
|
40
|
-
|
|
41
|
-
pypi-publish:
|
|
42
|
-
runs-on: ubuntu-latest
|
|
43
|
-
needs:
|
|
44
|
-
- release-build
|
|
45
|
-
permissions:
|
|
46
|
-
# IMPORTANT: this permission is mandatory for trusted publishing
|
|
47
|
-
id-token: write
|
|
48
|
-
|
|
49
|
-
# Dedicated environments with protections for publishing are strongly recommended.
|
|
50
|
-
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
|
|
51
|
-
environment:
|
|
52
|
-
name: pypi
|
|
53
|
-
# OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
|
|
54
|
-
url: https://pypi.org/p/nagios-check-msdefender
|
|
55
|
-
#
|
|
56
|
-
# ALTERNATIVE: if your GitHub Release name is the PyPI project version string
|
|
57
|
-
# ALTERNATIVE: exactly, uncomment the following line instead:
|
|
58
|
-
# url: https://pypi.org/project/YOURPROJECT/${{ github.event.release.name }}
|
|
59
|
-
|
|
60
|
-
steps:
|
|
61
|
-
- name: Retrieve release distributions
|
|
62
|
-
uses: actions/download-artifact@v4
|
|
63
|
-
with:
|
|
64
|
-
name: release-dists
|
|
65
|
-
path: dist/
|
|
66
|
-
|
|
67
|
-
- name: Publish release distributions to PyPI
|
|
68
|
-
uses: pypa/gh-action-pypi-publish@release/v1
|
|
69
|
-
with:
|
|
70
|
-
packages-dir: dist/
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<module type="PYTHON_MODULE" version="4">
|
|
3
|
-
<component name="NewModuleRootManager">
|
|
4
|
-
<content url="file://$MODULE_DIR$">
|
|
5
|
-
<sourceFolder url="file://$MODULE_DIR$/check_msdefender" isTestSource="false" />
|
|
6
|
-
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
|
|
7
|
-
<excludeFolder url="file://$MODULE_DIR$/.venv" />
|
|
8
|
-
<excludeFolder url="file://$MODULE_DIR$/build" />
|
|
9
|
-
</content>
|
|
10
|
-
<orderEntry type="jdk" jdkName="Python 3.12 (check_msdefender)" jdkType="Python SDK" />
|
|
11
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
|
12
|
-
</component>
|
|
13
|
-
</module>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="Black">
|
|
4
|
-
<option name="sdkName" value="Python 3.13 (check_msdefender)" />
|
|
5
|
-
</component>
|
|
6
|
-
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12 (check_msdefender)" project-jdk-type="Python SDK" />
|
|
7
|
-
</project>
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="ProjectModuleManager">
|
|
4
|
-
<modules>
|
|
5
|
-
<module fileurl="file://$PROJECT_DIR$/.idea/check_msdefender.iml" filepath="$PROJECT_DIR$/.idea/check_msdefender.iml" />
|
|
6
|
-
</modules>
|
|
7
|
-
</component>
|
|
8
|
-
</project>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
<component name="ProjectRunConfigurationManager">
|
|
2
|
-
<configuration default="false" name="Integration Tests" type="tests" factoryName="py.test">
|
|
3
|
-
<module name="check_msdefender" />
|
|
4
|
-
<option name="INTERPRETER_OPTIONS" value="" />
|
|
5
|
-
<option name="PARENT_ENVS" value="true" />
|
|
6
|
-
<envs />
|
|
7
|
-
<option name="SDK_HOME" value="$PROJECT_DIR$/.venv/bin/python" />
|
|
8
|
-
<option name="SDK_NAME" value="Python 3.12 (check_msdefender)" />
|
|
9
|
-
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
|
10
|
-
<option name="IS_MODULE_SDK" value="false" />
|
|
11
|
-
<option name="ADD_CONTENT_ROOTS" value="true" />
|
|
12
|
-
<option name="ADD_SOURCE_ROOTS" value="true" />
|
|
13
|
-
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
|
14
|
-
<option name="SCRIPT_NAME" value="" />
|
|
15
|
-
<option name="CLASS_NAME" value="" />
|
|
16
|
-
<option name="METHOD_NAME" value="" />
|
|
17
|
-
<option name="FOLDER_NAME" value="$PROJECT_DIR$/tests/integration" />
|
|
18
|
-
<option name="TEST_TYPE" value="TEST_FOLDER" />
|
|
19
|
-
<option name="PATTERN" value="" />
|
|
20
|
-
<option name="USE_PATTERN" value="false" />
|
|
21
|
-
<method v="2" />
|
|
22
|
-
</configuration>
|
|
23
|
-
</component>
|