Skip to main content

Application to encrypt files and folder-names

Project description

Path Encoder

Description

This application allows encryting files and folder (names) using AES.

Installation

The config generator can be installed directly through PIP from this repo:

pip install -e "git+https://wwwin-github.cisco.com/AS-Community/Cable.git#subdirectory=Configuration and Provisioning/ConfigGenerator&egg=ConfigGenerator"

Usage

Using the tool requires execution of "config_generator <options>".The following options are supported:

  • -h: Show the help message
  • -t: The JINJA2 template file to use
  • -o: The output file
  • -d: Data input URL. The scheme in the URL specifies the parser to use. The rest of the URL is the reference to the actual data. This option can be specified multiple times. The following data formats are currently supported:
    • xml: Any XML file. The root tag in the file will be used as name to reference the data in the JINJA2 template.
    • xlsx: An Excel 2010+ file. The name of the file will be used as name to reference the data in the JINJA2 template (spaces are replaced by underscores).

Templating

This paragraph describes how to get access to the input data. The complete JINJA2 templating documentation is available from the JINJA2 documentation site.

XML

Assume an XML file with the following content:

<cablevideo>
    <linecard>
        <slot>1</slot>
    </linecard>
    <linecard>
        <slot>2</slot>
    </linecard>
    <linecard>
        <slot>3</slot>
    </linecard>
</cablevideo>

When executing the tool, the data in this file will be mapped to a PYTHON data-structure with the same hierarchy. This means that the 3 linecard sections will be available in a list named cablevideo.linecard. This list can be used in various JINJA2 constructs like loops. Each of the slot values is than available as cablevideo.linecard[i].slot, with i being the index in the linecard list.

Excel 2010+ xlsx

The XLSX data is available in the JINJA2 template with a name corresponding to the file basename, without the extension and spaces replaced by underscores (e.g. "test data.xlsx" would be named "test_data"). The data-object supports the following properties:

  • active_worksheet: Name of the active worksheet. By default the first worksheet in the file is the active one.
  • worksheets: List of all worksheets in the workbook. This list can be used in loops etc.

Data in the file can only be read, not changed. The value of cells is available using the following functions:

  • cell(<cell-ref>): This returns the value of the cell as a string
  • cell(<cell-ref>, <row_offset>, <col_offset>): This returns the value of the cell &glt;row_offset> rows below and <col_offset> columns to the right of the cell specified by <cell-ref>. Example: cell('A1', 2, 3) will return the value of cell 'D3'.
  • cell_as_int(<cell-ref>): Same as the function cell, but the value is returned as int.
  • cell_as_int(<cell-ref>, <row_offset>, <col_offset>): Same as the function cell (with 3 parameters), but the value is returned as int.
  • cell_as_float(<cell-ref>): Same as the function cell, but the value is returned as float.
  • cell_as_float(<cell-ref>, <row_offset>, <col_offset>): Same as the function cell (with 3 parameters), but the value is returned as float.
  • worksheet(<sheet>): This function allows changing the active worksheet. The sheet can be specified as an integer (sheet index, zero based) or string (case-sensitive sheet name). Calling this function is to be done using the syntax below (mind the dashes, since these will prevent unwanted spaces and newlines being rendered):
 {{- xlsx_data.worksheet(s) -}}

Note: All cell references in the cell functions mentioned earlier are on the active worksheet. Hence you should be mindful of always setting the correct worksheet before calling a cell function.

Project details


Download files

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

Source Distribution

PathCrypter-0.2.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

PathCrypter-0.2-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

Details for the file PathCrypter-0.2.tar.gz.

File metadata

  • Download URL: PathCrypter-0.2.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.19.1 setuptools/40.7.2 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.6.1

File hashes

Hashes for PathCrypter-0.2.tar.gz
Algorithm Hash digest
SHA256 f2c95ceb57c78c84eea253f3fd8bdca3ff47e97e3ac205ea9dd7ccb67114eb64
MD5 1db379b74e2ca9ead6a1b085c4007e35
BLAKE2b-256 265dff97952eea71955575872813d983b4990e02c13c8243b2b4c6b6cba2473e

See more details on using hashes here.

File details

Details for the file PathCrypter-0.2-py3-none-any.whl.

File metadata

  • Download URL: PathCrypter-0.2-py3-none-any.whl
  • Upload date:
  • Size: 17.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.19.1 setuptools/40.7.2 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.6.1

File hashes

Hashes for PathCrypter-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c5a43b10a6471fd66a94eada8fc267ee7e060143cd8a7d8b927dab1665b80fbd
MD5 d8d984c069375efb8604da8e1cb01943
BLAKE2b-256 03bff7e112ead56bef091050e6b708d915bf772d306e452446872519ffe4c50d

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