cfbwrite
Write a complete MS-CFB v3 (Microsoft Compound File Binary) container from Python — including streams that changed size.
olefile reads Compound Files well and can replace a stream only with data of
exactly the same length. That is enough to rearrange existing content and not
enough to add any, so anything that grows a stream needs the container
rebuilt. This library rebuilds it.
from cfbwrite import rebuild
rebuild(src="original.rdb", dst="updated.rdb", replacements={
("Relays", "QPC1_TR1", "SET_D1.TXT"): new_bytes, # any size
})
Two properties it is built around, because it came from a tool that writes protection-relay settings files:
- It verifies its own output. The result is reopened and every stream compared against the source before it is handed over. A bug in the writer surfaces as a failed write, never as a silently corrupt file.
- It writes atomically. The container is built in a temporary file beside
the destination and only then
os.replaced into place, so a failure leaves the destination exactly as it was.
Extracted from PAC CT.
Licence
AGPL-3.0-or-later — see LICENSE.
Install
pip install cfbwrite
Requires Python 3.10+ and olefile.
Why it exists
It was pacct/parsers/ole_rebuild.py inside
PAC CT, a commissioning toolkit
for protective relays. Those relays keep their settings in .rdb files, which
are Compound Files, and editing a DNP3 point map there routinely grows a
stream. Nothing in the module knows any of that — it is the container format
and nothing else — so it lives here instead.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cfbwrite-1.0.1.tar.gz.
File metadata
- Download URL: cfbwrite-1.0.1.tar.gz
- Upload date:
- Size: 26.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4fe9881d2d7d343d707e9b75874960e95e837a734cb26e55a9fd057fe122a85
|
|
| MD5 |
ba5bdb6d5205e0acb7b2fc595843708c
|
|
| BLAKE2b-256 |
3ce0594a4cc2efe7afbf8136ec6975222e49d57f585b8f8f54f77b759ccd9c7f
|
Provenance
The following attestation bundles were made for cfbwrite-1.0.1.tar.gz:
Publisher:
release.yml on GuilhermeMarini/cfbwrite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cfbwrite-1.0.1.tar.gz -
Subject digest:
b4fe9881d2d7d343d707e9b75874960e95e837a734cb26e55a9fd057fe122a85 - Sigstore transparency entry: 2715783786
- Sigstore integration time:
-
Permalink:
GuilhermeMarini/cfbwrite@22387884bb7e6e67257654ed1250bd5ea2d814a2 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/GuilhermeMarini
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@22387884bb7e6e67257654ed1250bd5ea2d814a2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cfbwrite-1.0.1-py3-none-any.whl.
File metadata
- Download URL: cfbwrite-1.0.1-py3-none-any.whl
- Upload date:
- Size: 21.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d00c600e03c630d1e122bbc1896d7331c8548d0fd5fb73943de1124004527995
|
|
| MD5 |
166aa9f5f6f68f08d4e253e8f1aac487
|
|
| BLAKE2b-256 |
b33a27e96d6c2f882e7a8a253f4494c2420164832f64f2e3135b223c168b80ac
|
Provenance
The following attestation bundles were made for cfbwrite-1.0.1-py3-none-any.whl:
Publisher:
release.yml on GuilhermeMarini/cfbwrite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cfbwrite-1.0.1-py3-none-any.whl -
Subject digest:
d00c600e03c630d1e122bbc1896d7331c8548d0fd5fb73943de1124004527995 - Sigstore transparency entry: 2715785283
- Sigstore integration time:
-
Permalink:
GuilhermeMarini/cfbwrite@22387884bb7e6e67257654ed1250bd5ea2d814a2 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/GuilhermeMarini
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@22387884bb7e6e67257654ed1250bd5ea2d814a2 -
Trigger Event:
push
-
Statement type: