I'm trying to carve some files. In order to do so, I'd like to permutate all possibilites. There are 3 possible beginnings, 40 possible middle blocks and 3 possible endings.
The problem is that we don't know how long the middle block is. It could be 1 block long but also 40 blocks longs. The only thing we know for sure is that the blocks appear consecutively since it is a PNG I'm trying to recover.
I already tried hand writing the code myself with a lot of for loops, without succes so far. I did try the following code.
s= [[headersList],[idatList],[iendList]]
print(list(itertools.product(*s)))
I expect the output to be something like,
[1, [1], 1]
[1, [1,2] , 1]
[1, [1,2,3], 1]
...
[2, [1] ,1]
[2, [1, 2], 1]
And so on. The only condition is that the start and end block have to be on the corresponding beginning and ending of the array. The middle blocks have to be size 1 to max 40 in consecutive order.
Aucun commentaire:
Enregistrer un commentaire