I'm trying to find specific bytes within a file loaded as ConstBitStream:
s = ConstBitStream(filename=myFile)
found = s.find('0x4140', bytealigned=False)
This is working fine for the first occurrence. After finding the first sequence, I want to find the next one by using the find
method again but starting from an offset now:
s.bytepos = position_after_the_first_occurrence + my_offset
found = s.find('0x4140', start=s.bytepos, bytealigned=False)
This doesn't seem to work. I'm always getting the position from the first occurrence of my binary sequence.
What's wrong?
UPDATE:
(values of first found
and s.bytepos
):
found = {tuple} (54784, )
s.bytepos = {int} 6848
(values of second found
and s.bytepos
):
s.bytepos = {int} 32969
found = {tuple} (54784, )
It seems that setting start=s.bytepos
does not have any effect.