Tags: befuddled misc
Rating:
solver: Pr0f3550rZak
writeup-writer: L3d
Author: doubledelete
Description:
ok, that one mighta been a little too easy >.<
files (copy): befunge.py, challenge.py
In this challenge we receive a befunge compiler, with the Flag in the top of the stack.
We need to write befunge code under some restrictions, and get the flag.
Before starting to tackle this challenge, we need to know firstly what is Befunge.
Befunge is a two-dimensional esoteric programming language invented in 1993 by Chris Pressey with the goal of being as difficult to compile as possible. The code is laid out on a two-dimensional grid of instructions, and execution can proceed in any direction of that grid - we can see this being implemented in the source file.[1]
This channel has the same source, with minor restriction changes:
This means our old solution is now invalid. Instead we can craft the following program:
0_0..1_
This program iterates and prints the ascii values of the flag. Lets break it down:
0
- pushes 0 to the stack.
1
- pushes 1 to the stack.
_
- pops a value and changes the way the program will continue to move: set direction to right if value=0, set to left otherwise.
.
- Pop top of stack and output as integer.
The program flow will move back and fourth, while printing 2 character of the flag each time (and occasionally 0). I will leave the actuall execution flow of the program as an exercise to the reader (hehe!), since it's fairly simple, and it's late already here.
Anyhow, we get the flag?!
wctf{4_0n3_l1n3_turn_0f_3v3nt5}
To the next one ➡️