Tags: rev 

Rating: 3.0


```py
import base64

s = []

for i in range(1337):

with open(f'file_{i}', 'rb') as f:
l = f.read()

s.append(l[0x4020:0x4020+39].decode())
f.close()

l = [('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB', 'AAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAA'), ('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA', 'AAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA'), ('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAA', 'AAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAA'), ('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAA', 'AAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'), ('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAA', 'AAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'), ('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAA', 'AAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'), ('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAA', 'AABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'), ('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAA', 'BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'), ('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAA', 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB'), ('AAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAA', 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAA'), ('AAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAA', 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAA'), ('AAAAAAAAAAAAA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AAAAAAAAAAA'), ('AABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAA'), ('ABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', 'AAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAA'), ('BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', 'AAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAA')]

d = []

for a,b in l:
d.append((a.index('B'), b.index('B')))

x = b''

for t in s:
w = [''] * 39
for a,b in d:
w[a] = t[b]
x += ''.join(w).encode()

x += b'=='

with open('file.pdf', 'wb') as f:
f.write(base64.b64decode(x))
```

# file.pdf

![PDF](./file.png)

# FLAG

**`vsctf{templated_binaries_are_1337}`**

Original writeup (https://github.com/acdwas/ctf/tree/master/2022/vsCTF%202022/rev/Binary%20Flood).