Rating:
Given binary have a lot of "X"'s in it. In order to find correct binary, combine fragments data and replace with those X's.
Bruteforcing all options.
```import itertools
f = open("broken")
brokendata = f.read()
f.close()
head = 0x5ad
tail = 0x8d4
brokenhead = brokendata[0:head]
mid = brokendata[head:tail]
brokentail = brokendata[tail:]
fragments = []
for i in range(1,9):
s = "fragment_" + str(i) + ".dat"
print "Reading " + s
t = open(s,"r")
data = t.read()
fragments.append(data)
t.close()
print fragments
x = [1,2,3,4,5,6,7,8]
perms = list(itertools.permutations(x,8))
print "Perms created size : " + str(len(perms))
dat = ""
c = 0
for idx,i in enumerate(perms):
dat = brokenhead
for k in i:
dat += fragments[k-1]
dat += brokentail
j = open("bin_"+str(c),"w")
j.write(dat)
j.close()
c += 1
if(c%100):
print "bin_" + str(c) +" created"
"""
bash script to run all of them , correct binary is 39690 so it will take time
for i in {1..40260}
do
NAME="bin_$i"
./$NAME
done
"""
```
prints : ```welc00me```