Skip to content
nronzelPublic

About

Remove password protection from .docx files.

Topics

Resources

Stars

6 stars

Watchers

1 watching

Forks

Latest commit

 

History

10 Commits

Folders and files

Repository files navigation

$$$$$$$\                                 $$$$$$\
$$  __$$\                               $$  __$$\
$$ |  $$ | $$$$$$\   $$$$$$$\ $$\   $$\ $$ /  \__|$$$$$$\   $$$$$$\   $$$$$$\
$$ |  $$ |$$  __$$\ $$  _____|\$$\ $$  |$$$$\    $$  __$$\ $$  __$$\ $$  __$$\
$$ |  $$ |$$ /  $$ |$$ /       \$$$$  / $$  _|   $$ |  \__|$$$$$$$$ |$$$$$$$$ |
$$ |  $$ |$$ |  $$ |$$ |       $$  $$<  $$ |     $$ |      $$   ____|$$   ____|
$$$$$$$  |\$$$$$$  |\$$$$$$$\ $$  /\$$\ $$ |     $$ |      \$$$$$$$\ \$$$$$$$\
\_______/  \______/  \_______|\__/  \__|\__|     \__|       \_______| \_______|

Overview

Removes editing restrictions from .docx files.

When a document is set to "restrict editing" (read-only, comments-only, or forms-only enforcement), Word stores that as a <w:documentProtection> node in the file. Docxfree writes a copy of the document with that node removed, prepends unprotected- to the filename, and saves it into a docxfreed/ directory. A copy is created so the original file is never touched.

Warning

This removes editing restrictions, not open-password encryption. If a .docx requires a password just to open it, the file is encrypted and cannot even be read as an archive — Docxfree will not decrypt it.

Warning

Only works on .docx files (Office 2007 or newer). Will NOT work with .doc files.

Features

  • Easy to use CLI
  • Single file operation
  • Batch operations on a specified directory
  • Optional depth argument to process nested directories

Installation

Manual Installation

Clone the repo:

git clone https://github.com/nronzel/docxfree.git

cd docxfree

Build the program:

go build

Release

Download the correct binary from the latest release.

Usage

You can specify a single filename, or a path to a directory.

If you specify a path, you can also specify an optional depth argument if there are sub-directories that contain .docx files that you need processed. The default depth (1) means it will only process the specified directory and no sub-directories. Use a depth of 2 or higher to include nested directories.

Arguments

Arg Description
-f (file) Specify a single .docx file.
-p (path) Specify a directory of .docx files.
-d (depth) *Optional - Recursion depth. Default: 1

Help Message

Arguments:
	-f: Specify a single filename.
	-p: Specify a path to a directory of files.
	-d: *Optional - Depth of recursion when specifying a path. Default: 1 (specified dir only)

Usage:
	> Single File:
	docxfree -f [filename]

	> Batch Operations:
	docxfree -p [path/to/files]
	docxfree -p [path/to/files] -d [recursion-depth]

Examples:
	docxfree -f document.docx
	docxfree -p protected_docs/
	docxfree -p /path/to/files -d 3

How It Works

Office 2007 and newer .docx files are actually just a zip archive of XML files. When you restrict editing on a document, a <w:documentProtection> node is added to word/settings.xml inside the archive.

This utility copies every file in the .docx archive unchanged, except for settings.xml, which is rewritten with the documentProtection node stripped out. The removal is done on the raw bytes rather than by re-serializing the XML, so namespaces and formatting elsewhere in the file are preserved exactly.

Older Office files (.doc) are a single binary file and not an XML archive, so this method of removing editing restrictions will not work.

About

Remove password protection from .docx files.

Topics

Resources

Stars

6 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages