Replace binascii and struct with native Python methods (#2582)

* refactor: replace binascii with bytes for hex conversions

Signed-off-by: vibhatsu <maulikbarot2915@gmail.com>

* refactor: replace struct unpacking with bytes conversion

Signed-off-by: vibhatsu <maulikbarot2915@gmail.com>

* simplify byte extraction for ELF header

Signed-off-by: vibhatsu <maulikbarot2915@gmail.com>

* Revert "refactor: replace struct unpacking with bytes conversion"

This reverts commit 483f8c9a85.

* update CHANGELOG

Signed-off-by: vibhatsu <maulikbarot2915@gmail.com>

---------

Signed-off-by: vibhatsu <maulikbarot2915@gmail.com>
Co-authored-by: Willi Ballenthin <wballenthin@google.com>
This commit is contained in:
vibhatsu
2025-02-04 14:23:36 +05:30
committed by GitHub
parent 96f9e7cffc
commit a8e8935212
7 changed files with 11 additions and 16 deletions

View File

@@ -36,7 +36,6 @@ Check the output window for any errors, and/or the summary of changes.
"""
import logging
import binascii
from pathlib import Path
import ida_nalt
@@ -85,7 +84,7 @@ def main():
#
# see: https://github.com/idapython/bin/issues/11
a = meta.sample.md5.lower()
b = binascii.hexlify(ida_nalt.retrieve_input_file_md5()).decode("ascii").lower()
b = bytes.hex(ida_nalt.retrieve_input_file_md5()).lower()
if not a.startswith(b):
logger.error("sample mismatch")
return -2