GithubHelp home page GithubHelp logo

sfordinc / script-server Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bugy/script-server

0.0 2.0 0.0 2.96 MB

License: Other

Python 8.01% Shell 0.13% CSS 1.02% HTML 0.35% JavaScript 90.49%

script-server's Introduction

script-server

This is a simple web-server for hosting and executing scripts on a machine, providing control and output to remote users. Using the script server you can create scripts on a machine with all the needed packages, configs, etc. All users will be able to execute the scripts without any system requirements (except browser) and in user-friendly interface.

Requirements

Python 3. Modules:

  • Tornado

Potentially should work on any OS, but was tested on Debian 8 only.

Secutiry

Completely no security! Use it only in local network for fully trusted users.

Setup and run

  1. Clone/download the repository
  2. Create GUI configs for your scripts in server-path/configs folder (see config structure)
  3. Launch server using python3: python launcher.py Server will be running on 5000 port.

Config structure

{
  /**
    * Required: no
    * Description: user-friendly script name. Will be displayed to user 
    * Type: string
    * Default: script_path filename without extension
    */
  "name": "My example script",
  /**
    * Required: YES
    * Description: path to the script (relative to working directory)
    * Type: string
    */
  "script_path": "/some/path/to/script.sh",
  /**
    * Required: no
    * Description: user-friendly script description, which will be shown to a user
    * Type: string
    */
  "description": "Some useful description on what the script does",
  /**
    * Required: no
    * Description: if the script should be run in emulated terminal (if it has special behaviour in terminal).
    * Type: boolean
    * Default: true
    */
  "requires_terminal": true,
    /**
    * Required: no
    * Description: allows to specify working directory of the script.
    * Type: string
    * Default: the working directory, from which the server was started
    */
  "working_directory": "/home/me/temp",
  /**
    * Required: no
    * Description: list of script parameters
    * Type: array
    */
  "parameters": [
  {
    /**
      * Required: no
      * Description: the name of the parameter, which will be shown to the user. Required for non-constant parameters
      * Type: string
      */
      "name": "MyParam",
      /**
      * Required: no
      * Description: can be used for specifying script parameter name (e.g. script.sh -p myval). Omit this field for position based parameters
      * Type: string
      */
      "param": "-p",
      /**
      * Required: no
      * Description: if true, then no value will be passed to the script, only "param" will be specified
      * Type: boolean
      * Default: false
      */
      "no_value": false,
       /**
      * Required: no
      * Description: user-friendly description of the parameter, shown to the user (not yet implemented in GUI)
      * Type: string
      */
      "description": "This parameter is used for filename",
      /**
      * Required: no
      * Description: if the value of the parameter is required 
      * Type: boolean
      * Default: false
      */
      "required": false,
      /**
      * Required: no
      * Description: default value shown to user
      * Type: string
      */
      "default": "empty",
      /**
      * Required: no
      * Description: don't show parameter to user, but fill it in the script with the value of "default" field
      * Type: boolean
      * Default: false
      */
      "constant": false,
      /**
      * Required: no
      * Description: parameter type. Allowed values: int, list. Any other value will be simple text edit.
      * Type: string
      */
      "type": "int",
      /**
      * Required: no
      * Description: int type only, upper value bound 
      * Type: string
      */
      "max": "50",
      /**
      * Required: no
      * Description: int type only, lower value bound 
      * Type: string
      */
      "min": "-1",
      /**
      * Required: no
      * Description: list type only, array of allowed values for the parameter. Can be either predefined values or result from script invocation
      * Type: array or object
      */
      "values": [ "Apple", "Orange", "Banana" ]
      /** or "values": { "script": "ls /home/me/projects" } */
  }
  ]
}

Logging

All web/operating logs are written to the server-path/logs/server.log Additionally each script execution logs (output and error streams) are written to separate file in server-path/logs/processes. File name format is {script_name}_{client_address}_{date}_{time}.log.

Testing/demo

Script-server has bundled configs/scripts for testing/demo purposes, which are located in testing folder. You can link/copy testing config files to server config files.

script-server's People

Contributors

bugy avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.