diff --git a/pwndbg/commands/heap.py b/pwndbg/commands/heap.py index 1e2c55212..d0503990a 100644 --- a/pwndbg/commands/heap.py +++ b/pwndbg/commands/heap.py @@ -1,5 +1,6 @@ import argparse import ctypes +from string import printable from typing import Dict from typing import List @@ -973,11 +974,11 @@ def vis_heap_chunks( ) -def bin_ascii(bs): - from string import printable +VALID_CHARS = list(map(ord, set(printable) - set("\t\r\n\x0c\x0b"))) + - valid_chars = list(map(ord, set(printable) - set("\t\r\n\x0c\x0b"))) - return "".join(chr(c) if c in valid_chars else "." for c in bs) +def bin_ascii(bs): + return "".join(chr(c) if c in VALID_CHARS else "." for c in bs) def bin_labels_mapping(collections):