From 6e334c7b026f96d85e8b7e92f3bfb90d24394f18 Mon Sep 17 00:00:00 2001 From: MatrixEditor <58256046+MatrixEditor@users.noreply.github.com> Date: Sat, 8 Aug 2026 16:36:55 +0200 Subject: [PATCH 1/2] fix: add missing logger to WinRM handler --- dementor/protocols/http.py | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/dementor/protocols/http.py b/dementor/protocols/http.py index 66dab5b..92e16bb 100644 --- a/dementor/protocols/http.py +++ b/dementor/protocols/http.py @@ -74,7 +74,9 @@ class ProxyAutoConfig(TomlConfig): if typing.TYPE_CHECKING: proxy_script: str | None - def set_proxy_script(self, script: str | None) -> None: + def set_proxy_script( + self, script: str | dict[str, dict[str, str]] | object | None + ) -> None: self.proxy_script = None match script: case str(): @@ -94,11 +96,15 @@ def set_proxy_script(self, script: str | None) -> None: path = pathlib.Path(script["file"]) if not path.exists() or not path.is_file(): - dm_logger.error(f"WPAD script at {path} does not exist - ignoring...") + dm_logger.error( + f"WPAD script at {path} does not exist - ignoring..." + ) return if not path.is_file(): - dm_logger.error(f"WPAD script at {path} is not a file - ignoring...") + dm_logger.error( + f"WPAD script at {path} is not a file - ignoring..." + ) return self.proxy_script = path.read_text() @@ -276,10 +282,10 @@ def __init__( client_address: tuple[str, int], server, ) -> None: - self.config = session - self.server_config = server_config + self.config: SessionConfig = session + self.server_config: HTTPServerConfig = server_config self.client_address = client_address - self.challenge = None + self.challenge: bytes | None = None self.setup_proto_logger() for http_method in server_config.http_methods: if http_method in ("OPTIONS", "PROPFIND"): @@ -335,7 +341,9 @@ def version_string(self) -> str: def log_message(self, format: str, *args) -> None: # let us log mssages text = format % args - msg = text.translate(self._control_char_table) # ty:ignore[unresolved-attribute] + msg = text.translate( + self._control_char_table + ) # ty:ignore[unresolved-attribute] self.logger.debug(msg) def send_response(self, code: int, message: str | None = None) -> None: @@ -506,7 +514,9 @@ def auth_ntlm( case _: logger.fail(f"Invalid negotiate authentication: {token}") - self.send_error(HTTPStatus.INTERNAL_SERVER_ERROR, "Internal Server Error") + self.send_error( + HTTPStatus.INTERNAL_SERVER_ERROR, "Internal Server Error" + ) def auth_bearer(self, token: str, logger: "ProtocolLogger") -> None: self.display_request("Bearer", logger) @@ -565,6 +575,7 @@ def get_extras(self) -> dict[str, str]: class WinRMHandler(HTTPHandler): def setup_proto_logger(self) -> None: + super().setup_proto_logger() self.logger = ProtocolLogger( extra={ "protocol": "WinRM", From ff3001148808e2b80e99abf8f302a172207fc698 Mon Sep 17 00:00:00 2001 From: MatrixEditor <58256046+MatrixEditor@users.noreply.github.com> Date: Sat, 8 Aug 2026 16:42:06 +0200 Subject: [PATCH 2/2] chore: bump version to 1.0.0.dev24 --- dementor/__init__.py | 2 +- docs/source/compat.rst | 6 ++-- docs/source/conf.py | 2 +- pyproject.toml | 76 +++++++++++++++++++++--------------------- 4 files changed, 43 insertions(+), 43 deletions(-) diff --git a/dementor/__init__.py b/dementor/__init__.py index 517b407..cb07375 100644 --- a/dementor/__init__.py +++ b/dementor/__init__.py @@ -18,5 +18,5 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -__version__ = "1.0.0.dev23" +__version__ = "1.0.0.dev24" __author__ = "MatrixEditor" diff --git a/docs/source/compat.rst b/docs/source/compat.rst index 62964a3..09cb305 100644 --- a/docs/source/compat.rst +++ b/docs/source/compat.rst @@ -27,7 +27,7 @@ in development. The legend for each symbol is as follows: Supported Protocols Responder (3.2.2.0) - Dementor (1.0.0.dev22) + Dementor (1.0.0.dev24) @@ -775,7 +775,7 @@ in development. The legend for each symbol is as follows: Feature Responder (3.2.2.0) - Dementor (1.0.0.dev22) + Dementor (1.0.0.dev22+) @@ -813,7 +813,7 @@ in development. The legend for each symbol is as follows: Feature Responder (3.2.2.0) - Dementor (1.0.0.dev22) + Dementor (1.0.0.dev22+) diff --git a/docs/source/conf.py b/docs/source/conf.py index ea3283b..fa11717 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -9,7 +9,7 @@ project = "Dementor" copyright = "2025-Present, MatrixEditor" author = "MatrixEditor" -release = "1.0.0.dev23" +release = "1.0.0.dev24" # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration diff --git a/pyproject.toml b/pyproject.toml index a744b07..e44b864 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "dementor" -version = "1.0.0.dev23" +version = "1.0.0.dev24" # REVISIT: dynamic version # dynamic = ["version"] description = "LLMNR/NBT-NS/mDNS Poisoner and rogue service provider" @@ -96,104 +96,104 @@ src = ["dementor", "tests"] select = ["ALL"] ignore = [ # --- A: flake8-builtins --- - "A001", # builtin-variable-shadowing -- unavoidable in Sphinx conf.py (copyright) - "A002", # builtin-argument-shadowing -- common in protocol code (type, id) + "A001", # builtin-variable-shadowing + "A002", # builtin-argument-shadowing - # --- ANN: flake8-annotations -- use ty for gradual typing --- + # --- ANN: flake8-annotations "ANN", # --- ARG: flake8-unused-arguments --- - "ARG001", # unused-function-argument -- CLI/callback params required by framework - "ARG002", # unused-method-argument -- interface/callback stubs + "ARG001", # unused-function-argument + "ARG002", # unused-method-argument # --- ASYNC: flake8-async --- - "ASYNC240", # blocking-path-method-in-async -- startup-time checks, not hot path + "ASYNC240", # blocking-path-method-in-async # --- BLE: flake8-blind-except --- - "BLE001", # blind-except -- legitimate in protocol handlers + "BLE001", # blind-except # --- C90: mccabe --- - "C901", # complex-structure -- protocol handlers are inherently complex + "C901", # complex-structure # --- COM: flake8-commas --- - "COM812", # missing-trailing-comma -- conflicts with formatter + "COM812", # missing-trailing-comma # --- D: pydocstyle --- "D100", "D101", "D102", "D103", "D104", "D105", "D107", # missing docstrings "D203", # conflicts with D211 "D212", # conflicts with D213 (must pick one) "D213", # conflicts with D212 (must pick one) - "D401", # non-imperative-mood -- too opinionated + "D401", # non-imperative-mood # --- E: pycodestyle --- - "E501", # line-too-long -- formatter handles what it can + "E501", # line-too-long # --- EM: flake8-errmsg --- - "EM101", # raw-string-in-exception -- too pedantic - "EM102", # f-string-in-exception -- too pedantic + "EM101", # raw-string-in-exception + "EM102", # f-string-in-exception # --- ERA: eradicate --- "ERA001", # REVISIT notes, protocol reference tables, placeholders # --- EXE: flake8-executable --- - "EXE002", # shebang-missing-executable-file -- not relevant + "EXE002", # shebang-missing-executable-file # --- FBT: flake8-boolean-trap --- - "FBT", # too strict for config-heavy protocol code + "FBT", # --- FIX: flake8-fixme --- - "FIX002", # line-contains-todo -- TODOs are intentional + "FIX002", # line-contains-todo # --- G: flake8-logging-format --- - "G004", # logging-f-string -- f-strings in logging are fine + "G004", # logging-f-string # --- I: isort --- - "I001", # unsorted-imports -- custom import grouping + "I001", # unsorted-imports # --- INP: flake8-no-pep420 --- - "INP001", # standalone script directories don't need __init__.py + "INP001", # --- ISC: flake8-implicit-str-concat --- - "ISC003", # explicit-string-concatenation -- often more readable + "ISC003", # explicit-string-concatenation # --- N: pep8-naming --- "N801", "N802", "N803", "N806", # protocol code uses non-standard names "N811", "N812", "N815", "N817", # import/variable naming conventions - "N818", # error-suffix -- control-flow exceptions are idiomatic + "N818", # error-suffix # --- PL: Pylint --- - "PLR0912", # too-many-branches -- protocol handlers - "PLR0913", # too-many-arguments -- protocol constructors - "PLR0915", # too-many-statements -- protocol handlers - "PLR2004", # magic-value-comparison -- protocol numeric constants + "PLR0912", # too-many-branches + "PLR0913", # too-many-arguments + "PLR0915", # too-many-statements + "PLR2004", # magic-value-comparison # --- PTH: flake8-use-pathlib --- - "PTH", # os.path -> pathlib -- low priority + "PTH", # os.path -> pathlib # --- RET: flake8-return --- - "RET503", # implicit-return -- idiomatic Python + "RET503", # implicit-return # --- RUF: Ruff-specific rules --- - "RUF003", # ambiguous-unicode-character-comment -- intentional - "RUF012", # mutable-class-default -- false positives with struct-like patterns + "RUF003", # ambiguous-unicode-character-comment + "RUF012", # mutable-class-default # --- S: flake8-bandit --- - "S101", # assert -- valid in non-production paths - "S104", # hardcoded-bind-all-interfaces -- intentional for network tool - "S311", # suspicious-non-cryptographic-random -- not used for crypto + "S101", # assert + "S104", # hardcoded-bind-all-interfaces + "S311", # suspicious-non-cryptographic-random # --- SLF: flake8-self --- - "SLF001", # private-member-access -- common in internal wiring + "SLF001", # private-member-access # --- T20: flake8-print --- - "T201", # print -- intentional in CLI/diagnostic code + "T201", # print # --- TD: flake8-todos --- - "TD002", # missing-todo-author -- not needed for small team - "TD003", # missing-todo-link -- not needed for small team + "TD002", # missing-todo-author + "TD003", # missing-todo-link # --- TRY: tryceratops --- - "TRY003", # raise-vanilla-args -- too pedantic + "TRY003", # raise-vanilla-args ] [tool.ruff.format]