Skip to main content

Tool Server Generator

Tool Server Generator is a python program that allows the seamless creation and possible deployment of servers that host tools runable from a bash (ex.: unix filters, scripts, programs, etc.).
This program receives a file with the configuration for the server, from its initiating parametres such as the hosting port, to the tools to provide and some simple visual options to change the site's appearence. It does not however, install the provided tools, meaning that they need to be available from the start in the system that hosts the server.

The server is created using Node.js and express-generator.

Dependencies

The server will be generated using Node.js, which needs to be version 10.5 or above, so as to support worker_threads. All other npm requirements are installed by the program.

To expose the server to a public url, you can use the ngrok options, which assumes that ngrok is already installed and with the authentication done on the host machine.

Usage

To start the program, simply run:

    ts <configuration_file>

Where the configuration_file is a text file that follows the structure explained bellow, or a JSON that fulfills the expected parameters.

Options

-h, --help          show this help message and exit
-s, --start_server  starts server automatically
-ng, --ngrok        uses ngrok to expose port. Needs ngrok installed on the system, authenticated.

Configuration File

The configuration file defines the initiating aspects of the server, but also all the tools that are to be provided and some visual configurations.
In the text format it needs to follow the syntax perceivable from the examples. The order of the fields is important, as is the use of the proper delimeters (ex.: '* Servidor', '- Nome:', '--' between tools).

Server Options

Text File

  • Name: name of the server.
  • Directory: directory where the server will be created and run from.
  • Port: port of the server.
  • Workers: number of workers available to process requests (optional - default 1).

Example:

    * Servidor
    - Nome: Server
    - Diretoria: "test"
    - Porta: 15213
    - Trabalhadores: 2

JSON

The same type of fields are expected, the optional and obligatory are similar. Only the keys are differente.
Example:

    {
        "nome" : "Server",
        "diretoria" : "test",
        "porta" : "15213",
        "workers" : 1,
    }

Tools options

Text File

  • Family : the family of the tool. This allows to group similar tools, or different calls of a tool together. Will determine its route.
  • Title : the name of the specific tool. Will determine it's route.
  • Description : description of the tool.
  • Command: command to run the tool with the specific variable (by the user) inputs delimeted using the exclusive word 'INPUT'.
  • Inputs: for each tool, their variable inputs need to be explicitly configured, otherwise they will be treated in the command as plain text. (optional)
    • Name: input name. (optional)
    • Description: input description. (optional)
    • Type: input type (STR|NUM|FILE).

Example:

* Ferramentas
--
- Família:Grep
- Título: "Grep"
- Descrição: "grep  searches  for  PATTERNS in each FILE.  PATTERNS is one or more patterns separated by newline characters,
and grep prints each line that matches a pattern.  Typically PATTERNS should be quoted when grep is used in  a
shell command."
-Comando: cat INPUT1 | grep INPUT2
-Inputs:
    - INPUT1: 
        - Nome : file
        - Descrição : "File to search for the pattern"
        - Tipo : FILE
    - INPUT2: 
        - Nome : pattern
        - Descrição : "Pattern to search"
        - Tipo : STR

Each tool needs to be delimetd by '--'.

JSON

The same field requirements apply.

    "ferramentas" : {
    "Grep" : {
        "Grep" : {
            "descricao" : "grep  searches  for  PATTERNS in each FILE.  PATTERNS is one or more patterns separated by newline characters,
and grep prints each line that matches a pattern.  Typically PATTERNS should be quoted when grep is used in  a
shell command.",
            "comando" : "cat INPUT1 | grep INPUT2",
            "inputs" : [
                {
                    "id": "INPUT1",
                    "opcoes" : {
                        "nome" : "file",
                        "descricao" : "File to search for the pattern",
                        "tipo" : "FILE"
                    }
                },
                {
                    "id": "INPUT2",
                    "opcoes" : {
                        "nome" : "pattern",
                        "tipo" : "STR",
                        "descricao" : "Pattern to search"
                    }
                }
            ]
        }
    }
}

Visual options

The visual options are totally optional.

Text File

  • Favicon : website favicon.
  • Colors : configure website pallete.

Example:

* Visuais
- Favicon : "image.png"
- PrimaryBgColor : #000
- SecondaryBgColor : #fff
- PrimaryTextColor : #fff
- SecondaryTextColor : #3f51b5
- LabelColor : #3f51b5
- BorderColor : #9e9e9e

All the color options are present in the example above.

JSON

The same field requirements apply.

"visuais":{
        "favicon" : "unknown2.png",
        "colors" : {
                "primary_text_color" : "#000",
                "secondary_text_color" : "#fff",
                "primary_bg_color" : "#fff",
                "secondary_bg_color" : "#3f51b5",
                "label_color" : "#3f51b5",
                "border_color" : "#9e9e9e",
                }
    }

Server configuration file examples are available on the 'examples' folder.

Metadata

Release files for tool_server_generator 0.4.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tool_server_generator 0.4.4
File Size Uploaded
tool_server_generator-0.4.4.tar.gz 40.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tool_server_generator 0.4.4
File Interpreter ABI Platform
tool_server_generator-0.4.4-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 85.5 kB

Release files / tool_server_generator-0.4.4.tar.gz

Download URL tool_server_generator-0.4.4.tar.gz
Size 40.9 kB
Tags Source
SHA-256 checksum
How to use checksums
094c46b6598c29f3b8c52a2607cc6bab98e7a1b131a7c2cc0e028ef203db2e9a
BLAKE2b-256 checksum
How to use checksums
738a33db01cbe920eaf357fb1eb993fe2565a0cf9c77b30fa857c344f41c3c78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.22.0

Release files / tool_server_generator-0.4.4-py2.py3-none-any.whl

Download URL tool_server_generator-0.4.4-py2.py3-none-any.whl
Size 44.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
ef33edf79c19778e37e8b5afd608e1e7e87f62a066319b939e9a015c2c1a2ded
BLAKE2b-256 checksum
How to use checksums
b6296046eb5e2c41d87f8766b08f108c1c7be9fd6f6f9c48541eb5c56e249267
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.22.0

Release history Release notifications | RSS feed

This release

0.4.4 This release

2 release files

0.4.3

2 release files

0.4.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page