Забытый пароль 2
Забытый пароль 2
Platform: duckerz | Category: Reversing | Type: Challenge | Difficulty: Easy | OS: NA | Author: XESXOR | Date: 2026-01-09 | Status: Solved Techniques: xor_decryption
Summary
Task: Python script with XOR-encrypted flag using key "0x2a". Solution: Applied reverse XOR operation with the same key to decrypt the flag.
Забытый пароль 2 — duckerz
Description
The task provided a Python script rev2.py which contained an encrypted flag and a simple XOR encryption logic using the key "0x2a".
Analysis
When analyzing the provided script rev2.py, the following was discovered:
- The
flagvariable contains an encrypted byte sequence:b"t-q*u*h\x1a@L\x00SGH\x05o;US\x13\x01%o\x0f\x03\x15X'jQB\x05". - The key used is
key = "0x2a". - The encryption algorithm is character-by-character XOR between the message and a cyclically repeating key:
python read-only • copy allowed
for i in range(0, len(message)): list_output.append(chr(ord(message[i])^ord(key[i % len(key)])))
Since the XOR operation is reversible, to decrypt the flag it is sufficient to apply the same operation with the same key to the encrypted bytes.
Solution
A script solve_rev2.py was written:
python read-only • copy allowed#!/usr/bin/env python3 flag_enc = b"t-q*u*h\x1a@L\x00SGH`\x05o;`US\x13\x01%o\x0f\x03\x15X'jQB\x05" key = "0x2a" flag = "" for i in range(len(flag_enc)): flag += chr(flag_enc[i] ^ ord(key[i % len(key)])) print(flag)
Running the script gives us the flag.