From f9df8f0a5caf1dd2bcaaed0b0e467f1b985e17c1 Mon Sep 17 00:00:00 2001 From: Willi Ballenthin Date: Wed, 22 Apr 2026 19:59:23 +0300 Subject: [PATCH] fix: remove dead find_process function and helpers.py from cape extractor helpers.py contained only find_process, which was never called anywhere in the codebase. Its signature used dict-style field access while the rest of the cape extractor migrated to Pydantic models, so calling it today would raise a TypeError. --- CHANGELOG.md | 1 + capa/features/extractors/cape/helpers.py | 36 ------------------------ 2 files changed, 1 insertion(+), 36 deletions(-) delete mode 100644 capa/features/extractors/cape/helpers.py diff --git a/CHANGELOG.md b/CHANGELOG.md index fe5f5084..f725d121 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,7 @@ - fix: correct wrong dict key in VMRay _compute_monitor_threads assertion (used thread_id instead of process_id) @williballenthin fix: replace assert with isinstance guard in get_callee for invalid MethodSpec tokens @williballenthin - fix: replace assert with isinstance guard in get_callee for invalid MethodSpec tokens @williballenthin +- fix: remove dead find_process function and helpers.py from cape extractor @williballenthin (SURF-54) - fix: remove dead interface_extract_* stub functions from viv basicblock, function, and insn extractors @williballenthin (SURF-53) - fix: remove unused import of capa.features.extractors.strings from binexport2 intel insn.py @williballenthin (SURF-52) - fix: remove extract_file_format from FILE_HANDLERS in five extractors to prevent duplicate Format features @williballenthin (SURF-51) diff --git a/capa/features/extractors/cape/helpers.py b/capa/features/extractors/cape/helpers.py deleted file mode 100644 index 55dd4804..00000000 --- a/capa/features/extractors/cape/helpers.py +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -from typing import Any - -from capa.features.extractors.base_extractor import ProcessHandle - - -def find_process(processes: list[dict[str, Any]], ph: ProcessHandle) -> dict[str, Any]: - """ - find a specific process identified by a process handler. - - args: - processes: a list of processes extracted by CAPE - ph: handle of the sought process - - return: - a CAPE-defined dictionary for the sought process' information - """ - - for process in processes: - if ph.address.ppid == process["parent_id"] and ph.address.pid == process["process_id"]: - return process - return {}