← Back to Writeups
CUSTOMMediumMisc

Вежливый таск (Polite Task)

XESXOR9/2/20263 min read
#misc#custom#medium#intercal_execution#politeness_rules#zip_password_extraction

Вежливый таск (Polite Task)

Platform: hackerlab | Category: Misc | Type: Challenge | Difficulty: Medium | OS: NA | Author: XESXOR | Date: 2025-12-26 | Status: Solved Techniques: intercal_execution, politeness_rules, zip_password_extraction

Summary

Task: INTERCAL code and AES-encrypted ZIP archive with politeness theme. Solution: Execute INTERCAL code to get ZIP password, then add PLEASE keywords to satisfy 20-33% politeness requirement to get the flag.

Вежливый таск (Polite Task) - HackerLab

Description

"Вежливость порождает и вызывает вежливость" (Politeness begets and evokes politeness)

Files

  • task_politeness.zip contains:
    • what.txt - INTERCAL code (914 values)
    • politeness.zip - AES-encrypted ZIP archive

Analysis

Step 1: Language Identification

The file what.txt contains code in the esoteric programming language INTERCAL.

INTERCAL is known for its unique "politeness" requirement:

  • The program must contain the keyword PLEASE in 20-33% of commands
  • If less than 20% - error "PROGRAMMER IS INSUFFICIENTLY POLITE"
  • If more than 33% - error "PROGRAMMER IS OVERLY POLITE" ‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

The task name "Вежливый таск" (Polite Task) is a direct hint to this INTERCAL feature.

Step 2: Executing the First Code

Ran the INTERCAL code through TIO (Try It Online):

Execution result: 6yXPAQsRSaiKM9cuLfqcYxPYHH7A6yhE

This is the password for politeness.zip.

Step 3: Extracting the Second Code

After unpacking politeness.zip with the password, obtained the file politeness.txt:

  • Contains second INTERCAL code with 38 values
  • Header: "PLEASE NOTE Politeness has always been honored!" ‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

Step 4: Adding Politeness

The second code requires compliance with INTERCAL politeness rules.

Added PLEASE to every 4th line to achieve the required 20-33%:

intercal
PLEASE NOTE Politeness has always been honored!
DO ,1 <- #38
DO ,1 SUB #1 <- #67
PLEASE ,1 SUB #2 <- #79
DO ,1 SUB #3 <- #68
DO ,1 SUB #4 <- #69
PLEASE ,1 SUB #5 <- #66
DO ,1 SUB #6 <- #89
DO ,1 SUB #7 <- #123
PLEASE ,1 SUB #8 <- #112
...

Step 5: Final Execution

Ran the modified code through TIO.

Solution

python
#!/usr/bin/env python3
"""
INTERCAL Politeness Task Solver
‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

1. Run first INTERCAL code to get ZIP password
2. Extract second code from ZIP
3. Add PLEASE to every 4th line
4. Run modified code to get flag
"""

# Step 1: First INTERCAL code output (from TIO)
zip_password = "6yXPAQsRSaiKM9cuLfqcYxPYHH7A6yhE"

# Step 2: Extract politeness.zip with password
# unzip -P "6yXPAQsRSaiKM9cuLfqcYxPYHH7A6yhE" politeness.zip

# Step 3: Modify second INTERCAL code - add PLEASE every 4th line
def add_politeness(code_lines):
    """Add PLEASE to every 4th line to satisfy 20-33% requirement"""
    result = []
    for i, line in enumerate(code_lines):
        if i > 0 and i % 4 == 0 and not line.strip().startswith('PLEASE'):
            line = 'PLEASE ' + line.lstrip('DO ')
        result.append(line)
    return result
‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

# Step 4: Run through TIO and get flag
# Output: CODEBY{REDACTED}

Resources

Notes

  • INTERCAL was created in 1972 as a parody of programming languages
  • Keywords: DO, PLEASE, GIVE UP, COME FROM, ABSTAIN
  • Numbers are stored in arrays via SUB (subscript)
  • Output via READ OUT, input via WRITE IN ‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍