Lovescript
Lovescript
Platform: hackerlab | Category: Misc | Type: Challenge | Difficulty: Easy | OS: Linux | Author: XESXOR | Date: 2025-12-23 | Status: Solved Techniques: ASCII code extraction from source code, Esoteric language identification, Pattern-based data extraction
Summary
Task: Esoteric Lovescript code with flag hidden in ASCII codes within if conditions. Solution: Extract numbers from if (vN == NUMBER) patterns and convert ASCII codes to characters.
Lovescript — hackerlab.pro
Description
Любовь настолько сильна, что может создать даже язык программирования! Флаг спрятан где-то в коде. Как и саму любовь, иногда не нужно что-то понимать ^_^
Translation: "Love is so strong that it can even create a programming language! The flag is hidden somewhere in the code. Like love itself, sometimes you don't need to understand something ^_^"
Files:
task.txt— code in the esoteric language Lovescriptfor_you.png— PNG image (not needed for the solution)
Analysis
Language Identification
The description directly hints at a programming language created "out of love" — this is Lovescript, an esoteric programming language.
Code Structure
The code in task.txt contains many for-loops with a characteristic structure:
lovescript read-only • copy allowedfor (let v1 from 32 to 127) { if (v1 == 67) { ... } } for (let v2 from 32 to 127) { if (v2 == 79) { ... } } for (let v3 from 32 to 127) { if (v3 == 68) { ... } } // ... and so on
Key Observations
- Range 32-127 — these are printable ASCII characters
- Numbers in if conditions — these are ASCII codes of flag characters
- Sequence of variables v1, v2, v3... — determines the order of characters
- Hint "don't need to understand" — suggests the code doesn't need to be executed, static data extraction is sufficient
Extracted ASCII Codes
67, 79, 68, 69, 66, 89, 123, 102, 108, 64, 103, 95, 108, 48, 118, 69, 83, 99, 114, 49, 112, 116, 125
Decoding
| ASCII | Character |
|---|---|
| 67 | C |
| 79 | O |
| 68 | D |
| 69 | E |
| 66 | B |
| 89 | Y |
| 123 | { |
| 102 | f |
| 108 | l |
| 64 | @ |
| 103 | g |
| 95 | _ |
| 108 | l |
| 48 | 0 |
| 118 | v |
| 69 | E |
| 83 | S |
| 99 | c |
| 114 | r |
| 49 | 1 |
| 112 | p |
| 116 | t |
| 125 | } |
| |
Solution
Method 1: Bash one-liner
bash read-only • copy allowedgrep -o 'if (v[0-9]* == [0-9]*)' task.txt | grep -o '[0-9]*)' | tr -d ')' | while read num; do printf "\\$(printf '%03o' $num)"; done && echo
Method 2: Python script
python read-only • copy allowed#!/usr/bin/env python3 import re with open('task.txt', 'r') as f: content = f.read() # Extract all numbers from if (vN == NUMBER) conditions pattern = r'if \(v\d+ == (\d+)\)' matches = re.findall(pattern, content) # Convert ASCII codes to characters flag = ''.join(chr(int(code)) for code in matches) print(flag)
Method 3: Manual Analysis
Simply open the file, find all lines with if (vN == NUMBER) and write down the numbers in order.
Notes
- Lovescript — one of many esoteric languages created for fun
- Such tasks often use code as a data container, not as an executable program
- Static code analysis is often faster than trying to execute it
- The
for_you.pngfile is probably a distraction or decorative element