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:
0x81FB4300000090
0x69FC4300000090
0x81FC4300000090
0x69FD4300000090
0x81FD4300000090
0x69FE4300000090
0x81FE4300000090
0x69FF4300000090
0x81FF4300000090
0x00054400000090
0x01054400000090
0x02054400000090
0x03054400000090
0x08054400000090
0x09054400000090
0x0A054400000090
0x0B054400000090
0x10054400000090
0x11054400000090
0x12054400000090
0x13054400000090
0x18054400000090
0x19054400000090
0x1A054400000090
0x1B054400000090
0x20054400000090
0x21054400000090
0x22054400000090
0x23054400000090
0x28054400000090
0x29054400000090
0x2A054400000090
0x2B054400000090
0x30054400000090
0x31054400000090
0x32054400000090
0x33054400000090
0x38054400000090
0x39054400000090
0x3A054400000090
0x3B054400000090
0x40054400000090
0x41054400000090
0x42054400000090
0x43054400000090
0x44054400000090
0x45054400000090
0x46054400000090
0x47054400000090
0x81FB4300000090
0x69FC4300000090
0x81FC4300000090
0x69FD4300000090
0x81FD4300000090
0x69FE4300000090
0x81FE4300000090
0x69FF4300000090
0x81FF4300000090
0x00054400000090
0x01054400000090
0x02054400000090
0x03054400000090
0x08054400000090
0x09054400000090
0x0A054400000090
0x0B054400000090
0x10054400000090
0x11054400000090
0x12054400000090
0x13054400000090
0x18054400000090
0x19054400000090
0x1A054400000090
0x1B054400000090
0x20054400000090
0x21054400000090
0x22054400000090
0x23054400000090
0x28054400000090
0x29054400000090
0x2A054400000090
0x2B054400000090
0x30054400000090
0x31054400000090
0x32054400000090
0x33054400000090
0x38054400000090
0x39054400000090
0x3A054400000090
0x3B054400000090
0x40054400000090
0x41054400000090
0x42054400000090
0x43054400000090
0x44054400000090
0x45054400000090
0x46054400000090
0x47054400000090
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
Enthernet Code
Enthernet Code3mo ago
@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
while read -r line; do
echo "$line" | xxd -r -p > tmp.bin
objdump -b binary -m i386 -D tmp.bin | grep -v 'loopne'
done < input_file
while read -r line; do
echo "$line" | xxd -r -p > tmp.bin
objdump -b binary -m i386 -D tmp.bin | grep -v 'loopne'
done < input_file
Marvee Amasi
Marvee Amasi2mo ago
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?
Want results from more Discord servers?
Add your server