[nullhaven]
All challenges
Reversing★★★★★400 pts

Write a tiny emulator

Godmode · 1d ago · 1 solved

A licence checker does not compare strings. It runs a bytecode program on a stack machine and prints the expected key, one byte at a time. The whole instruction set fits in one table:
text
opcode  mnemonic   effect
------  ---------  --------------------------------------------
0x01    PUSH imm   push the next byte
0x02    POP        discard the top of the stack
0x03    XOR        pop b, pop a, push a ^ b
0x04    ADD imm    pop a, push (a + imm) mod 256
0x05    PRINT      pop a, print chr(a)
0x06    IDX        push the number of characters printed so far
0xff    HALT       stop

The program:
r
00000000  01 6e 06 03 05 01 74 06  03 05 01 6e 06 03 05 01  |.n....t....n....|
00000010  6f 06 03 05 01 6c 06 03  05 01 64 06 03 05 01 70  |o....l....d....p|
00000020  06 03 05 01 62 06 03 05  01 66 06 03 05 01 72 06  |....b....f....r.|
00000030  03 05 01 7d 06 03 05 01  79 06 03 05 01 65 06 03  |...}....y....e..|
00000040  05 01 79 06 03 05 01 6b  06 03 05 01 50 06 03 05  |..y....k....P...|
00000050  01 71 06 03 05 01 4e 06  03 05 01 66 06 03 05 01  |.q....N....f....|
00000060  7a 06 03 05 01 7a 06 03  05 01 6c 06 03 05 01 49  |z....z....l....I|
00000070  06 03 05 01 72 06 03 05  01 75 06 03 05 01 6c 06  |....r....u....l.|
00000080  03 05 01 76 06 03 05 01  7a 06 03 05 01 68 06 03  |...v....z....h..|
00000090  05 01 72 06 03 05 01 6c  06 03 05 01 62 06 03 05  |..r....l....b...|
000000a0  ff                                                |.|

Run it (in your head, in Python, or in the emulator you are about to write) and read what it prints. Reading the immediates straight out of the dump gives you nothing but noise.

Submitting a flag needs an account

That's what records your points and lets you claim the first blood under your name.

Free, no e-mail verification. You land back on this challenge.

Solved by · 1

  1. 1
    JE
    Jetboy01 First blood1d ago