INNER CODE UNIT · Python
get_hexdump
FuzzingLabs/mcp-security-hub · binary-analysis/binwalk-mcp/server.py:268
async def get_hexdump(
filepath: str,
offset: int = 0,
length: int = 256,
) -> str:
"""Get hexdump of file section."""
cmd = ["xxd", "-s", str(offset), "-l", str(length), filepath]
try:
process = await asyncio.create_subprocess_exec(
*cmd,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
)
stdout, _ = await asyncio.wait_for(
process.communicate(),
timeout=30.0,