Description
Python scripts are invoked kind of like programs in the terminal. Download and use the provided python script, password file, and encrypted flag.
Setup
Download ende.py, pw.txt, and flag.txt.en from the challenge page.
Solution
- Step 1Read the passwordThe decryption password is stored in pw.txt. Print it so you can supply it to the script.cat pw.txt
Learn more
Storing a password in a separate file is a common pattern in software -- rather than hard-coding credentials in the main script, they're kept in a dedicated file that can be protected with file system permissions or excluded from version control. In this challenge, the password file is provided to you intentionally as part of the puzzle.
In real applications you'd never want to store plaintext passwords in a file, but the pattern of reading configuration or secrets from a file is pervasive. Tools like
.envfiles,secrets.json, or environment variables serve the same purpose in production code. The key is that the secret is separate from the logic that uses it. - Step 2Decrypt the flagRun ende.py with the -d flag to decrypt. The script will prompt for the password -- paste what you read from pw.txt.python3 ende.py -d flag.txt.en
Learn more
Command-line flags (like
-d) are arguments passed to a program to modify its behavior. The convention of-dfor "decrypt" and-efor "encrypt" is common across many cryptographic tools. Python scripts parse these using thesys.argvlist or theargparsemodule, which provides structured argument parsing with help text and type checking.The
.enfile extension likely stands for "encrypted" -- a naming convention to distinguish encrypted files from their plaintext originals. The underlying encryption algorithm could be AES, DES, or another symmetric cipher. Since the password is given, no cracking is needed -- this challenge focuses purely on knowing how to run a Python script with the correct arguments.Running Python scripts:
python3 script.pyinvokes the Python 3 interpreter onscript.py. The distinction betweenpythonandpython3matters on systems where Python 2 is still the default (older Linux distros). In CTF environments, always checkpython3 --versionfirst. You can also make scripts directly executable withchmod +x ende.pyand then run./ende.py -d flag.txt.enif the script has a shebang line (#!/usr/bin/env python3).
Flag
picoCTF{...}
The -d flag means decrypt; the password from pw.txt is the decryption key.