I'm working on a static code injector for ELF files. I need to "steal" some bytes in order to write jump to my code on their place and then execute stolen instructions somewhere in the payload. However I don't know how to automate it. I will need to steal at least 5 bytes for my jump instruction, but obviously not always 5 bytes equal to the whole number of instructions, so I might have to
nop several bytes.
What are the ways to distinguish instructions, given bytes in ELF binary( C/C++ preferably ) ?