Command Line Interface Tool
  • PDF

Command Line Interface Tool

  • PDF

The Glasswall CLI tool is a command line wrapper around the CDR engine. The CLI tool can be used to process files and verify the output for all API functions available with the Glasswall CDR library. The results can be examined and compared to give you a clear understanding of any issues or unwanted content within files and any action carried out by the Glasswall CDR engine.

Setup

The Glasswall distribution package consists of all libraries, wrappers, tools, config and test files required to get started.

  1. Copy all library files into one folder.
  2. Copy the CLI tool into the same folder.
  3. Copy the sample config files to the same folder.
  4. Open the terminal.
  5. Use pushd to set the present working directory to the folder containing all the above files.
  6. Run Glasswall using the input/output or INI config file options shown below.
  7. Once this is complete you can use the results to check for any unwanted content, the xml files will contain information about each file and any issues found within it if it was non conforming.

Example Config Files

CLI Config File

An example of a valid configuration file is shown below.

The are several processing modes which are documented in the CLI documentation. To get started though the processMode can be set to '0' to analyse a file and produce and XML report or '1' to regenerated a cleaned file.

[GWConfig] 
processMode=0 
reportMode= 1 
fileStorageMode=0 
fileType = * 
inputLocation= input 
useSubfolders=1 

pathToSummaryReport=summary.xml
 
outputLocation= output 
createOutputFolders=1 
nonConformingDirName= NonConforming 
managedDirName= Managed 
 
quarantineNonconforming= 1 
writeOutput= 1 
 
logFileSize=0 
logFileProcessTime=1 
logProcessStatus=0

Content Management Policy File

See an example policy file below. A complete policy file and XSD can be found within the Glasswall distribution package.

<?xml version="1.0" encoding="UTF-8"?>
<config>

  <pdfConfig>    
    <watermark>Glasswall Protected</watermark>
    <acroform>sanitise</acroform>
    <metadata>sanitise</metadata>
    <javascript>sanitise</javascript>
    <actions_all>sanitise</actions_all>
    <embedded_files>sanitise</embedded_files>
    <internal_hyperlinks>sanitise</internal_hyperlinks>
    <external_hyperlinks>sanitise</external_hyperlinks>
    <value_outside_reasonable_limits>sanitise</value_outside_reasonable_limits>
  </pdfConfig>
  
  <wordConfig>
    <macros>sanitise</macros>
    <metadata>sanitise</metadata>
    <embedded_files>sanitise</embedded_files>
    <dynamic_data_exchange>sanitise</dynamic_data_exchange>
    <review_comments>sanitise</review_comments>
    <internal_hyperlinks>sanitise</internal_hyperlinks>
    <external_hyperlinks>sanitise</external_hyperlinks>
  </wordConfig>
  
  <pptConfig>
    <macros>sanitise</macros>
    <metadata>sanitise</metadata>
    <embedded_files>sanitise</embedded_files>
    <review_comments>sanitise</review_comments>
    <internal_hyperlinks>sanitise</internal_hyperlinks>
    <external_hyperlinks>sanitise</external_hyperlinks>
  </pptConfig>
  
  <xlsConfig>
    <macros>sanitise</macros>
    <metadata>sanitise</metadata>
    <embedded_files>sanitise</embedded_files>
    <dynamic_data_exchange>sanitise</dynamic_data_exchange>
    <review_comments>sanitise</review_comments>
    <internal_hyperlinks>sanitise</internal_hyperlinks>
    <external_hyperlinks>sanitise</external_hyperlinks>
    <connections>sanitise</connections>
  </xlsConfig>  
  
  <tiffConfig>
    <geotiff>sanitise</geotiff>
  </tiffConfig>  

  <svgConfig>
    <scripts>sanitise</scripts>
    <foreignObjects>sanitise</foreignObjects>
    <hyperlinks>sanitise</hyperlinks>
  </svgConfig>
    
  <webpConfig>
    <metadata>sanitise</metadata>
  </webpConfig>
    
</config>

The possible settings for each element is described in the table below.

TypeValueNotes
contentManagementFlagsanitiseConfigures Glasswall to remove or clean document element types associated with this content management switch type from any document being processed. This removal will be logged in analysis reports as a ‘sanitisation item’

allowConfigures Glasswall to leave document element types associated with this content management switch type in any document being processed.

disallowConfigures Glasswall to raise an issue if document element types associated with this content management flag are found within any document being processed.
watermarkFreeform text, up to 20 CharactersSpecifying a null element .i.e., , results 20 characters

Running the CLI Tool

Open a terminal within the working directory containing the CLI tool, Glasswall library files, and config files, and run the following command.

Editor Engine CLI

gwcli -n config.ini -c policies.xml

Rebuild Engine CLI

commandlinetool.exe  -config=config.ini -xmlconfig=policies.xml

Output

The output can be located in the location specified in the config.ini file.

A process log and summary report are also produced with each run, summarising the outcome.


What's Next