How to Disassemble and Filter Out Static Jumps in Program Output with Bash
My program outputs encoded instructions, and each line represents an independent set of instructions, like this:
So each line consists of 7 bytes of encoded instructions, and I need to disassemble each of them separately as distinct programs. I can also output the binary directly, and in that case, each 7 byte block of instructions must be disassembled individually.
In the bash script that runs my program, I want to filter out lines that contain static jumps. I want to:
1. Disassemble each instruction set from the program output.
2. Use a command like
grep
to filter out lines containing certain instructions, like loopne
.
I tried using objdump
, but it doesn't accept /dev/stdin
as an input file.
How can I disassemble each line of 7 byte instructions separately from stdin
and filter out the ones containing static jumps ?2 Replies
@Marvee Amasi To disassemble each
7-byte
instruction set and filter out lines containing static jumps like loopne
, Disassemble 7-byte
blocks, You can use echo
or xxd
to format the output of your program into binary files for disassembly. Instead of /dev/stdin
, use temporary binary files for disassembly with objdump
.
For instance save each 7-byte
line into a temporary binary file
and disassemble
I tested the approach with temporary binary files, and it works well for processing individual lines. See the thing here that since I’m working with large data sets, I’m concerned about the performance overhead of creating and deleting temporary files for each 7-byte block. Do you think there's a way to optimize this process, perhaps by piping the binary data directly to objdump without using temp files? Or should I consider using another disassembler that can handle this more efficiently from stdin?