Quick start¶
Three commands handle every Office password scenario: opt info (inspect), opt unlock (remove protections), and opt advanced (fine-grained control). This page walks through the common workflows.
Two conventions hold throughout:
- Hash to stdout, status to stderr.
opt info FILE | hashcat ...just works because only the hash reaches the pipe. Thestatus:schemegate summary prints to stderr. - The input file is never modified. Every writing command produces a new file (
secret.unlocked.xlsx), never overwrites the source.
1. Check what protections a file has¶
opt info secret.xlsx
stderr shows each gate as a status:scheme tag on one line:
secret.xlsx encrypted:agile-sha512 removable:sheets(3) removable:workbook
stdout emits the crackable hash (if any), ready to pipe. The six statuses tell you what each gate means at a glance:
| Status | Meaning |
|---|---|
encrypted: |
Password required to read the file |
removable: |
Stripped automatically, no password needed |
trivial: |
Instantly reversible (XOR, CRC, cleartext) |
info: |
Informational only, not a password gate |
blocked: |
Needs a certificate or RMS server |
open |
No protection |
2. Unlock a file automatically¶
opt unlock secret.xlsx
unlock runs the full pipeline in one call: tries default passwords and keyless decodes, strips every removable: and trivial: gate, collides tiny verifiers, and writes a clean copy. If the file is genuinely encrypted and no default opens it, unlock emits the hash to stdout and exits with code 4 so your script can hand it to hashcat.
Tip
unlock tries VelvetSweatshop and other built-in defaults silently. Files "encrypted" under a default password are decrypted without any -p flag.
3. Crack with hashcat¶
When unlock cannot decrypt, pipe the hash from info into hashcat, then feed the recovered password back:
opt info secret.xlsx | hashcat -m 37000
opt unlock secret.xlsx -p recovered_password
The hashcat mode depends on the scheme info reported (agile-sha512 = 9600, rc4-sha1 = 9800, standard = 9400, etc.). The unified hash format (-m 37000) auto-detects the right algorithm.
Tip
Use opt info secret.xlsx 2>/dev/null to get hashes only (no gate summary), or 2>&1 >/dev/null to get the gate summary only (no hash).
4. Batch processing¶
Both info and unlock accept multiple files and globs. Hash output preserves file order with blank lines as separators, so file-to-hash alignment is maintained.
opt info /path/to/office/files/
opt unlock *.xlsx --force
--force overwrites existing output files. Without it, unlock refuses if secret.unlocked.xlsx already exists.
Tip
In batch mode, info pads the filename column to align tags across all files, making the output scannable.
5. Python API¶
The same detection and extraction logic is available as a library:
import office_password_toolkit as opt
result = opt.detect("secret.xlsx")
# result.container, result.encrypted, result.product
# gate enumeration is a separate call (more expensive than detection)
handler = opt.handler_for(result.container)
gates = handler.gates("secret.xlsx")
# [Gate(gate="open", recovery="crack", scheme="office-2013"), ...]
hashes = opt.extract_hashes("secret.xlsx")
# [ExtractedHash(value="$office$*2013*...", scheme="office-2013", ...)]
detect() classifies the container, encryption status, and product. Gate enumeration and hash extraction are separate calls — handler.gates() returns every protection mechanism, and extract_hashes() returns the crackable hash lines that would go to stdout.