MCPcopy Index your code
hub / github.com/mitmproxy/mitmproxy / hexdump

Function hexdump

mitmproxy/utils/strutils.py:185–200  ·  view source on GitHub ↗

Returns: A generator of (offset, hex, str) tuples

(s)

Source from the content-addressed store, hash-verified

183
184
185def hexdump(s):
186 """
187 Returns:
188 A generator of (offset, hex, str) tuples
189 """
190 for i in range(0, len(s), 16):
191 offset = f"{i:0=10x}"
192 part = s[i : i + 16]
193 x = " ".join(f"{i:0=2x}" for i in part)
194 x = x.ljust(47) # 16*2 + 15
195 part_repr = always_str(
196 escape_control_characters(
197 part.decode("ascii", "replace").replace("\ufffd", "."), False
198 )
199 )
200 yield (offset, x, part_repr)
201
202
203def _move_to_private_code_plane(matchobj):

Callers

nothing calls this directly

Calls 5

always_strFunction · 0.85
joinMethod · 0.45
replaceMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…