I would like to read some bits in an elf file in Python. I have found an elf file parser which locates the section. I looked into using seek to read, but the data read out are in bytes.
For example: in the desired section in my elf file I have 20 14 52 10 01 DA 1E 98 00 CD EF 0F 00 00 00 00
in hex, and I need to read bits 0-3, 4-6, 26-27
.
What would be the best approach for this? I could convert the entire section from hex to binary, and iterate through it, but it just seems like a lot of work especially since some sections are super long. Thanks so much in advance!