| tags:GitS2014 GitS WriteUp

# GitS 2014: lugkist (Trivia 150)

We got a list of 63 6-character lines, containing a limited set of uppercase ascii-characters. After some time we found out that these matches the cheat-commands of the GameGenie cheat-hardware. Basically it encodes an address and some data which shall be written to this address. The following decoder gives you the flag:

```
import operator
a = open('lugkist').read().strip().split('\n')
a = a[2:] # strip first two lines
t = {}
for k, v in enumerate('APZLGITYEOXUKSVN'): # GameGenie character-map
t[v] = k
res = {}
for n in a:
address = ((t[n[3]] & 7) << 12) | ((t[n[5]] & 7) << 8) | ((t[n[4]] & 8) << 8) | ((t[n[2]] & 7) << 4) | ((t[n[1]] & 8) << 4) | (t[n[4]] & 7) | (t[n[3]] & 8)
data = ((t[n[1]] & 7) << 4) | ((t[n[0]] & 8) << 4) | (t[n[0]] & 7) | (t[n[5]] & 8)
res[address] = hex(data)[2:].decode('hex')
plain = ''
for k, v in sorted(res.iteritems(), key=operator.itemgetter(0)): # sort by address
plain += v
print plain
```

Flag: Power overwhelming? Back in my day cheats did not have spaces.

by ccmndhd and nsr