Glasswall Python Wrapper
A high level Python wrapper for interfacing with Glasswall libraries.
Getting Started
Install via pip:
pip install glasswall
Prerequisites
Examples
Loading a Glasswall Library
Currently the following libraries are supported:
- ArchiveManager
- Editor
- Rebuild
- SecurityTagging
- WordSearch
import glasswall
editor = glasswall.Editor(library_path=r"C:\azure\sdk.editor\2.173")
>>> 2021-03-15 12:27:42.337 glasswall INFO __init__ Loaded Glasswall Editor version 2.173 from C:\azure\sdk.editor\2.173\windows-drop-no-kill-switch\glasswall_core2.dll
library_path can be a path to a directory or a path to a file. When a directory is specified all subdirectories are recursively searched for the library file with the latest creation time.
Logging
Logs are saved in the OS-specific temp directory and are also output to console with a default logging level of INFO. You can view the file path of the temp directory or the log file:
import glasswall
print(glasswall._TEMPDIR)
print(glasswall.config.logging.log_file_path)
>>> C:\Users\ANGUSR~1\AppData\Local\Temp\glasswall
>>> C:\Users\ANGUSR~1\AppData\Local\Temp\glasswall\logs\2021-03-15 122826.txt
The logging level can be modified, for a list of levels see: https://docs.python.org/3/library/logging.html#logging-levels
import logging
import glasswall
# Modify logging level for logs to the console
glasswall.config.logging.console.setLevel(logging.DEBUG)
# Modify logging level for logs to file
glasswall.config.logging.log.setLevel(logging.DEBUG)
Protecting a directory
If no content management policy is provided then the default sanitise all policy is used.
import glasswall
editor = glasswall.Editor(library_path=r"C:\azure\sdk.editor\2.173")
editor.protect_directory(
input_directory=r"C:\test_files",
output_directory=r"C:\test_files_sanitised"
)
Protecting a directory with a customised content management policy
Using glasswall.content_management.policies.Editor:
import glasswall
editor = glasswall.Editor(library_path=r"C:\azure\sdk.editor\2.173")
editor.protect_directory(
input_directory=r"C:\test_files",
output_directory=r"C:\test_files_sanitised",
content_management_policy=glasswall.content_management.policies.Editor(
config={
"pptConfig": {
"internal_hyperlinks": "allow",
"macros": "disallow",
},
"wordConfig": {
"internal_hyperlinks": "allow",
"macros": "disallow",
}
}
)
)
Using a custom .xml file:
import glasswall
editor = glasswall.Editor(library_path=r"C:\azure\sdk.editor\2.173")
editor.protect_directory(
input_directory=r"C:\test_files",
output_directory=r"C:\test_files_sanitised",
content_management_policy=r"C:\configs\config.xml"
)
Built With
Metadata
Release files for glasswall 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| glasswall-0.1.1.tar.gz | 41.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| glasswall-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 105.2 kB
Release files / glasswall-0.1.1.tar.gz
| Download URL | glasswall-0.1.1.tar.gz |
|---|---|
| Size | 41.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7f804edb48f579a464b29643faf2dc98bed0ff17c2ca60dfa7dae74a0543f6f4
|
|
BLAKE2b-256 checksum How to use checksums |
7a40f1eced0507a8f7c3d6a2f1349658f588f36783c8d6c3647a0234b5e7e9de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.0 importlib_metadata/3.7.3 packaging/20.9 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
|
Release files / glasswall-0.1.1-py3-none-any.whl
| Download URL | glasswall-0.1.1-py3-none-any.whl |
|---|---|
| Size | 64.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
768e2d603e614c6ec6d2fb8d2453e9ad08c2aa4a8fa29a699805203f128aad0f
|
|
BLAKE2b-256 checksum How to use checksums |
ac58ac1408e6549175fa1783e0554e80a90a9fedfc333e6a3f67385c70d827b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.0 importlib_metadata/3.7.3 packaging/20.9 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
|