From 87f691677cb42da51f3baae8b3d6088ac762c0e8 Mon Sep 17 00:00:00 2001 From: lakshay Date: Fri, 9 Aug 2024 15:55:25 +0530 Subject: [PATCH] #2119 issue: use bytes.fromhex instead of binascii (#2235) * #2119 issue: use bytes.fromhex instead of binascii --------- Co-authored-by: Moritz --- capa/rules/__init__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/capa/rules/__init__.py b/capa/rules/__init__.py index e2f0a8102..5f567ea10 100644 --- a/capa/rules/__init__.py +++ b/capa/rules/__init__.py @@ -11,7 +11,6 @@ import re import copy import uuid -import codecs import logging import binascii import collections @@ -456,7 +455,7 @@ def parse_feature(key: str): def parse_bytes(s: str) -> bytes: try: - b = codecs.decode(s.replace(" ", "").encode("ascii"), "hex") + b = bytes.fromhex(s.replace(" ", "")) except binascii.Error: raise InvalidRule(f'unexpected bytes value: must be a valid hex sequence: "{s}"')