Skip to main content

Glasswall Python Wrapper

Project description

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

Project details


Release history Release notifications | RSS feed

This version

0.2.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

glasswall-0.2.0.tar.gz (46.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

glasswall-0.2.0-py3-none-any.whl (68.9 kB view details)

Uploaded Python 3

File details

Details for the file glasswall-0.2.0.tar.gz.

File metadata

  • Download URL: glasswall-0.2.0.tar.gz
  • Upload date:
  • Size: 46.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for glasswall-0.2.0.tar.gz
Algorithm Hash digest
SHA256 32ffc05251fe44ddbf92e65825bdfbc60c132f6b181024506cb1126dc9de7078
MD5 9f9df62a77062dbb40458d55d2bd4d3f
BLAKE2b-256 30baa3b9e7c56dad27d1507d69212192ba3c8aa3d52baa1db342f1c31a3dcc59

See more details on using hashes here.

File details

Details for the file glasswall-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: glasswall-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 68.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for glasswall-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 60ae84de7e289b0e0b9a8f801643898c3006fe4fad49e5df647f94b082cc2d6f
MD5 bd4c3734294f969b6456a5fe2d82bb4b
BLAKE2b-256 6542ec6d166585fc9bd6a14ab9556f82039f706fe1ccc71fdcfbbc10fb7b2978

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page