Skip to content

SSH sessions converter - useful tool for all network admins.

License

Notifications You must be signed in to change notification settings

mkyrc/SessionMaker

Repository files navigation

SessionMaker

Description

Excel workbook to SecureCRT and/or Devolutions RDM sessions (and vice-versa) converter. The goal of the project is to make life easier for network engineers ;-).

Important:
Session Reader or Session Maker never works with passwords! There is possible define only usernames (including credentials).

There are two parts:

  • Session Maker - Generate SecureCRT XML or Devolutions RDM JSON file from Excel book source (Excel -> XML/JSON)
  • Session Reader - Generate Excel book from SecureCRT XML sessions export file (XML -> Excel).

Important news

  • Starting version 0.3.0 are worksheets or/and column names for unused settings not required.

Supported features

Feature SecureCRT Devolution RDM Description
Folders yes yes Path to session (or any other object, e.g. credentials,...)
Username yes yes Username (not used when credentials is defined)
Credentials yes yes Credentials definitions (higher preference than username)
SSH Session yes yes SSH session support
RDP Session no yes RDP session support
WEB Session no yes WEB session support
Colorscheme yes no Terminal colorscheme
Keywords yes no Keyword highlighting (per session)
Firewall groups yes no Firewall groups definition (SecureCRT feature)

Session Maker

Reads Excel workbook and generate SecureCRT sessions content (XML file) or Devolutions RDM connections (JSON file).

graph LR;
    Excel["Excel (xlsx)"]-->SM("Session Maker")
    SM-->scrt["SecureCRT (xml)"]
    SM-->rdm["DevolutionsRDM (json)"];
Loading

Usage

It is simple - read help :).

$ python3 session_maker.py -h
usage: session_maker.py [-h] [--config CONFIG] [--type {scrt,rdm}] [--write DESTINATION | -p] [-q | -v] source

Read Excel file (source) and generate sessions XML file for [SecureCRT|Devolutions].

positional arguments:
  source                Source (XLS) file

options:
  -h, --help            show this help message and exit
  --config CONFIG       Configuration settings file (default=config.yaml)
  --type {scrt,rdm}     Destination type: scrt=SecureCRT (default), rdm=DevolutionsRDM
  --write DESTINATION, -w DESTINATION
                        Write to file. If not specified, write to 'export' subfolder as the source.
  -p, --print           Print to screen only (don't write it to the file).
  -q, --quiet           Quiet output.
  -v, --verbose         Verbose output. (use: -v, -vv)

XML content can be exported to:

  • file: Option --write. If not defined, the file is stored in export subfolder
  • stdout: Option --print.

Example

Show Excel -> SecureCRT example

Source file

Excel (source) file:

$ ls data/EXAMPLE/
devices-v0.3.x.xlsx

Build process

Build XML content for SecureCRT from Excel source:

$ python3 session_maker.py data/EXAMPLE/devices-v0.3.x.xlsx
Reading arguments...
Done.
Reading Excel book...
Done: 4 sessions (ssh: 4), 2 credential group(s), 0 firewall group(s) from Excel.
Building sessions...
Done.
Writing to 'data/EXAMPLE/export/devices-v0.3.x.xml'...
Done.

Destination file

XML file is exported to export subfolder (because option --write or --print is not defined):

$ ls data/EXAMPLE/export/
devices-v0.3.x.xml
Show Excel -> Devolution RDM example

Source file

Excel (source) file:

$ ls data/EXAMPLE/
devices-v0.3.x.xlsx

Build process

Build XML content for SecureCRT from Excel source:

$ python3 session_maker.py data/EXAMPLE/devices-v0.3.x.xlsx --type rdm

Reading arguments...
Done.
Reading Excel book...
Done. 12 session(s) (ssh: 4, rdp: 4, web: 4), 2 credential(s) from Excel.
Building sessions...
Done.
Writing to 'data/EXAMPLE/export/devices-v0.3.x.json'...
Done.

Destination file

JSON file is exported to export subfolder (because option --write or --print is not defined):

$ ls data/EXAMPLE/export/
devices-v0.3.x.json

Session Reader

Reads SecureCRT sessions XML file (SecureCRT menu: Tools -> Export settings...) and export it to Excel workbook.

graph LR;
    scrt["SecureCRT (XML)"]-->SR("Session Reader")
    SR-->Excel["Excel (xlsx)"]

Loading

Usage

$ python session_reader.py -h
usage: session_reader.py [-h] [--config CONFIG] [-w DESTINATION] [-q | -v] source

Read SecureCRT sessions XML file (source) and export it to Excel file (write to destination).

positional arguments:
  source                SecureCRT sessions XML file (export from SecureCRT).

options:
  -h, --help            show this help message and exit
  --config CONFIG       Configuration settings file (default=config.yaml)
  -w DESTINATION, --write DESTINATION
                        Write to destination Excel (xlsx) file. If not defined, write to the 'export' subfolder.
  -q, --quiet           Quiet output.
  -v, --verbose         Verbose output (use: -v, -vv).

If --write option is not defined, destination file is exported to export subfolder.

Example

SecureCRT (XML) -> Excel example

Source file

SecureCRT (source) file (it is previously generated Excel file):

$ ls data/EXAMPLE/export/
devices-v0.3.x.xml

Build process

Generate Excel file from SecureCRT XML source file:

$ python3 session_reader.py data/EXAMPLE/export/devices-v0.3.x.xml
Reading arguments...
Done.
Reading SecureCRT sessions XML file...
Done. 4 session(s), 2 credential group(s), 0 firewall group(s) from XML file.
Writing Excel file...
Done.

Destination file

Excel workbook is exported to export subfolder (because option --write is not defined):

$ ls data/EXAMPLE/export/export/
devices.xlsx

Excel workbook structure

Excel workbook contains 4 worksheets:

Note:
All column names described below can be changed in config.yaml file.

'sessions' worksheet columns

column name (Excel) required default description
folder Path/hierarchy to session
session yes Session name
hostname Device hostname (DNS name or IP address)
type yes Session type: [ssh | rdp | web]
port 22 or 3389 TCP port (default: 22 for SSH, 3389 for RDP, not used for WEB)
username Username
rdp alternative RDP alternative shell
Devolution RDM only
rdm credential Credential name
web login form WEB session: Login form name (HTML id)
web login field WEB session: Login field name (HTML id)
web passwd field WEB session: Password field name (HTML id)
SecureCRT only
scrt credentials Credential group name
scrt colorscheme Color Scheme name
scrt keywords Keyword Highlighting List name
scrt firewall group Firewall group or Session name (path/to/session)

Note: For details see ['excel']['col_names_sessions'] in config.yaml file.

'rdm-credentials' worksheet columns

column name required default description
folder Path to credential
credential name yes Credential name
username Username

Note: For details see ['excel']['col_names_rdm_credentials'] in config.yaml file.

'scrt-credentials' worksheet columns

column name required default description
credential group yes Credential group name
username Username

Note: For details see ['excel']['col_names_scrt_credentials'] in config.yaml file.

'scrt-firewalls' worksheet columns

column name required default description
firewall group yes Firewall group name
address IP address or DNS name
port TCP port
username Username

Note: For details see ['excel']['col_names_scrt_firewalls'] in config.yaml file.

Configuration

Excel worksheet and/or column names and SecureCRT custom settings (not configurable by Session Maker) is possible to customize For more detials see config.yaml file.

Versioning

This project use SemVer for versioning. For the versions available, see the tags on main repository.

Authors

  • Martin Kyrc - 2022 - @mkyrc on Github

License

This project is licensed under the MIT License - see the LICENSE.txt file for details.

About

SSH sessions converter - useful tool for all network admins.

Resources

License

Stars

Watchers

Forks

Languages