← Back to Writeups
CUSTOMEasyMisc

Во все тяжкие (Breaking Bad)

XESXOR9/2/20264 min read
#misc#custom#easy#chemical-element-symbol-parsin#atomic-number-to-ascii-convers#leet-speak-recognition

Во все тяжкие (Breaking Bad)

Platform: hackerlab.pro | Category: Misc | Type: Challenge | Difficulty: Easy | OS: NA | Author: XESXOR | Date: 2025-12-24 | Status: Solved Techniques: Chemical element symbol parsing, Atomic number to ASCII conversion, Leet speak recognition

Summary

Во все тяжкие (Breaking Bad) — hackerlab.pro

Description

"Ненавижу людей, которые говорят: «Угадай что?» — и ждут, что ты будешь угадывать."

Формат флага: CODEBY{flag}

Analysis

The file task.txt contains a string:

BkFlSbAmLvRfMdAmEsRfMdMtInMcLvMcAmCdDsAmMcDbLvSbEu

The task name "Во все тяжкие" (Breaking Bad) is a reference to the TV series about chemist Walter White. The string consists of two-letter combinations where the first letter is uppercase and the second is lowercase — this is the standard notation for chemical elements from the periodic table. ‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

Solution

Step 1: Parsing Chemical Elements

Split the string into elements using the pattern "uppercase + lowercase":

Bk, Fl, Sb, Am, Lv, Rf, Md, Am, Es, Rf, Md, Mt, In, Mc, Lv, Mc, Am, Cd, Ds, Am, Mc, Db, Lv, Sb, Eu

Step 2: Getting Atomic Numbers

ElementNameAtomic Number
BkBerkelium97
FlFlerovium114
SbAntimony51
AmAmericium95
LvLivermorium116
RfRutherfordium104
MdMendelevium101
AmAmericium95
EsEinsteinium99
RfRutherfordium104
MdMendelevium101
MtMeitnerium109
InIndium49
McMoscovium115
LvLivermorium116
McMoscovium115
AmAmericium95
CdCadmium48
DsDarmstadtium110
AmAmericium95
McMoscovium115
DbDubnium105
LvLivermorium116
SbAntimony51
EuEuropium63
‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

Step 3: Converting to ASCII

The atomic numbers correspond to ASCII codes:

97, 114, 51, 95, 116, 104, 101, 95, 99, 104, 101, 109, 49, 115, 116, 115, 95, 48, 110, 95, 115, 105, 116, 51, 63

Decoding:

REDACTED

This is a leet-speak version of the phrase "are the chemists on site?" — a reference to the Breaking Bad TV series.

Solution Script

python
#!/usr/bin/env python3
"""
Breaking Bad - Chemical Element Cipher
Decoding a message using atomic numbers of chemical elements
"""

import re
‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

# Periodic table: symbol -> atomic number
PERIODIC_TABLE = {
    'H': 1, 'He': 2, 'Li': 3, 'Be': 4, 'B': 5, 'C': 6, 'N': 7, 'O': 8, 'F': 9, 'Ne': 10,
    'Na': 11, 'Mg': 12, 'Al': 13, 'Si': 14, 'P': 15, 'S': 16, 'Cl': 17, 'Ar': 18, 'K': 19, 'Ca': 20,
    'Sc': 21, 'Ti': 22, 'V': 23, 'Cr': 24, 'Mn': 25, 'Fe': 26, 'Co': 27, 'Ni': 28, 'Cu': 29, 'Zn': 30,
    'Ga': 31, 'Ge': 32, 'As': 33, 'Se': 34, 'Br': 35, 'Kr': 36, 'Rb': 37, 'Sr': 38, 'Y': 39, 'Zr': 40,
    'Nb': 41, 'Mo': 42, 'Tc': 43, 'Ru': 44, 'Rh': 45, 'Pd': 46, 'Ag': 47, 'Cd': 48, 'In': 49, 'Sn': 50,
    'Sb': 51, 'Te': 52, 'I': 53, 'Xe': 54, 'Cs': 55, 'Ba': 56, 'La': 57, 'Ce': 58, 'Pr': 59, 'Nd': 60,
    'Pm': 61, 'Sm': 62, 'Eu': 63, 'Gd': 64, 'Tb': 65, 'Dy': 66, 'Ho': 67, 'Er': 68, 'Tm': 69, 'Yb': 70,
    'Lu': 71, 'Hf': 72, 'Ta': 73, 'W': 74, 'Re': 75, 'Os': 76, 'Ir': 77, 'Pt': 78, 'Au': 79, 'Hg': 80,
    'Tl': 81, 'Pb': 82, 'Bi': 83, 'Po': 84, 'At': 85, 'Rn': 86, 'Fr': 87, 'Ra': 88, 'Ac': 89, 'Th': 90,
    'Pa': 91, 'U': 92, 'Np': 93, 'Pu': 94, 'Am': 95, 'Cm': 96, 'Bk': 97, 'Cf': 98, 'Es': 99, 'Fm': 100,
    'Md': 101, 'No': 102, 'Lr': 103, 'Rf': 104, 'Db': 105, 'Sg': 106, 'Bh': 107, 'Hs': 108, 'Mt': 109, 'Ds': 110,
    'Rg': 111, 'Cn': 112, 'Nh': 113, 'Fl': 114, 'Mc': 115, 'Lv': 116, 'Ts': 117, 'Og': 118
}
‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

def parse_elements(encoded_string):
    """Parse string into chemical elements"""
    # Pattern: uppercase letter + optional lowercase
    elements = re.findall(r'[A-Z][a-z]?', encoded_string)
    return elements

def decode_breaking_bad(encoded_string):
    """Decode message using atomic numbers"""
    elements = parse_elements(encoded_string)
    
    print(f"Elements: {', '.join(elements)}")
    
    atomic_numbers = []
    for elem in elements:
        if elem in PERIODIC_TABLE:
            atomic_numbers.append(PERIODIC_TABLE[elem])
        else:
            print(f"Unknown element: {elem}")
            return None
    
    print(f"Atomic numbers: {atomic_numbers}")
    
    # Convert to ASCII
    decoded = ''.join(chr(n) for n in atomic_numbers)
    return decoded
‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

# Input data
encoded = "BkFlSbAmLvRfMdAmEsRfMdMtInMcLvMcAmCdDsAmMcDbLvSbEu"

result = decode_breaking_bad(encoded)
print(f"\nDecoded message: {result}")
print(f"Flag: CODEBY{{{result}}}")

Output

Elements: Bk, Fl, Sb, Am, Lv, Rf, Md, Am, Es, Rf, Md, Mt, In, Mc, Lv, Mc, Am, Cd, Ds, Am, Mc, Db, Lv, Sb, Eu
Atomic numbers: [97, 114, 51, 95, 116, 104, 101, 95, 99, 104, 101, 109, 49, 115, 116, 115, 95, 48, 110, 95, 115, 105, 116, 51, 63]

Decoded message: REDACTED
Flag: CODEBY{REDACTED}

Related Techniques

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

  • ASCII encoding/decoding
  • Leet speak (1337 speak)
  • Substitution ciphers
  • Pop culture references in CTF ‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍