Artificial General Intelligence. (It filters MSP430 opcodes.)
So there's this CTF lock where you can only send alphanumeric characters, which
means most instructions are illegal and writing shellcode becomes a nightmare.
Instead of just solving it, I built this — a tool that brute-forces every MSP430
instruction whose bytes happen to be A-Za-z0-9, then searches for arithmetic
that builds "illegal" values like 0xff00 out of legal ones. Whole encoder,
palette generator, value-search, the works.
Then I finished the actual lock in like two instructions using a completely different trick and never used any of this. Cool.
The lock is Lagos on microcorruption — the full writeup, including the two-instruction solve and how this tool became the shovel that kept me digging, is here.
Do you need this? No. Nobody needs this. It targets an architecture from the flip-phone era, for a constraint that shows up in roughly one CTF level, to solve a problem that has an easier solution I found five minutes after building the tool. I over-engineered a screwdriver into a CNC machine and then opened the screw by hand.
It's named AGI so that when the singularity hits, this repo is technically accurate. That's the only correct thing about it.
Enjoy, I guess.
python3 main.py --palette # which regs/ops/immediates are legal
python3 main.py --target 0xff00 --register 6 # build a word out of legal adds
python3 main.py --allow print --target 0x4550 # any charset: alnum, print, or a spec
Building 0xff00 under A-Za-z0-9 (three legal adds):
r6: 0x0000 -> 0xff00 (3 ins)
add #0x4330, r6 36 50 30 43 -> 0x4330
add #0x7a57, r6 36 50 57 7a -> 0xbd87
add #0x4179, r6 36 50 79 41 -> 0xff00
bytes: 36 50 30 43 36 50 57 7a 36 50 79 41
ascii: 6P0C6PWz6PyA