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
Built Distribution
Hashes for PathCrypter-0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5a43b10a6471fd66a94eada8fc267ee7e060143cd8a7d8b927dab1665b80fbd |
|
MD5 | d8d984c069375efb8604da8e1cb01943 |
|
BLAKE2b-256 | 03bff7e112ead56bef091050e6b708d915bf772d306e452446872519ffe4c50d |