Marvee Amasi
Marvee Amasi
DIIDevHeads IoT Integration Server
Created by Marvee Amasi on 10/3/2024 in #code-review
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 ?
3 replies