Окей (Okay)
Окей (Okay)
Platform: CUSTOM | Category: Crypto | Type: Challenge | Difficulty: Easy | OS: N/A | **Author: XESXOR Techniques: Brainfuck interpretation/execution, Esoteric programming language identification from task name hint, Ook! to Brainfuck conversion
Summary
Walkthrough of the CUSTOM Crypto Окей (Okay). Task: decode a file containing a repeating Russian word with punctuation into a readable flag. Solution: recognize the Ook! esoteric language (hinted by task name "Okay"), replace "Хорошо" with "Ook",
Description
У вас всё хорошо? Точно? А шифр знаете? (Are you okay? Sure? Do you know the cipher?)
Files: task.zip -> task.txt
Analysis
-
Task name - "Окей" (Okay/OK) - key hint pointing to the Ook! esoteric language
-
Contents of task.txt - the word "Хорошо" (Russian for "OK/Good") with different punctuation marks (
.,!,?), separated by double spaces -
Ook! - a Brainfuck derivative where commands are encoded as pairs of "Ook" with punctuation:
| Ook! | Brainfuck | Description |
|---|---|---|
Ook. Ook. | + | Increment cell |
Ook! Ook! | - | Decrement cell |
Ook. Ook? | > | Move pointer right |
Ook? Ook. | < | Move pointer left |
Ook! Ook? | [ | Loop start |
Ook? Ook! | ] | Loop end |
Ook! Ook. | . | Output character |
Ook. Ook! | , | Input character |
Solution
Step 1: Convert "Хорошо" to "Ook"
python read-only • copy allowed#!/usr/bin/env python3 # Read the file with open('task.txt', 'r', encoding='utf-8') as f: content = f.read() # Replace "Хорошо" with "Ook" ook_code = content.replace('Хорошо', 'Ook') print("Ook! code:") print(ook_code[:200] + "...")
Step 2: Convert Ook! to Brainfuck
python read-only • copy alloweddef ook_to_brainfuck(ook_code): """Converts Ook! code to Brainfuck""" # Split into tokens tokens = ook_code.split() # Mapping of Ook pairs to Brainfuck mapping = { ('Ook.', 'Ook.'): '+', ('Ook!', 'Ook!'): '-', ('Ook.', 'Ook?'): '>', ('Ook?', 'Ook.'): '<', ('Ook!', 'Ook?'): '[', ('Ook?', 'Ook!'): ']', ('Ook!', 'Ook.'): '.', ('Ook.', 'Ook!'): ',', } bf_code = [] for i in range(0, len(tokens), 2): if i + 1 < len(tokens): pair = (tokens[i], tokens[i+1]) if pair in mapping: bf_code.append(mapping[pair]) return ''.join(bf_code) bf_code = ook_to_brainfuck(ook_code) print(f"Brainfuck: {bf_code}")
Step 3: Interpret Brainfuck
python read-only • copy alloweddef brainfuck_interpret(code): """Simple Brainfuck interpreter""" tape = [0] * 30000 ptr = 0 output = [] code_ptr = 0 # Pre-compute bracket positions brackets = {} stack = [] for i, c in enumerate(code): if c == '[': stack.append(i) elif c == ']': if stack: j = stack.pop() brackets[j] = i brackets[i] = j while code_ptr < len(code): cmd = code[code_ptr] if cmd == '+': tape[ptr] = (tape[ptr] + 1) % 256 elif cmd == '-': tape[ptr] = (tape[ptr] - 1) % 256 elif cmd == '>': ptr += 1 elif cmd == '<': ptr -= 1 elif cmd == '.': output.append(chr(tape[ptr])) elif cmd == ',': pass # No input elif cmd == '[': if tape[ptr] == 0: code_ptr = brackets[code_ptr] elif cmd == ']': if tape[ptr] != 0: code_ptr = brackets[code_ptr] code_ptr += 1 return ''.join(output) result = brainfuck_interpret(bf_code) print(f"Flag: {result}")
Complete Solution Script
python read-only • copy allowed#!/usr/bin/env python3 """ Solution for "Окей" (Okay) task - hackerlab Ook! esoteric language with Russian substitution "Хорошо" instead of "Ook" """ def ook_to_brainfuck(ook_code): tokens = ook_code.split() mapping = { ('Ook.', 'Ook.'): '+', ('Ook!', 'Ook!'): '-', ('Ook.', 'Ook?'): '>', ('Ook?', 'Ook.'): '<', ('Ook!', 'Ook?'): '[', ('Ook?', 'Ook!'): ']', ('Ook!', 'Ook.'): '.', ('Ook.', 'Ook!'): ',', } bf = [] for i in range(0, len(tokens), 2): if i + 1 < len(tokens): pair = (tokens[i], tokens[i+1]) if pair in mapping: bf.append(mapping[pair]) return ''.join(bf) def brainfuck_run(code): tape = [0] * 30000 ptr = 0 output = [] cp = 0 brackets = {} stack = [] for i, c in enumerate(code): if c == '[': stack.append(i) elif c == ']' and stack: j = stack.pop() brackets[j] = i brackets[i] = j while cp < len(code): c = code[cp] if c == '+': tape[ptr] = (tape[ptr] + 1) % 256 elif c == '-': tape[ptr] = (tape[ptr] - 1) % 256 elif c == '>': ptr += 1 elif c == '<': ptr -= 1 elif c == '.': output.append(chr(tape[ptr])) elif c == '[' and tape[ptr] == 0: cp = brackets[cp] elif c == ']' and tape[ptr] != 0: cp = brackets[cp] cp += 1 return ''.join(output) # Read and decode with open('task.txt', 'r', encoding='utf-8') as f: content = f.read() ook_code = content.replace('Хорошо', 'Ook') bf_code = ook_to_brainfuck(ook_code) flag = brainfuck_run(bf_code) print(f"Flag: {flag}")
Alternative Solution
You can use the online decoder at dcode.fr:
- Replace "Хорошо" with "Ook" in the text
- Paste into the Ook! decoder
- Get the flag
Related Techniques
- Brainfuck - base esoteric language
- Ook! - Brainfuck with "Ook" instead of symbols
- Other Brainfuck derivatives: Spoon, COW, Whitespace
Key Takeaways / Lessons
- Mastering Brainfuck interpretation/execution, Esoteric programming language identification from task name hint, Ook! to Brainfuck conversion was key to this challenge.
- Always check for common misconfigurations and verify assumptions.
Crafted by XESXOR Research • 2025-12-30 • CUSTOM • Окей (Okay) • Difficulty: Easy