Skip to content

Commit

Permalink
#2119 issue: use bytes.fromhex instead of binascii (#2235)
Browse files Browse the repository at this point in the history
* #2119 issue: use bytes.fromhex instead of binascii

---------

Co-authored-by: Moritz <mr-tz@users.noreply.github.com>
  • Loading branch information
lakshayletsgo and mr-tz committed Aug 9, 2024
1 parent ea9853e commit 87f6916
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions capa/rules/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import re
import copy
import uuid
import codecs
import logging
import binascii
import collections
Expand Down Expand Up @@ -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}"')

Expand Down

0 comments on commit 87f6916

Please sign in to comment.