← Back to Writeups
CUSTOMEasyMisc

Lovescript

XESXOR9/2/20263 min read
#misc#custom#easy#ascii-code-extraction-from-sou#esoteric-language-identificati#pattern-based-data-extraction#linux

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 Lovescript
  • for_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
for (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

  1. Range 32-127 — these are printable ASCII characters
  2. Numbers in if conditions — these are ASCII codes of flag characters
  3. Sequence of variables v1, v2, v3... — determines the order of characters
  4. 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

‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

ASCIICharacter
67C
79O
68D
69E
66B
89Y
123{
102f
108l
64@
103g
95_
108l
480
118v
69E
83S
99c
114r
491
112p
116t
125}
‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

Solution

Method 1: Bash one-liner

bash
grep -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
#!/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.png file is probably a distraction or decorative element ‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍