diff --git a/static/css/webscripts_index_style.css b/static/css/webscripts_index_style.css deleted file mode 100644 index ece68463..00000000 --- a/static/css/webscripts_index_style.css +++ /dev/null @@ -1,37 +0,0 @@ -/* - - Style for index page - Copyright (C) 2021, 2022 Maurice Lambert - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -*/ - -.category_content { - width: 15%; - padding: 1%%; - display: inline-block; - margin-bottom: 2%; - margin-right: 2%; - border-radius: 4px; - transition: 0.3s; -} - -.category_content:hover { - background-color: rgb(51, 51, 51); -} - -.category_content.light:hover { - background-color: rgb(221, 221, 221); -} diff --git a/static/css/webscripts_script_style.css b/static/css/webscripts_script_style.css deleted file mode 100644 index d8c023cf..00000000 --- a/static/css/webscripts_script_style.css +++ /dev/null @@ -1,256 +0,0 @@ -/* - - Style for script.html - Copyright (C) 2021, 2022 Maurice Lambert - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -*/ - -input, select, button { - padding: 1%; - width: 100%; - background-color: #222222; - color: #dd8a12; - transition: 0.5s; - font-size: 100%; - border: 2px solid #f0a83f; - border-radius: 10px; - /* float:right; */ -} - -button { - border: 1px solid #f0a83f; -} - -input:hover, select:hover, button:hover { - background-color: #333333; -} - -code, pre { - padding: 0.3%; -} - -table, tr, td { - padding: 1rem; - margin: 1%; -} - -table { - border-spacing: 0.2rem; - margin: 0px; -} - -td { - border: 1px solid #dd8a12; -} - -select option:checked { - background: #895100 -webkit-linear-gradient(bottom, #895100 0%, #895100 100%); - color: #FFFFFF; -} - -select option:hover { - background: #895100 -webkit-linear-gradient(bottom, #895100 0%, #895100 100%); - color: #FFFFFF; -} - -select.light option.light:checked { - background: #615CB9 -webkit-linear-gradient(bottom, #615CB9 0%, #615CB9 100%); - color: #CCCCCC; -} - -select.light option.light:hover { - background: #615CB9 -webkit-linear-gradient(bottom, #615CB9 0%, #615CB9 100%); - color: #CCCCCC; -} - -select.light { - color: #27219a; - border-color: #100B60; -} - -option.light { - color: #27219a; -} - -progress { - background-color: #222222; - width: 98%; - fill: #895100; - border: 1px solid #ffc26a; - lighting-color: #895100; - border-radius: 10px; - margin: 2%; -} - -progress::-moz-progress-bar { - background: #895100; - border-radius: 10px; -} - -progress::-webkit-progress-value { - background: #895100; - border-radius: 10px; -} - -progress.light { - background-color: #CCCCCC; - fill: #615CB9; - border: 1px solid #0F0B60; - lighting-color: #615CB9; -} - -progress.light::-moz-progress-bar { - background: #615CB9; -} - -progress.light::-webkit-progress-value { - background: #615CB9; -} - -/*input[type=checkbox]:before { - background: #895100; - color: #000000; -} - -input[type=checkbox]:checked:after { - background: #000000; - color: #895100; -}*/ - -/* ::-ms-check { - color: red; - background: black; - padding: 1em; -} */ - -.argument_container { - width: 60%; - margin: 1%; -} - -.submit { - background-color: #f0a83f; - color: #895100; - border-color: #895100; - width: 100%; - padding: 2%; -} - -input.submit.light { - color: #DDDDDD; - background-color: #615CB9; -} - -input.submit.light:hover { - background-color: #27219a; -} - -input:disabled { - background-color: #895100; - color: #333333; -} - -input.light:disabled { - background-color: #0F0B60; - color: #CCCCCC; -} - -.submit_position { - margin: 0 auto; - width: 30%; -} - -.row { - width:100%; - display:block; -} - -.script_presentation { - width: 17%; -} - -.webscripts_search_table { - width: 40%; - margin: 1%; - padding: 0.3%; - border: 0px; -} - -.webscripts_search_table:hover { - border: 1px solid #895100; -} - -.webscripts_column_select { - color: #DDAD12; -} - -.webscripts_column_select.selected { - color: #2AA177; -} - -.webscripts_column_select.unselected { - color: #F0783F; -} - -.webscripts_column_select.light { - color: #531895; -} - -.webscripts_column_select.light.selected { - color: #4AB18F; -} - -.webscripts_column_select.light.unselected { - color: #F07B3F; -} - -#script_presentation { - margin: 1%; -} - -#script_outputs { - margin-top: 1%; -} - -#advanced_button_arguments { - width: 10%; - float: right; -} - -#advanced_arguments { - display: none; -} - -#print_advanced { - background-color: #895100; - border-radius: 5px; - border: 2px solid #dd8a12; - color: #222222; -} - -#print_advanced:hover { - background-color: #b16b05; -} - -.light#print_advanced { - color: #433DA7; - background-color: #CCCCCC; - border: 2px solid #433DA7; -} - -.light#print_advanced:hover { - background-color: #AAAAAA; -} \ No newline at end of file diff --git a/static/css/webscripts_style.css b/static/css/webscripts_style.css deleted file mode 100644 index 5840f264..00000000 --- a/static/css/webscripts_style.css +++ /dev/null @@ -1,537 +0,0 @@ -/* - - Style for WebScript pages. - Copyright (C) 2021, 2022 Maurice Lambert - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -*/ - -/* - * Colors: - - ------------------------------ - - DARK - - ------------------------------ - - #ffc26a: Orange clair; - #f0a83f: Orange mi-clair; - #dd8a12 rgb(221, 138, 18) : Orange; - #b16b05: Orange mi-foncé; - #895100: Orange foncé; - - #DDAD12: Jaune; - #896900: Jaune foncé; - #FFDC6A: Jaune clair; - - #222222: Gris foncé; - #333333: Gris clair; - - #2AA177: Vert mi-clair; - #F0783F: Rouge mi-clair; - - ------------------------------ - - LIGHT - - ------------------------------ - - #615CB9: Bleu clair; - #433DA7: Bleu mi-clair; - #27219a: Bleu; - #100B60: Bleu mi-foncé; - #0F0B60: Bleu foncé; - - #531895: violet; - #3F0D78: violet mi-foncé; - #DDAD13: orange; - #B18906: orange mi-foncé; - - #DDDDDD: Gris clair; - #CCCCCC: Gris foncé; - - #4AB18F: Vert mi-clair; - #F07B3F: Rouge mi-clair; -*/ - -* { - margin: 0; - padding: 0; -} - -body, html { - margin: 0%; - padding: 0%; - width: 100%; - height: 100%; - /*overflow: hidden;*/ - font-family : Arial, Helvetica, "Liberation Sans", FreeSans, sans-serif; - /*overflow-y:scroll;*/ - background-color: #222222; -} - -header, footer { - font-style: italic; - padding: 2%; -} - -header { - /*position: fixed;*/ -} - -pre { - tab-size: 4; - background-color: black; - color: white; - font-family: "Courier", "Lucida Console", "Consolas", "sans-serif"; - font-size: 100%; -} - -a { - color: #895100; -} - -button { - padding: 1%; - width: 100%; - background-color: #222222; - color: #dd8a12; - transition: 0.5s; - font-size: 100%; - border: 2px solid #f0a83f; - border-radius: 10px; -} - -.notification { - width: 17%; - display: inline-block; - color: #DDAD12; - text-align: center; - border: 1px solid #333333; - border-radius: 4px; -} - -.notification_user { - font-style: italic; - color: #FFDC6A; - font-weight: 400; -} - -.notification_close { - padding: 1%; - width: auto; - font-size: 10px; - border: 1px solid #333333; - float: right; - border-radius: 4px; -} - -.notification_close:hover { - background-color: #333333; -} - -.border { - color: #ffc26a; -} - -.description { - font-style: italic; - font-size: 80%; -} - -.inline { - display: inline-block; -} - -.center { - text-align: center; -} - -.header_border { - width: 20%; -} - -.header_center { - margin-right: 20%; - margin-left: 20%; -} - -.header_container { - display: inline-block; - width: 20%; -} - -.search_result { - background-color: #2F2F2F; - border: 1px solid #181818; - padding: 1%; - transition: 0.5s; -} - -.search_result_description { - color: #b16b05; -} - -.webscripts_menu_button { - margin: 0%; - padding: 0%; - width: 49.5%; - color: #FFDC6A; - border-radius: 0px; - text-align: center; - border: 0px solid #333333; - background-color: #222222; - transition: 0.2s; - display: inline-block; -} - -.webscripts_menu_values { - margin: 0%; - padding: 0%; - width: 49.5%; - display: none; -} - -div.category { - background-color: rgba(34, 34, 34, 0.7); - border-radius: 5px; - margin: 3px; - padding: 3px; - /*width: auto;*/ -} - -div.category.light { - background-color: rgba(204, 204, 204, 0.7); - border-radius: 3px; - margin: 2px; -} - -.search_result_description.light { - color: #100B60; -} - -.border.light, button.light { - color: #0F0B60; -} - -.webscripts_menu_button.light { - background-color: #DDDDDD; - border: 0px solid #CCCCCC; - color: #3F0D78; -} - -.search_result:hover { - background-color: #222222; -} - -.search_result.light { - background-color: rgb(221, 221, 221); - color: #100B60; - border-color: #615CB9; -} - -.search_result.light:hover { - background-color: #CCCCCC; -} - -.list.footer { - font-size: 80%; - margin-bottom: 1%; -} - -.webscripts_menu_button:hover { - background-color: #333333; - color: #896900; - border: 1px solid #896900; -} - -.webscripts_menu_button.light:hover { - background-color: #CCCCCC; - color: #B18906; - border: 1px solid #B18906; -} - -html.light, body.light, button.light, input.light, select.light { - background-color: #CCCCCC; -} - -input.light:hover, select.light:hover, button.light:hover { - background-color: #DDDDDD; -} - -a.light { - color: #615CB9; -} - -button.light { - border-color: #0F0B60; -} - -#webscripts_history { - float: right; -} - -#webscripts_menu_options { - margin: 0%; - width: 100%; - padding: 0%; -} - -#webscripts_menu { - padding: 0%; - border-radius: 10px; - background-color: #222222; - border: 1px solid #333333; -} - -#webscripts_menu.light { - background-color: #DDDDDD; - border: 1px solid #CCCCCC; -} - -#webscripts_menu_button_left { - border-radius: 10px 0px 0px 10px; -} - -#webscripts_menu_button_right { - border-radius: 0px 10px 10px 0px; -} - -#webscripts_content { - background-color: #333333; - color: #dd8a12; - padding: 2%; - width: 87%; - display: inline-block; - border: 1px solid #b16b05; - border-radius: 10px; - margin: 4%; -} - -#webscripts_title { - font-size: 120%; -} - -#webscripts_description { - font-size: 80%; -} - -#webscripts_header_image_position { - display: inline-block; - margin-left: 58%; -} - -#webscripts_search_bar_size { - /* background-image: radial-gradient(#222222 10%, transparent 3%); */ - display: inline-block; - padding-top: 2%; - padding-bottom: 2%; - padding-left: 10%; - padding-right: 10%; - position: fixed; - width: 38%; -} - -#webscripts_search_bar { - padding: 2%; - width: 100%; - background-color: #333; - color: rgb(255, 194, 106); - border: 1px solid #895100; - border-radius: 3px; -} - -#webscripts_search_bar.light { - background-color: rgb(221, 221, 221); - color: #100B60; - border-color: #615CB9; -} - -#search_result { - display: none; -} - -#prevent_no_javascript { - background-color: red; - padding: 2%; - margin: 3%; - font-weight: bold; - font-size: 120%; -} - -#webscripts_header_canvas_image { - animation: rotate 5s 2; -} - -#webscripts_content.light { - background-color: #DDDDDD; -} - -#bar.light { - background-color: #615CB9; - color: #0F0B60; -} - -/* -#webscripts_search_bar_size.light { - background-image: radial-gradient(#CCCCCC 10%, transparent); -} -*/ - -#webscripts_content.light, input.light, td.light { - color: #100B60; - border-color: #100B60; -} - -::-moz-selection { /* Code for Firefox */ - color: #333333; - background: #f0a83f; -} - -::selection { - color: #333333; - background: #f0a83f; -} - -.toast { - visibility: hidden; - margin: auto; - background-color: #666; - color: #fff; - text-align: center; - border-radius: 5px; - padding: 16px; - position: fixed; - left: 47%; - bottom: 7%; -} - -.toast.show { - visibility: visible; - -webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s; - animation: fadein 0.5s, fadeout 0.5s 2.5s; -} - -@-webkit-keyframes fadein { - from {bottom: 0; opacity: 0;} - to {bottom: 7%; opacity: 1;} -} - -@keyframes fadein { - from {bottom: 0; opacity: 0;} - to {bottom: 7%; opacity: 1;} -} - -@-webkit-keyframes fadeout { - from {bottom: 30px; opacity: 1;} - to {bottom: 0; opacity: 0;} -} - -@keyframes fadeout { - from {bottom: 30px; opacity: 1;} - to {bottom: 0; opacity: 0;} -} - -@media (prefers-color-scheme: dark) { - html.default_theme, body.default_theme, button.default_theme, input.default_theme, select.default_theme { - background-color: #222222; - } - - input.default_theme:hover, select.default_theme:hover, button.default_theme:hover { - background-color: #333333; - } - - a.default_theme { - color: #895100; - } - - #webscripts_content.default_theme { - background-color: #333333; - } - - .border.default_theme { - color: #ffc26a; - } - - button.default_theme, input.default_theme, select.default_theme { - color: #dd8a12; - border-color: #f0a83f; - } - - #webscripts_content.default_theme, td.default_theme { - color: #dd8a12; - border-color: #b16b05; - } - - #bar.default_theme { - background-color: #895100; - color: #ffc26a; - } - - td.default_theme { - border-color: #dd8a12; - } -} - -@media (prefers-color-scheme: light) { - html.default_theme, body.default_theme, button.default_theme, input.default_theme, select.default_theme { - background-color: #CCCCCC; - } - - input.default_theme:hover, select.default_theme:hover, button.default_theme:hover { - background-color: #DDDDDD; - } - - a.default_theme { - color: #615CB9; - } - - #webscripts_content.default_theme { - background-color: #DDDDDD; - } - - .border.default_theme, button.default_theme { - color: #0F0B60; - } - - #bar.default_theme { - background-color: #615CB9; - color: #0F0B60; - } - - button.default_theme { - border-color: #0F0B60; - } - - #webscripts_content.default_theme, input.default_theme, td.default_theme { - color: #100B60; - border-color: #100B60; - } -} - -@keyframes rotate { - 0% { - transform: rotate(0deg) - } - 20% { - transform: rotate(72deg) - } - 40% { - transform: rotate(144deg) - } - 60% { - transform: rotate(288deg) - } - 80% { - transform: rotate(360deg) - } -} \ No newline at end of file diff --git a/static/html/Configurations.html b/static/html/Configurations.html deleted file mode 100644 index 4ccdc495..00000000 --- a/static/html/Configurations.html +++ /dev/null @@ -1,97 +0,0 @@ - -Python: module Configurations - - - - - -
 
- 
Configurations (version 0.0.1)
index
configurations.py
-

This tool runs CLI scripts and displays output in a Web Interface.

-This file implements a debug mode module to changes configurations
-and reload modules.

-

- - - - - -
 
-Classes
       
-
builtins.object -
-
-
Reload -
-
-
-

- - - - - -
 
-class Reload(builtins.object)
    Methods defined here:
-
arguments(environ: os._Environ, user: ~User, server: ~Server, name: str, arguments: Dict[str, Dict[str, str]], inputs: List[str], csrf_token: str = None) -> Tuple[str, Dict[str, str], str]
This function reloads a argument configuration.
- -
module(environ: os._Environ, user: ~User, server: ~Server, name: str, arguments: Dict[str, Dict[str, str]], inputs: List[str], csrf_token: str = None) -> Tuple[str, Dict[str, str], str]
This function reloads a module.
- -
modules(environ: os._Environ, user: ~User, server: ~Server, name: str, arguments: Dict[str, Dict[str, str]], inputs: List[str], csrf_token: str = None) -> Tuple[str, Dict[str, str], str]
This function adds new modules.
- -
scripts(environ: os._Environ, user: ~User, server: ~Server, name: str, arguments: Dict[str, Dict[str, str]], inputs: List[str], csrf_token: str = None) -> Tuple[str, Dict[str, str], str]
This function reloads a script configuration.
- -
server(environ: os._Environ, user: ~User, server: ~Server, name: str, arguments: Dict[str, Dict[str, str]], inputs: List[str], csrf_token: str = None) -> Tuple[str, Dict[str, str], str]
This function reloads the configuration.
- -
web(environ: os._Environ, user: ~User, server: ~Server, name: str, arguments: Dict[str, Dict[str, str]], inputs: List[str], csrf_token: str = None) -> Tuple[str, Dict[str, str], str]
This function reloads web files (JS, CSS and HTML).
- -
-Data descriptors defined here:
-
__dict__
-
dictionary for instance variables (if defined)
-
-
__weakref__
-
list of weak references to the object (if defined)
-
-
-Data and other attributes defined here:
-
__annotations__ = {'accept_types': typing.Tuple[type], 'html': <class 'str'>, 'simple_types': typing.Tuple[type]}
- -
accept_types = (<class 'list'>, <class 'NoneType'>, <class 'str'>, <class 'bool'>, <class 'int'>, <class 'float'>)
- -
html = '\n <html><head><title>WebScripts Server co... }}\n </script></footer></body></html>\n '
- -
simple_types = (<class 'NoneType'>, <class 'str'>, <class 'bool'>, <class 'int'>, <class 'float'>)
- -

- - - - - -
 
-Data
       Dict = typing.Dict
-List = typing.List
-Server = ~Server
-Tuple = typing.Tuple
-User = ~User
-__author_email__ = 'mauricelambert434@gmail.com'
-__copyright__ = '\nWebScripts Copyright (C) 2021, 2022, 2023 Mau...ome to redistribute it\nunder certain conditions.\n'
-__description__ = '\nThis tool runs CLI scripts and displays output ...le to changes configurations\nand reload modules.\n'
-__license__ = 'GPL-3.0 License'
-__maintainer__ = 'Maurice Lambert'
-__maintainer_email__ = 'mauricelambert434@gmail.com'
-__url__ = 'https://github.com/mauricelambert/WebScripts'
-copyright = '\nWebScripts Copyright (C) 2021, 2022, 2023 Mau...ome to redistribute it\nunder certain conditions.\n'
-license = 'GPL-3.0 License'

- - - - - -
 
-Author
       Maurice Lambert
- \ No newline at end of file diff --git a/static/html/Errors.html b/static/html/Errors.html deleted file mode 100644 index 3b2922f4..00000000 --- a/static/html/Errors.html +++ /dev/null @@ -1,515 +0,0 @@ - -Python: module Errors - - - - - -
 
- 
Errors (version 0.0.2)
index
errors.py
-

This tool runs CLI scripts and displays output in a Web Interface.

-This file contains WebScripts exception classes.

-

- - - - - -
 
-Classes
       
-
builtins.Exception(builtins.BaseException) -
-
-
WebScriptsError -
-
-
MissingAttributesError -
WebScriptsArgumentError -
WebScriptsConfigurationError -
-
-
ScriptConfigurationError -
WebScriptsConfigurationTypeError -
-
-
WebScriptsSecurityError -
-
-
-
-
-

- - - - - - - -
 
-class MissingAttributesError(WebScriptsError)
   To raise Missing Attributes Error.
 
 
Method resolution order:
-
MissingAttributesError
-
WebScriptsError
-
builtins.Exception
-
builtins.BaseException
-
builtins.object
-
-
-Data descriptors inherited from WebScriptsError:
-
__weakref__
-
list of weak references to the object (if defined)
-
-
-Methods inherited from builtins.Exception:
-
__init__(self, /, *args, **kwargs)
Initialize self.  See help(type(self)) for accurate signature.
- -
-Static methods inherited from builtins.Exception:
-
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.
- -
-Methods inherited from builtins.BaseException:
-
__delattr__(self, name, /)
Implement delattr(self, name).
- -
__getattribute__(self, name, /)
Return getattr(self, name).
- -
__reduce__(...)
Helper for pickle.
- -
__repr__(self, /)
Return repr(self).
- -
__setattr__(self, name, value, /)
Implement setattr(self, name, value).
- -
__setstate__(...)
- -
__str__(self, /)
Return str(self).
- -
with_traceback(...)
Exception.with_traceback(tb) --
-set self.__traceback__ to tb and return self.
- -
-Data descriptors inherited from builtins.BaseException:
-
__cause__
-
exception cause
-
-
__context__
-
exception context
-
-
__dict__
-
-
__suppress_context__
-
-
__traceback__
-
-
args
-
-

- - - - - - - -
 
-class ScriptConfigurationError(WebScriptsConfigurationError)
   To raise Script Configuration Error.
 
 
Method resolution order:
-
ScriptConfigurationError
-
WebScriptsConfigurationError
-
WebScriptsError
-
builtins.Exception
-
builtins.BaseException
-
builtins.object
-
-
-Data descriptors inherited from WebScriptsError:
-
__weakref__
-
list of weak references to the object (if defined)
-
-
-Methods inherited from builtins.Exception:
-
__init__(self, /, *args, **kwargs)
Initialize self.  See help(type(self)) for accurate signature.
- -
-Static methods inherited from builtins.Exception:
-
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.
- -
-Methods inherited from builtins.BaseException:
-
__delattr__(self, name, /)
Implement delattr(self, name).
- -
__getattribute__(self, name, /)
Return getattr(self, name).
- -
__reduce__(...)
Helper for pickle.
- -
__repr__(self, /)
Return repr(self).
- -
__setattr__(self, name, value, /)
Implement setattr(self, name, value).
- -
__setstate__(...)
- -
__str__(self, /)
Return str(self).
- -
with_traceback(...)
Exception.with_traceback(tb) --
-set self.__traceback__ to tb and return self.
- -
-Data descriptors inherited from builtins.BaseException:
-
__cause__
-
exception cause
-
-
__context__
-
exception context
-
-
__dict__
-
-
__suppress_context__
-
-
__traceback__
-
-
args
-
-

- - - - - - - -
 
-class WebScriptsArgumentError(WebScriptsError)
   To raise Argument Error.
 
 
Method resolution order:
-
WebScriptsArgumentError
-
WebScriptsError
-
builtins.Exception
-
builtins.BaseException
-
builtins.object
-
-
-Data descriptors inherited from WebScriptsError:
-
__weakref__
-
list of weak references to the object (if defined)
-
-
-Methods inherited from builtins.Exception:
-
__init__(self, /, *args, **kwargs)
Initialize self.  See help(type(self)) for accurate signature.
- -
-Static methods inherited from builtins.Exception:
-
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.
- -
-Methods inherited from builtins.BaseException:
-
__delattr__(self, name, /)
Implement delattr(self, name).
- -
__getattribute__(self, name, /)
Return getattr(self, name).
- -
__reduce__(...)
Helper for pickle.
- -
__repr__(self, /)
Return repr(self).
- -
__setattr__(self, name, value, /)
Implement setattr(self, name, value).
- -
__setstate__(...)
- -
__str__(self, /)
Return str(self).
- -
with_traceback(...)
Exception.with_traceback(tb) --
-set self.__traceback__ to tb and return self.
- -
-Data descriptors inherited from builtins.BaseException:
-
__cause__
-
exception cause
-
-
__context__
-
exception context
-
-
__dict__
-
-
__suppress_context__
-
-
__traceback__
-
-
args
-
-

- - - - - - - -
 
-class WebScriptsConfigurationError(WebScriptsError)
   To raise Configuration Error.
 
 
Method resolution order:
-
WebScriptsConfigurationError
-
WebScriptsError
-
builtins.Exception
-
builtins.BaseException
-
builtins.object
-
-
-Data descriptors inherited from WebScriptsError:
-
__weakref__
-
list of weak references to the object (if defined)
-
-
-Methods inherited from builtins.Exception:
-
__init__(self, /, *args, **kwargs)
Initialize self.  See help(type(self)) for accurate signature.
- -
-Static methods inherited from builtins.Exception:
-
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.
- -
-Methods inherited from builtins.BaseException:
-
__delattr__(self, name, /)
Implement delattr(self, name).
- -
__getattribute__(self, name, /)
Return getattr(self, name).
- -
__reduce__(...)
Helper for pickle.
- -
__repr__(self, /)
Return repr(self).
- -
__setattr__(self, name, value, /)
Implement setattr(self, name, value).
- -
__setstate__(...)
- -
__str__(self, /)
Return str(self).
- -
with_traceback(...)
Exception.with_traceback(tb) --
-set self.__traceback__ to tb and return self.
- -
-Data descriptors inherited from builtins.BaseException:
-
__cause__
-
exception cause
-
-
__context__
-
exception context
-
-
__dict__
-
-
__suppress_context__
-
-
__traceback__
-
-
args
-
-

- - - - - - - -
 
-class WebScriptsConfigurationTypeError(WebScriptsConfigurationError)
   To raise Configuration Error.
 
 
Method resolution order:
-
WebScriptsConfigurationTypeError
-
WebScriptsConfigurationError
-
WebScriptsError
-
builtins.Exception
-
builtins.BaseException
-
builtins.object
-
-
-Data descriptors inherited from WebScriptsError:
-
__weakref__
-
list of weak references to the object (if defined)
-
-
-Methods inherited from builtins.Exception:
-
__init__(self, /, *args, **kwargs)
Initialize self.  See help(type(self)) for accurate signature.
- -
-Static methods inherited from builtins.Exception:
-
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.
- -
-Methods inherited from builtins.BaseException:
-
__delattr__(self, name, /)
Implement delattr(self, name).
- -
__getattribute__(self, name, /)
Return getattr(self, name).
- -
__reduce__(...)
Helper for pickle.
- -
__repr__(self, /)
Return repr(self).
- -
__setattr__(self, name, value, /)
Implement setattr(self, name, value).
- -
__setstate__(...)
- -
__str__(self, /)
Return str(self).
- -
with_traceback(...)
Exception.with_traceback(tb) --
-set self.__traceback__ to tb and return self.
- -
-Data descriptors inherited from builtins.BaseException:
-
__cause__
-
exception cause
-
-
__context__
-
exception context
-
-
__dict__
-
-
__suppress_context__
-
-
__traceback__
-
-
args
-
-

- - - - - - - -
 
-class WebScriptsError(builtins.Exception)
   To raise WebScripts errors
 
 
Method resolution order:
-
WebScriptsError
-
builtins.Exception
-
builtins.BaseException
-
builtins.object
-
-
-Data descriptors defined here:
-
__weakref__
-
list of weak references to the object (if defined)
-
-
-Methods inherited from builtins.Exception:
-
__init__(self, /, *args, **kwargs)
Initialize self.  See help(type(self)) for accurate signature.
- -
-Static methods inherited from builtins.Exception:
-
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.
- -
-Methods inherited from builtins.BaseException:
-
__delattr__(self, name, /)
Implement delattr(self, name).
- -
__getattribute__(self, name, /)
Return getattr(self, name).
- -
__reduce__(...)
Helper for pickle.
- -
__repr__(self, /)
Return repr(self).
- -
__setattr__(self, name, value, /)
Implement setattr(self, name, value).
- -
__setstate__(...)
- -
__str__(self, /)
Return str(self).
- -
with_traceback(...)
Exception.with_traceback(tb) --
-set self.__traceback__ to tb and return self.
- -
-Data descriptors inherited from builtins.BaseException:
-
__cause__
-
exception cause
-
-
__context__
-
exception context
-
-
__dict__
-
-
__suppress_context__
-
-
__traceback__
-
-
args
-
-

- - - - - - - -
 
-class WebScriptsSecurityError(WebScriptsError)
   To raise Security Error in WebScripts services.
 
 
Method resolution order:
-
WebScriptsSecurityError
-
WebScriptsError
-
builtins.Exception
-
builtins.BaseException
-
builtins.object
-
-
-Data descriptors inherited from WebScriptsError:
-
__weakref__
-
list of weak references to the object (if defined)
-
-
-Methods inherited from builtins.Exception:
-
__init__(self, /, *args, **kwargs)
Initialize self.  See help(type(self)) for accurate signature.
- -
-Static methods inherited from builtins.Exception:
-
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.
- -
-Methods inherited from builtins.BaseException:
-
__delattr__(self, name, /)
Implement delattr(self, name).
- -
__getattribute__(self, name, /)
Return getattr(self, name).
- -
__reduce__(...)
Helper for pickle.
- -
__repr__(self, /)
Return repr(self).
- -
__setattr__(self, name, value, /)
Implement setattr(self, name, value).
- -
__setstate__(...)
- -
__str__(self, /)
Return str(self).
- -
with_traceback(...)
Exception.with_traceback(tb) --
-set self.__traceback__ to tb and return self.
- -
-Data descriptors inherited from builtins.BaseException:
-
__cause__
-
exception cause
-
-
__context__
-
exception context
-
-
__dict__
-
-
__suppress_context__
-
-
__traceback__
-
-
args
-
-

- - - - - -
 
-Data
       __all__ = ['WebScriptsError', 'WebScriptsConfigurationError', 'WebScriptsArgumentError', 'ScriptConfigurationError', 'MissingAttributesError', 'WebScriptsConfigurationTypeError', 'WebScriptsSecurityError']
-__author_email__ = 'mauricelambert434@gmail.com'
-__copyright__ = '\nWebScripts Copyright (C) 2021, 2022, 2023 Mau...ome to redistribute it\nunder certain conditions.\n'
-__description__ = '\nThis tool runs CLI scripts and displays output ...This file contains WebScripts exception classes.\n'
-__license__ = 'GPL-3.0 License'
-__maintainer__ = 'Maurice Lambert'
-__maintainer_email__ = 'mauricelambert434@gmail.com'
-__url__ = 'https://github.com/mauricelambert/WebScripts'

- - - - - -
 
-Author
       Maurice Lambert
- \ No newline at end of file diff --git a/static/html/JsonRpc.html b/static/html/JsonRpc.html deleted file mode 100644 index c7de29f7..00000000 --- a/static/html/JsonRpc.html +++ /dev/null @@ -1,86 +0,0 @@ - -Python: module JsonRpc - - - - - -
 
- 
JsonRpc (version 1.0.0)
index
jsonrpc.py
-

This tool runs CLI scripts and displays output in a Web Interface.

-This module implements JSON RPC on WebScripts.

-

- - - - - -
 
-Classes
       
-
builtins.object -
-
-
JsonRpc -
-
-
-

- - - - - - - -
 
-class JsonRpc(builtins.object)
   JsonRpc(environ: os._Environ, user: ~User, server: ~Server, filename: str, calls: Union[List[Dict[str, Any]], Dict[str, Any]], inputs: List[str], csrf_token: str = None) -&gt; Tuple[str, Dict[str, str], str]

-This class implements JSON RPC for the WebScripts Server.
 
 Class methods defined here:
-
execute_call(json: Dict[str, Any]) -> Dict[str, Any] from builtins.type
This function performs a JSON RPC call.
- -
register_function(function: collections.abc.Callable, name: str = None) from builtins.type
This function adds a new function in the JSON RPC calls.
- -
-Static methods defined here:
-
__new__(cls: type, environ: os._Environ, user: ~User, server: ~Server, filename: str, calls: Union[List[Dict[str, Any]], Dict[str, Any]], inputs: List[str], csrf_token: str = None) -> Tuple[str, Dict[str, str], str]
Create and return a new object.  See help(type) for accurate signature.
- -
-Data descriptors defined here:
-
__dict__
-
dictionary for instance variables (if defined)
-
-
__weakref__
-
list of weak references to the object (if defined)
-
-
-Data and other attributes defined here:
-
__annotations__ = {'functions': typing.Dict[str, collections.abc.Callable]}
- -
functions = {'call': <function test_call>, 'test_args_dict': <function test_argument_dict>, 'test_argument_list': <function test_argument_list>}
- -

- - - - - -
 
-Data
       __all__ = ['JsonRpc']
-__author_email__ = 'mauricelambert434@gmail.com'
-__copyright__ = '\nWebScripts Copyright (C) 2021, 2022, 2023 Mau...ome to redistribute it\nunder certain conditions.\n'
-__description__ = '\nThis tool runs CLI scripts and displays output ...\n\nThis module implements JSON RPC on WebScripts.\n'
-__license__ = 'GPL-3.0 License'
-__maintainer__ = 'Maurice Lambert'
-__maintainer_email__ = 'mauricelambert434@gmail.com'
-__url__ = 'https://github.com/mauricelambert/WebScripts'

- - - - - -
 
-Author
       Maurice Lambert
- \ No newline at end of file diff --git a/static/html/Pages.html b/static/html/Pages.html deleted file mode 100644 index 11bd503d..00000000 --- a/static/html/Pages.html +++ /dev/null @@ -1,111 +0,0 @@ - -Python: module Pages - - - - - -
 
- 
Pages (version 2.0.4)
index
pages.py
-

This tool runs CLI scripts and displays output in a Web Interface.

-This file implement Pages (Api and Web system), script execution and right
-system.

-

- - - - - -
 
-Modules
       
ntpath
-

- - - - - -
 
-Classes
       
-
builtins.object -
-
-
Pages -
-
-
-

- - - - - - - -
 
-class Pages(builtins.object)
   This class implement Web Pages for WebScripts server.
 
 Methods defined here:
-
__call__(self, environ: os._Environ, user: commons.User, server: ~Server, filename: str, command: List[str], inputs: List[str], csrf_token: str = None) -> Tuple[str, Dict[str, str], bytes]
A redirect page (Error code 301, javascript redirect and redirect
-title) to /web/ or /api/.
- -
auth(self, environ: os._Environ, user: commons.User, server: ~Server, filename: str, command: List[str], inputs: List[str], csrf_token: str = None) -> Tuple[str, Dict[str, str], bytes]
This function return check auth and return headers, error and page.
- -
js(self, environ: os._Environ, user: commons.User, server: ~Server, filename: str, command: List[str], inputs: List[str], csrf_token: str = None) -> Tuple[str, Dict[str, str], Union[bytes, Iterable[bytes]]]
This function get Javascripts Scripts and send it.
- -
reload(self, environ: os._Environ, user: commons.User, server: ~Server, filename: str, command: List[str], inputs: List[str], csrf_token: str = None) -> Tuple[str, Dict[str, str], str]
This function is a simple URL to reload scripts
-(useful for developpers to add/modify a script).
- -
static(self, environ: os._Environ, user: commons.User, server: ~Server, filename: str, command: List[str], inputs: List[str], csrf_token: str = None) -> Tuple[str, Dict[str, str], Union[bytes, Iterable[bytes]]]
This function get static file and send it.
- -
-Static methods defined here:
-
webfile(files: Dict[str, commons.CallableFile], user: commons.User, filename: str, base: str) -> Tuple[str, Dict[str, str], Union[bytes, Iterable[bytes]]]
This function builds response for Web files.
- -
-Data descriptors defined here:
-
__dict__
-
dictionary for instance variables (if defined)
-
-
__weakref__
-
list of weak references to the object (if defined)
-
-
-Data and other attributes defined here:
-
__annotations__ = {'ip_blacklist': typing.Dict[str, commons.Blacklist], 'js_paths': typing.Dict[str, commons.CallableFile], 'packages': <class 'utils.DefaultNamespace'>, 'processes': typing.Dict[str, Pages.Process], 'scripts': typing.Dict[str, commons.ScriptConfig], 'sessions': typing.Dict[int, commons.Session], 'statics_paths': typing.Dict[str, commons.CallableFile], 'user_blacklist': typing.Dict[str, commons.Blacklist]}
- -
api = <Pages.Api object>
- -
ip_blacklist = {}
- -
processes = {}
- -
sessions = {}
- -
user_blacklist = {}
- -
web = <Pages.Web object>
- -

- - - - - -
 
-Data
       __all__ = ['Pages']
-__author_email__ = 'mauricelambert434@gmail.com'
-__copyright__ = '\nWebScripts Copyright (C) 2021, 2022, 2023 Mau...ome to redistribute it\nunder certain conditions.\n'
-__description__ = '\nThis tool runs CLI scripts and displays output ... Web system), script execution and right\nsystem.\n'
-__license__ = 'GPL-3.0 License'
-__maintainer__ = 'Maurice Lambert'
-__maintainer_email__ = 'mauricelambert434@gmail.com'
-__url__ = 'https://github.com/mauricelambert/WebScripts'

- - - - - -
 
-Author
       Maurice Lambert
- \ No newline at end of file diff --git a/static/html/WebScripts.html b/static/html/WebScripts.html deleted file mode 100644 index 0b0fde63..00000000 --- a/static/html/WebScripts.html +++ /dev/null @@ -1,295 +0,0 @@ - -Python: module WebScripts - - - - - -
 
- 
WebScripts (version 1.0.7)
index
webscripts.py
-

This tool runs CLI scripts and displays output in a Web Interface.

-This file is the "main" file of this package (implements the main function,
-the Server class and the Configuration class).

-

- - - - - -
 
-Modules
       
logging
-
wsgiref.simple_server
-
sys
-

- - - - - -
 
-Classes
       
-
builtins.object -
-
-
Server -
-
-
utils.DefaultNamespace(types.SimpleNamespace) -
-
-
Configuration -
-
-
-

- - - - - - - -
 
-class Configuration(utils.DefaultNamespace)
   Configuration(required: List[str] = [], optional: List[str] = [], default: dict = {}, types: dict = {})

-This class build the configuration from dict(s) with
-configuration files and arguments.
 
 
Method resolution order:
-
Configuration
-
utils.DefaultNamespace
-
types.SimpleNamespace
-
builtins.object
-
-
-Methods defined here:
-
add_conf(self, **kwargs)
Add configurations from other configuration files found.
- -
-Data and other attributes defined here:
-
__defaults__ = {'accept_unauthenticated_user': True, 'accept_unknow_user': True, 'active_auth': False, 'auth_failures_to_blacklist': None, 'auth_script': None, 'blacklist_time': None, 'cgi_path': [], 'documentations_path': [], 'exclude_auth_pages': ['/api/', '/auth/', '/web/auth/'], 'exclude_auth_paths': ['/static/', '/js/'], ...}
- -
__optional__ = ('debug', 'security', 'active_auth', 'auth_script', 'accept_unknow_user', 'accept_unauthenticated_user', 'exclude_auth_paths', 'exclude_auth_pages', 'modules', 'modules_path', 'js_path', 'statics_path', 'documentations_path', 'scripts_path', 'json_scripts_config', 'ini_scripts_config', 'log_level', 'log_filename', 'log_level', 'log_format', ...)
- -
__required__ = ('interface', 'port')
- -
__types__ = {'accept_unauthenticated_user': <class 'bool'>, 'accept_unknow_user': <class 'bool'>, 'active_auth': <class 'bool'>, 'admin_adresses': <class 'list'>, 'admin_groups': typing.List[int], 'auth_failures_to_blacklist': <class 'int'>, 'blacklist_time': <class 'int'>, 'csrf_max_time': <class 'int'>, 'debug': <class 'bool'>, 'documentations_path': <class 'list'>, ...}
- -
-Methods inherited from utils.DefaultNamespace:
-
__getitem__(self, key: str)
Compatibility with dict.
- -
__init__(self, required: List[str] = [], optional: List[str] = [], default: dict = {}, types: dict = {})
Initialize self.  See help(type(self)) for accurate signature.
- -
build_type(self, attribut: str, value: Any, type_: type = None) -> None
This function builds type from configuration value.
- -
build_types(self) -> None
This function builds type from configuration values.
- -
check_required(self) -> None
This function checks required attributes
-if one of required attributes is missing this
-function raise MissingAttributesError.
- -
export_as_json(self, name: str = None) -> None
This function export namespace values (useful for debugging).
- -
get(self, key: str, default=None)
Compatibility with dict.
- -
get_dict(self) -> None
This function return a dict of attributes.
- -
get_missings(self) -> List[str]
This function checks required attributes
-and return a List[str] of missing required attributes.
- -
get_unexpecteds(self, log: bool = True) -> List[str]
This function return a List[str] of
-all attributes not in optional and
-required attributes.

-If log argument is True a Warning log message is
-write for all unexpected attributes.
- -
set_defaults(self) -> None
This function set defaults attribut with defaults values.
- -
update(self, **kwargs)
This function add/update attributes with **kwargs arguments.
- -
-Class methods inherited from utils.DefaultNamespace:
-
default_build(**kwargs) -> ~DefaultNamespace from builtins.type
Default build for DefaultNamespace (set defaults, add values,
-check requirements and unexpected values and build types).
- -
-Data descriptors inherited from utils.DefaultNamespace:
-
__weakref__
-
list of weak references to the object (if defined)
-
-
-Methods inherited from types.SimpleNamespace:
-
__delattr__(self, name, /)
Implement delattr(self, name).
- -
__eq__(self, value, /)
Return self==value.
- -
__ge__(self, value, /)
Return self>=value.
- -
__getattribute__(self, name, /)
Return getattr(self, name).
- -
__gt__(self, value, /)
Return self>value.
- -
__le__(self, value, /)
Return self<=value.
- -
__lt__(self, value, /)
Return self<value.
- -
__ne__(self, value, /)
Return self!=value.
- -
__reduce__(...)
Return state information for pickling
- -
__repr__(self, /)
Return repr(self).
- -
__setattr__(self, name, value, /)
Implement setattr(self, name, value).
- -
-Static methods inherited from types.SimpleNamespace:
-
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.
- -
-Data descriptors inherited from types.SimpleNamespace:
-
__dict__
-
-
-Data and other attributes inherited from types.SimpleNamespace:
-
__hash__ = None
- -

- - - - - - - -
 
-class Server(builtins.object)
   Server(configuration: WebScripts.Configuration)

-This class implements the WebScripts server.
 
 Methods defined here:
-
__init__(self, configuration: WebScripts.Configuration)
Initialize self.  See help(type(self)) for accurate signature.
- -
add_module_or_package(self) -> None
This function add packages and modules to build custom page.
- -
add_paths(self) -> None
This function add js, static and scripts paths.
- -
app(self, environ_: os._Environ, respond: method) -> List[bytes]
This function get function page,
-return content page, catch errors and
-return HTTP errors.
- -
check_auth(self, environ: os._Environ) -> Tuple[commons.User, bool]
This function check if user is authenticated and blacklisted.
- -
check_blacklist(self, user: commons.User, ip: str) -> bool
This function checks that the IP and the
-username are not in the blacklist.
- -
get_URLs(self) -> List[str]
This function return a list of urls (scripts, documentation...)
-and the start of the URL of custom packages.
- -
get_function_page(self, path: str, filename: str) -> Tuple[~FunctionOrNone, str, bool]
This function find function from URL path.
-If the function is a WebScripts built-in function,
-return the function, filename and True. Else return the
-function, filename and False.
- -
get_session(self, cookies: List[str], ip: str) -> commons.User
This function return User from cookies.
- -
page_400(self, environ: os._Environ, user: commons.User, filename: str, method: str, respond: method)
This function return error 400 web page.
- -
page_401(self, environ: os._Environ, user: commons.User, filename: str, error_description: str, respond: method)
This function return error 401 web page.
- -
page_403(self, environ: os._Environ, user: commons.User, filename: str, error_description: str, respond: method)
This function return error 403 web page.
- -
page_404(self, environ: os._Environ, user: commons.User, filename: str, url: str, respond: method)
This function return error 404 web page.
- -
page_406(self, environ: os._Environ, user: commons.User, filename: str, error_description: str, respond: method)
This function return error 406 web page.
- -
page_500(self, environ: os._Environ, user: commons.User, filename: str, error: Union[str, bytes, Iterable[bytes]], respond: method) -> List[bytes]
This function return error 500 web page.
- -
parse_body(self, environ: os._Environ) -> Tuple[~Content, str, bool]
This function returns arguments from body.
- -
return_inputs(self, arguments: List[Dict[str, ~JsonValue]], is_webscripts_request: bool) -> Tuple[List[str], List[str]]
This function returns inputs (using Server.get_inputs).
- -
send_custom_error(self, environ: os._Environ, user: commons.User, filename: str, error: str, code: str) -> Tuple[Optional[str], Optional[Dict[str, str]], Optional[str]]
This function call custom errors pages.
- -
send_error_page(self, environ: os._Environ, user: commons.User, filename: str, error: str, data: bytes, respond: method) -> List[bytes]
This function send HTTP errors.
- -
send_headers(self, environ: os._Environ, respond: method, error: str = None, headers: Dict[str, str] = None) -> None
This function send error code, message and headers.
- -
set_default_values_for_response(self, error: str, headers: Dict[str, str]) -> Tuple[str, Dict[str, str]]
This function returns default error if not defined and
-default headers updated with custom headers.
- -
-Static methods defined here:
-
check_origin(environ_getter: collections.abc.Callable, environ: os._Environ) -> bool
This function checks Origin of POST methods.
- -
get_attributes(object_: object, attributes: List[str], is_not_package: bool = True) -> Tuple[~FunctionOrNone, bool]
This function get recursive attribute from object.
- -
get_baseurl(environ_getter: collections.abc.Callable, environ: os._Environ) -> str
This function returns URL base.
- -
get_content_length(environ: os._Environ) -> int
This function returns the content length.
- -
get_fullurl(environ: os._Environ) -> str
This function returns the full URL (based on the PEP 3333).

-Link: https://peps.python.org/pep-3333/
- -
get_inputs(arguments: List[Dict[str, ~JsonValue]]) -> Tuple[List[str], List[str]]
This function returns inputs and arguments from arguments.
- -
get_json_content(body: bytes, content_type: str) -> ~JsonValue
This functions returns the loaded JSON content.
- -
return_page(page: Union[bytes, str, Iterable[bytes]]) -> List[bytes]
This function returns response as a list of bytes.
- -
set_default_headers(headers: Dict[str, str], security: bool, configuration: WebScripts.Configuration) -> None
This function sets defaults headers.
- -
try_get_command(body: Dict[str, ~JsonValue]) -> Optional[Tuple[~Content, str, bool]]
This function returns arguments, CSRF token and True if is WebScripts
-request. If is not a WebScripts request because there's no "arguments"
-section in request content, this function returns None. If an error
-is raised in arguments parser, this function returns the JSON
-content, None and False.
- -
use_basic_auth(credentials: str, pages: Pages.Pages, *args) -> Tuple[str, Dict[str, str], str]
This function decodes basic auth and
-authenticates user with it.
- -
-Data descriptors defined here:
-
__dict__
-
dictionary for instance variables (if defined)
-
-
__weakref__
-
list of weak references to the object (if defined)
-
-
-Data and other attributes defined here:
-
CommonsClasses = <class 'WebScripts.Server.CommonsClasses'>
- -

- - - - - -
 
-Functions
       
main() -> int
Main function to build the
-configurations and launch the server.
-

- - - - - -
 
-Data
       __all__ = ['Configuration', 'Server', 'main']
-__author_email__ = 'mauricelambert434@gmail.com'
-__copyright__ = '\nWebScripts Copyright (C) 2021, 2022, 2023 Mau...ome to redistribute it\nunder certain conditions.\n'
-__description__ = '\nThis tool runs CLI scripts and displays output ...,\nthe Server class and the Configuration class).\n'
-__license__ = 'GPL-3.0 License'
-__maintainer__ = 'Maurice Lambert'
-__maintainer_email__ = 'mauricelambert434@gmail.com'
-__url__ = 'https://github.com/mauricelambert/WebScripts'

- - - - - -
 
-Author
       Maurice Lambert
- \ No newline at end of file diff --git a/static/html/__init__.html b/static/html/__init__.html deleted file mode 100644 index 44280363..00000000 --- a/static/html/__init__.html +++ /dev/null @@ -1,237 +0,0 @@ - -Python: module __init__ - - - - - -
 
- 
__init__ (version 1.2.1)
index
__init__.py
-

This package implements a web server to run scripts or 
-executables from the command line and display the result 
-in a web interface.

-

- - - - - -
 
-Classes
       
-
WebScripts.utils.DefaultNamespace(types.SimpleNamespace) -
-
-
WebScripts.WebScripts.Configuration -
-
-
builtins.object -
-
-
WebScripts.WebScripts.Server -
-
-
-

- - - - - - - -
 
-class Configuration(WebScripts.utils.DefaultNamespace)
   Configuration(required: List[str] = [], optional: List[str] = [], default: dict = {}, types: dict = {})

-This class build the configuration from dict(s) with
-configuration files and arguments.
 
 
Method resolution order:
-
Configuration
-
WebScripts.utils.DefaultNamespace
-
types.SimpleNamespace
-
builtins.object
-
-
-Methods defined here:
-
add_conf(self, **kwargs)
Add configurations from other configuration files found.
- -
-Data and other attributes defined here:
-
__defaults__ = {'accept_unauthenticated_user': True, 'accept_unknow_user': True, 'active_auth': False, 'auth_script': None, 'documentations_path': [], 'interface': '127.0.0.1', 'js_path': [], 'modules': [], 'modules_path': [], 'port': 8000, ...}
- -
__optional__ = ('debug', 'security', 'active_auth', 'auth_script', 'accept_unknow_user', 'accept_unauthenticated_user', 'modules', 'modules_path', 'js_path', 'statics_path', 'documentations_path', 'scripts_path', 'json_scripts_config', 'ini_scripts_configlog_level', 'log_filename', 'log_level', 'log_format', 'log_date_format', 'log_encoding', 'auth_failures_to_blacklist', ...)
- -
__required__ = ('interface', 'port')
- -
__types__ = {'accept_unauthenticated_user': <class 'bool'>, 'accept_unknow_user': <class 'bool'>, 'active_auth': <class 'bool'>, 'auth_failures_to_blacklist': <class 'int'>, 'blacklist_time': <class 'int'>, 'debug': <class 'bool'>, 'documentations_path': <class 'list'>, 'ini_scripts_config': <class 'list'>, 'js_path': <class 'list'>, 'json_scripts_config': <class 'list'>, ...}
- -
-Methods inherited from WebScripts.utils.DefaultNamespace:
-
__getitem__(self, key: str)
Compatibility with dict.
- -
__init__(self, required: List[str] = [], optional: List[str] = [], default: dict = {}, types: dict = {})
Initialize self.  See help(type(self)) for accurate signature.
- -
build_types(self) -> None
This function build type from configuration values.
- -
check_required(self) -> None
This function checks required attributes
-if one of required attributes is missing this
-function raise MissingAttributesError.
- -
export_as_json(self, name: str = None) -> None
This function export namespace values (useful for debugging).
- -
get(self, key: str, default=None)
Compatibility with dict.
- -
get_dict(self) -> None
This function return a dict of attributes.
- -
get_missings(self) -> List[str]
This function checks required attributes
-and return a List[str] of missing required attributes.
- -
get_unexpecteds(self, log: bool = True) -> List[str]
This function return a List[str] of
-all attributes not in optional and
-required attributes.

-If log argument is True a Warning log message is
-write for all unexpected attributes.
- -
set_defaults(self) -> None
This function set defaults attribut with defaults values.
- -
update(self, **kwargs)
This function add/update attributes with **kwargs arguments.
- -
-Class methods inherited from WebScripts.utils.DefaultNamespace:
-
default_build(**kwargs) -> ~DefaultNamespace from builtins.type
Default build for DefaultNamespace (set defaults, add values, check
-requirements and unexpected values and build types).
- -
-Data descriptors inherited from WebScripts.utils.DefaultNamespace:
-
__weakref__
-
list of weak references to the object (if defined)
-
-
-Methods inherited from types.SimpleNamespace:
-
__delattr__(self, name, /)
Implement delattr(self, name).
- -
__eq__(self, value, /)
Return self==value.
- -
__ge__(self, value, /)
Return self>=value.
- -
__getattribute__(self, name, /)
Return getattr(self, name).
- -
__gt__(self, value, /)
Return self>value.
- -
__le__(self, value, /)
Return self<=value.
- -
__lt__(self, value, /)
Return self<value.
- -
__ne__(self, value, /)
Return self!=value.
- -
__reduce__(...)
Return state information for pickling
- -
__repr__(self, /)
Return repr(self).
- -
__setattr__(self, name, value, /)
Implement setattr(self, name, value).
- -
-Static methods inherited from types.SimpleNamespace:
-
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.
- -
-Data descriptors inherited from types.SimpleNamespace:
-
__dict__
-
-
-Data and other attributes inherited from types.SimpleNamespace:
-
__hash__ = None
- -

- - - - - - - -
 
-class Server(builtins.object)
   Server(configuration: WebScripts.WebScripts.Configuration)

-This class implement the WebScripts server.
 
 Methods defined here:
-
__init__(self, configuration: WebScripts.WebScripts.Configuration)
Initialize self.  See help(type(self)) for accurate signature.
- -
add_module_or_package(self) -> None
This function add packages and modules to build custom page.
- -
add_paths(self) -> None
This function add js, static and scripts paths.
- -
app(self, environ: os._Environ, respond: function) -> List[bytes]
This function get function page,
-return content page, catch errors and
-return HTTP errors.
- -
check_auth(self, environ: os._Environ) -> Tuple[WebScripts.commons.User, bool]
This function check if user is authenticated and blacklisted.
- -
check_blacklist(self, user: WebScripts.commons.User, ip: str) -> bool
This function checks that the IP and the
-username are not in the blacklist.
- -
get_URLs(self) -> List[str]
This function return a list of string.
- -
get_attributes(self, object_: object, attributes: List[str]) -> Tuple[~FunctionOrNone, str]
This function get recursive attribute from object.
- -
get_function_page(self, path: str) -> ~FunctionOrNone
This function find function from URL path.
- -
get_inputs(self, arguments: List[Dict[str, ~JsonValue]]) -> Tuple[List[str], Dict[str, ~JsonValue]]
This function returns inputs and arguments from arguments.
- -
get_session(self, cookies: List[str], ip: str) -> WebScripts.commons.User
This function return User from cookies.
- -
page_401(self, error_description: str, respond: function)
This function return error 401 web page.
- -
page_403(self, error_description: str, respond: function)
This function return error 403 web page.
- -
page_404(self, url: str, respond: function)
This function return error 404 web page.
- -
page_500(self, error: str, respond: function) -> List[bytes]
This function return error 500 web page.
- -
parse_body(self, environ: os._Environ) -> Tuple[List[Dict[str, ~JsonValue]], str]
This function return arguments from body.
- -
send_custom_error(self, error: str, code: str) -> Tuple[str, Dict[str, str], str]
This function call custom errors pages.
- -
send_error_page(self, error: str, data: bytes, respond: function) -> List[bytes]
This function send HTTP errors.
- -
send_headers(self, respond: function, error: str = None, headers: Dict[str, str] = None) -> None
This function send error code, message and headers.
- -
-Data descriptors defined here:
-
__dict__
-
dictionary for instance variables (if defined)
-
-
__weakref__
-
list of weak references to the object (if defined)
-
-

- - - - - -
 
-Functions
       
main() -> None
Main function to launch server, get configuration and logs.
-

- - - - - -
 
-Data
       __all__ = ['Configuration', 'Server', 'main']
-__author_email__ = 'mauricelambert434@gmail.com'
-__copyright__ = '\nWebScripts Copyright (C) 2021 Maurice Lambert...ome to redistribute it\nunder certain conditions.\n'
-__description__ = 'This package implements a web server to run scri...d line and display the result in a web interface.'
-__license__ = 'GPL-3.0 License'
-__maintainer__ = 'Maurice Lambert'
-__maintainer_email__ = 'mauricelambert434@gmail.com'
-__url__ = 'https://github.com/mauricelambert/WebScripts'

- - - - - -
 
-Author
       Maurice Lambert
- \ No newline at end of file diff --git a/static/html/cgi.html b/static/html/cgi.html deleted file mode 100644 index df4a2e26..00000000 --- a/static/html/cgi.html +++ /dev/null @@ -1,322 +0,0 @@ - -Python: module cgi - - - - - -
 
- 
cgi (version 2.6)
index
c:\program files\python310\lib\cgi.py
Module Reference
-

Support module for CGI (Common Gateway Interface) scripts.

-This module defines a number of utilities for use by CGI scripts
-written in Python.

-

- - - - - -
 
-Modules
       
html
-locale
-
os
-sys
-
tempfile
-urllib
-
warnings
-

- - - - - -
 
-Classes
       
-
builtins.object -
-
-
FieldStorage -
MiniFieldStorage -
-
-
-

- - - - - - - -
 
-class FieldStorage(builtins.object)
   FieldStorage(fp=None, headers=None, outerboundary=b'', {}, keep_blank_values=0, strict_parsing=0, limit=None, encoding='utf-8', errors='replace', max_num_fields=None, separator='&amp;')

-Store a sequence of fields, reading multipart/form-data.

-This class provides naming, typing, files stored on disk, and
-more.  At the top level, it is accessible like a dictionary, whose
-keys are the field names.  (Note: None can occur as a field name.)
-The items are either a Python list (if there's multiple values) or
-another FieldStorage or MiniFieldStorage object.  If it's a single
-object, it has the following attributes:

-name: the field name, if specified; otherwise None

-filename: the filename, if specified; otherwise None; this is the
-    client side filename, *not* the file name on which it is
-    stored (that's a temporary file you don't deal with)

-value: the value as a *string*; for file uploads, this
-    transparently reads the file every time you request the value
-    and returns *bytes*

-file: the file(-like) object from which you can read the data *as
-    bytes* ; None if the data is stored a simple string

-type: the content-type, or None if not specified

-type_options: dictionary of options specified on the content-type
-    line

-disposition: content-disposition, or None if not specified

-disposition_options: dictionary of corresponding options

-headers: a dictionary(-like) object (sometimes email.message.Message or a
-    subclass thereof) containing *all* headers

-The class is subclassable, mostly for the purpose of overriding
-the make_file() method, which is called internally to come up with
-a file open for reading and writing.  This makes it possible to
-override the default choice of storing all files in a temporary
-directory and unlinking them as soon as they have been opened.
 
 Methods defined here:
-
__bool__(self)
- -
__contains__(self, key)
Dictionary style __contains__ method.
- -
__del__(self)
- -
__enter__(self)
- -
__exit__(self, *args)
- -
__getattr__(self, name)
- -
__getitem__(self, key)
Dictionary style indexing.
- -
__init__(self, fp=None, headers=None, outerboundary=b'', {}, keep_blank_values=0, strict_parsing=0, limit=None, encoding='utf-8', errors='replace', max_num_fields=None, separator='&')
Constructor.  Read multipart/* until last part.

-Arguments, all optional:

-fp              : file pointer; default: sys.stdin.buffer
-    (not used when the request method is GET)
-    Can be :
-    1. a TextIOWrapper object
-    2. an object whose read() and readline() methods return bytes

-headers         : header dictionary-like object; default:
-    taken from environ as per CGI spec

-outerboundary   : terminating multipart boundary
-    (for internal use only)

-environ         : environment dictionary; default: os.environ

-keep_blank_values: flag indicating whether blank values in
-    percent-encoded forms should be treated as blank strings.
-    A true value indicates that blanks should be retained as
-    blank strings.  The default false value indicates that
-    blank values are to be ignored and treated as if they were
-    not included.

-strict_parsing: flag indicating what to do with parsing errors.
-    If false (the default), errors are silently ignored.
-    If true, errors raise a ValueError exception.

-limit : used internally to read parts of multipart/form-data forms,
-    to exit from the reading loop when reached. It is the difference
-    between the form content-length and the number of bytes already
-    read

-encoding, errors : the encoding and error handler used to decode the
-    binary stream to strings. Must be the same as the charset defined
-    for the page sending the form (content-type : meta http-equiv or
-    header)

-max_num_fields: int. If set, then __init__ throws a ValueError
-    if there are more than n fields read by parse_qsl().
- -
__iter__(self)
- -
__len__(self)
Dictionary style len(x) support.
- -
__repr__(self)
Return a printable representation.
- -
getfirst(self, key, default=None)
Return the first value received.
- -
getlist(self, key)
Return list of received values.
- -
getvalue(self, key, default=None)
Dictionary style get() method, including 'value' lookup.
- -
keys(self)
Dictionary style keys() method.
- -
make_file(self)
Overridable: return a readable & writable file.

-The file will be used as follows:
-- data is written to it
-- seek(0)
-- data is read from it

-The file is opened in binary mode for files, in text mode
-for other fields

-This version opens a temporary file for reading and writing,
-and immediately deletes (unlinks) it.  The trick (on Unix!) is
-that the file can still be used, but it can't be opened by
-another process, and it will automatically be deleted when it
-is closed or when the current process terminates.

-If you want a more permanent file, you derive a class which
-overrides this method.  If you want a visible temporary file
-that is nevertheless automatically deleted when the script
-terminates, try defining a __del__ method in a derived class
-which unlinks the temporary files you have created.
- -
read_binary(self)
Internal: read binary data.
- -
read_lines(self)
Internal: read lines until EOF or outerboundary.
- -
read_lines_to_eof(self)
Internal: read lines until EOF.
- -
read_lines_to_outerboundary(self)
Internal: read lines until outerboundary.
-Data is read as bytes: boundaries and line ends must be converted
-to bytes for comparisons.
- -
read_multi(self, environ, keep_blank_values, strict_parsing)
Internal: read a part that is itself multipart.
- -
read_single(self)
Internal: read an atomic part.
- -
read_urlencoded(self)
Internal: read data in query string format.
- -
skip_lines(self)
Internal: skip lines until outer boundary if defined.
- -
-Data descriptors defined here:
-
__dict__
-
dictionary for instance variables (if defined)
-
-
__weakref__
-
list of weak references to the object (if defined)
-
-
-Data and other attributes defined here:
-
FieldStorageClass = None
- -
bufsize = 8192
- -

- - - - - - - -
 
-class MiniFieldStorage(builtins.object)
   MiniFieldStorage(name, value)

-Like FieldStorage, for use when no file uploads are possible.
 
 Methods defined here:
-
__init__(self, name, value)
Constructor from field name and value.
- -
__repr__(self)
Return printable representation.
- -
-Data descriptors defined here:
-
__dict__
-
dictionary for instance variables (if defined)
-
-
__weakref__
-
list of weak references to the object (if defined)
-
-
-Data and other attributes defined here:
-
disposition = None
- -
disposition_options = {}
- -
file = None
- -
filename = None
- -
headers = {}
- -
list = None
- -
type = None
- -
type_options = {}
- -

- - - - - -
 
-Functions
       
parse(fp=None, {}, keep_blank_values=0, strict_parsing=0, separator='&')
Parse a query in the environment or from a file (default stdin)

-Arguments, all optional:

-fp              : file pointer; default: sys.stdin.buffer

-environ         : environment dictionary; default: os.environ

-keep_blank_values: flag indicating whether blank values in
-    percent-encoded forms should be treated as blank strings.
-    A true value indicates that blanks should be retained as
-    blank strings.  The default false value indicates that
-    blank values are to be ignored and treated as if they were
-    not included.

-strict_parsing: flag indicating what to do with parsing errors.
-    If false (the default), errors are silently ignored.
-    If true, errors raise a ValueError exception.

-separator: str. The symbol to use for separating the query arguments.
-    Defaults to &.
-
parse_header(line)
Parse a Content-type like header.

-Return the main content-type and a dictionary of options.
-
parse_multipart(fp, pdict, encoding='utf-8', errors='replace', separator='&')
Parse multipart input.

-Arguments:
-fp   : input file
-pdict: dictionary containing other parameters of content-type header
-encoding, errors: request encoding and error handler, passed to
-    FieldStorage

-Returns a dictionary just like parse_qs(): keys are the field names, each
-value is a list of values for that field. For non-file fields, the value
-is a list of strings.
-
print_arguments()
-
print_directory()
Dump the current directory as HTML.
-
print_environ({})
Dump the shell environment as HTML.
-
print_environ_usage()
Dump a list of environment variables used by CGI as HTML.
-
print_exception(type=None, value=None, tb=None, limit=None)
-
print_form(form)
Dump the contents of a form as HTML.
-
test({})
Robust test CGI script, usable as main program.

-Write minimal HTTP headers and dump all information provided to
-the script in HTML form.
-

- - - - - -
 
-Data
       __all__ = ['MiniFieldStorage', 'FieldStorage', 'parse', 'parse_multipart', 'parse_header', 'test', 'print_exception', 'print_environ', 'print_form', 'print_directory', 'print_arguments', 'print_environ_usage']
- \ No newline at end of file diff --git a/static/html/commons.html b/static/html/commons.html deleted file mode 100644 index dffcd430..00000000 --- a/static/html/commons.html +++ /dev/null @@ -1,584 +0,0 @@ - -Python: module commons - - - - - -
 
- 
commons (version 0.1.7)
index
commons.py
-

This tool runs CLI scripts and displays output in a Web Interface.

-This file implements commons functions and class for WebScripts package.

-

- - - - - -
 
-Classes
       
-
builtins.object -
-
-
Blacklist -
Session -
TokenCSRF -
-
-
collections.abc.Callable(builtins.object) -
-
-
CallableFile -
-
-
utils.DefaultNamespace(types.SimpleNamespace) -
-
-
Argument -
ScriptConfig -
User -
-
-
-

- - - - - - - -
 
-class Argument(utils.DefaultNamespace)
   Argument(required: List[str] = [], optional: List[str] = [], default: dict = {}, types: dict = {})

-This class build argument for script.
 
 
Method resolution order:
-
Argument
-
utils.DefaultNamespace
-
types.SimpleNamespace
-
builtins.object
-
-
-Static methods defined here:
-
get_command(name: str, argument: Dict[str, ~JsonValue]) -> List[Dict[str, ~JsonValue]]
This function return list for command line execution.
- -
-Data and other attributes defined here:
-
__defaults__ = {'default_value': None, 'description': None, 'example': None, 'html_type': 'text', 'input': None, 'is_advanced': False, 'javascript_attributs': {}}
- -
__optional__ = ['list', 'input', 'example', 'html_type', 'is_advanced', 'description', 'default_value', 'predefined_values', 'javascript_attributs']
- -
__required__ = ['name']
- -
__types__ = {'input': <class 'bool'>, 'is_advanced': <class 'bool'>, 'list': <class 'bool'>, 'predefined_values': <class 'list'>}
- -
-Methods inherited from utils.DefaultNamespace:
-
__getitem__(self, key: str)
Compatibility with dict.
- -
__init__(self, required: List[str] = [], optional: List[str] = [], default: dict = {}, types: dict = {})
Initialize self.  See help(type(self)) for accurate signature.
- -
build_type(self, attribut: str, value: Any, type_: type = None) -> None
This function builds type from configuration value.
- -
build_types(self) -> None
This function builds type from configuration values.
- -
check_required(self) -> None
This function checks required attributes
-if one of required attributes is missing this
-function raise MissingAttributesError.
- -
export_as_json(self, name: str = None) -> None
This function export namespace values (useful for debugging).
- -
get(self, key: str, default=None)
Compatibility with dict.
- -
get_dict(self) -> None
This function return a dict of attributes.
- -
get_missings(self) -> List[str]
This function checks required attributes
-and return a List[str] of missing required attributes.
- -
get_unexpecteds(self, log: bool = True) -> List[str]
This function return a List[str] of
-all attributes not in optional and
-required attributes.

-If log argument is True a Warning log message is
-write for all unexpected attributes.
- -
set_defaults(self) -> None
This function set defaults attribut with defaults values.
- -
update(self, **kwargs)
This function add/update attributes with **kwargs arguments.
- -
-Class methods inherited from utils.DefaultNamespace:
-
default_build(**kwargs) -> ~DefaultNamespace from builtins.type
Default build for DefaultNamespace (set defaults, add values,
-check requirements and unexpected values and build types).
- -
-Data descriptors inherited from utils.DefaultNamespace:
-
__weakref__
-
list of weak references to the object (if defined)
-
-
-Methods inherited from types.SimpleNamespace:
-
__delattr__(self, name, /)
Implement delattr(self, name).
- -
__eq__(self, value, /)
Return self==value.
- -
__ge__(self, value, /)
Return self>=value.
- -
__getattribute__(self, name, /)
Return getattr(self, name).
- -
__gt__(self, value, /)
Return self>value.
- -
__le__(self, value, /)
Return self<=value.
- -
__lt__(self, value, /)
Return self<value.
- -
__ne__(self, value, /)
Return self!=value.
- -
__reduce__(...)
Return state information for pickling
- -
__repr__(self, /)
Return repr(self).
- -
__setattr__(self, name, value, /)
Implement setattr(self, name, value).
- -
-Static methods inherited from types.SimpleNamespace:
-
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.
- -
-Data descriptors inherited from types.SimpleNamespace:
-
__dict__
-
-
-Data and other attributes inherited from types.SimpleNamespace:
-
__hash__ = None
- -

- - - - - - - -
 
-class Blacklist(builtins.object)
   Blacklist(configuration: ~ServerConfiguration, last_blacklist: ~Blacklist = None)

-This class implement blacklist.
 
 Methods defined here:
-
__init__(self, configuration: ~ServerConfiguration, last_blacklist: ~Blacklist = None)
Initialize self.  See help(type(self)) for accurate signature.
- -
__str__(self) -> str
This function returns a string to represent the Blacklist object.
- -
is_blacklist(self, configuration: ~ServerConfiguration) -> bool
This function return True if this object is blacklisted.
- -
-Data descriptors defined here:
-
__dict__
-
dictionary for instance variables (if defined)
-
-
__weakref__
-
list of weak references to the object (if defined)
-
-

- - - - - - - -
 
-class CallableFile(collections.abc.Callable)
   CallableFile(type_: str, path_: str, filename: str, config: dict = None, security: bool = True)

-This class build callable object to return
-Web files content or script output.
 
 
Method resolution order:
-
CallableFile
-
collections.abc.Callable
-
builtins.object
-
-
-Methods defined here:
-
__call__(self, user: commons.User, subdirectory: int = 2) -> Tuple[str, Dict[str, str], List[bytes]]
Call self as a function.
- -
__init__(self, type_: str, path_: str, filename: str, config: dict = None, security: bool = True)
Initialize self.  See help(type(self)) for accurate signature.
- -
is_html(self) -> bool
This function compare extension with html extensions.
- -
is_jpeg(self) -> bool
This function compare extension with jpeg extensions.
- -
is_tiff(self) -> bool
This function compare extension with tif extensions.
- -
is_xml(self) -> bool
This function compare extension with xml extensions.
- -
-Data descriptors defined here:
-
__dict__
-
dictionary for instance variables (if defined)
-
-
__weakref__
-
list of weak references to the object (if defined)
-
-
-Data and other attributes defined here:
-
__abstractmethods__ = frozenset()
- -
__annotations__ = {'template_footer': <class 'str'>, 'template_footer_path': <class 'str'>, 'template_header': <class 'str'>, 'template_header_path': <class 'str'>, 'template_index': <class 'str'>, 'template_index_path': <class 'str'>, 'template_script': <class 'str'>, 'template_script_path': <class 'str'>}
- -
template_footer = '\t\t<footer id="webscripts_footer" class="footer b...bScripts/share.html">online</a>.</li>\n\t\t</footer>'
- -
template_footer_path = r'/home/WebScripts\static\templates\footer.html'
- -
template_header = '\t\t<header id="webscripts_header" class="header b...s_header_canvas_container"></a></div>\n\t\t</header>'
- -
template_header_path = r'/home/WebScripts\static\templates\header.html'
- -
template_index = '<!--\n\n HTML page for index.\n Copyright (C)...content">\n\t\t</div>\n\n\t\t%(footer)s\n\t</body>\n</html>'
- -
template_index_path = r'/home/WebScripts\static\templates\index.html'
- -
template_script = '<!--\n\n HTML page to launch scripts.\n Copyr...ath = "%(subpath)s";\n\t\t</script>\n\t</body>\n</html>'
- -
template_script_path = r'/home/WebScripts\static\templates\script.html'
- -
-Class methods inherited from collections.abc.Callable:
-
__class_getitem__ = _CallableGenericAlias(args) from abc.ABCMeta
Represent `Callable[argtypes, resulttype]`.

-This sets ``__args__`` to a tuple containing the flattened ``argtypes``
-followed by ``resulttype``.

-Example: ``Callable[[int, str], float]`` sets ``__args__`` to
-``(int, str, float)``.
- -
__subclasshook__(C) from abc.ABCMeta
Abstract classes can override this to customize issubclass().

-This is invoked early on by abc.ABCMeta.__subclasscheck__().
-It should return True, False or NotImplemented.  If it returns
-NotImplemented, the normal algorithm is used.  Otherwise, it
-overrides the normal algorithm (and the outcome is cached).
- -

- - - - - - - -
 
-class ScriptConfig(utils.DefaultNamespace)
   ScriptConfig(required: List[str] = [], optional: List[str] = [], default: dict = {}, types: dict = {})

-This class makes script configurations.
 
 
Method resolution order:
-
ScriptConfig
-
utils.DefaultNamespace
-
types.SimpleNamespace
-
builtins.object
-
-
-Methods defined here:
-
build_args(self, configuration: ~Configuration)
This function build Arguments from self.args: List[Dict[str, str]]
- -
get_JSON_API(self) -> Dict
This function return a dict for JSON API
-(visible configuration for user).
- -
-Class methods defined here:
-
build_scripts_from_configuration(server_configuration: ~ServerConfiguration) -> Dict[str, ~ScriptConfig] from builtins.type
This function build scripts from server
-configuration and configurations files.
- -
get_scripts_from_configuration(configuration: ~Configuration, server_configuration: ~ServerConfiguration) -> Dict[str, ~ScriptConfig] from builtins.type
This function build scripts from ServerConfiguration.
- -
-Static methods defined here:
-
get_Windows_default_script_launcher(script_config: Dict[str, ~JsonValue]) -> str
This function gets the Windows default launcher to execute a file.
- -
get_arguments_from_config(arguments_section: str, configuration: Dict[str, Dict[str, ~JsonValue]]) -> List[Dict[str, ~JsonValue]]
This function get arguments list of script.
- -
get_docfile_from_configuration(configuration: ~ServerConfiguration, filename: str) -> str
This method returns the script documentation
-path if it exists.
- -
get_documentation_from_configuration(script_config: Dict[str, ~JsonValue], name: str, paths: List[str]) -> str
This function get documentation from script configuration
-or search it in documentation path.
- -
get_script_config_from_specific_file_config(script_config: Dict[str, ~JsonValue], configuration: Dict[str, ~JsonValue], server_configuration: Dict[str, ~JsonValue]) -> Tuple[dict, dict]
This function return all configuration and
-script configuration from configuration.
- -
get_script_path(server_configuration: ~ServerConfiguration, script_config: Dict[str, ~JsonValue]) -> str
This function return a script path from configuration.
- -
-Data and other attributes defined here:
-
__defaults__ = {'access_groups': None, 'access_users': None, 'args': [], 'category': '', 'command_generate_documentation': None, 'content_type': 'text/plain', 'description': None, 'documentation_content_type': 'text/html', 'documentation_file': None, 'launcher': None, ...}
- -
__optional__ = ['command_generate_documentation', 'documentation_content_type', 'stderr_content_type', 'documentation_file', 'minimum_access', 'access_groups', 'content_type', 'access_users', 'no_password', 'description', 'category', 'launcher', 'timeout', 'path', 'args']
- -
__required__ = ['name', 'dirname']
- -
__types__ = {'access_groups': typing.List[int], 'access_users': typing.List[int], 'minimum_access': <class 'int'>, 'no_password': <class 'bool'>, 'timeout': <class 'int'>}
- -
-Methods inherited from utils.DefaultNamespace:
-
__getitem__(self, key: str)
Compatibility with dict.
- -
__init__(self, required: List[str] = [], optional: List[str] = [], default: dict = {}, types: dict = {})
Initialize self.  See help(type(self)) for accurate signature.
- -
build_type(self, attribut: str, value: Any, type_: type = None) -> None
This function builds type from configuration value.
- -
build_types(self) -> None
This function builds type from configuration values.
- -
check_required(self) -> None
This function checks required attributes
-if one of required attributes is missing this
-function raise MissingAttributesError.
- -
export_as_json(self, name: str = None) -> None
This function export namespace values (useful for debugging).
- -
get(self, key: str, default=None)
Compatibility with dict.
- -
get_dict(self) -> None
This function return a dict of attributes.
- -
get_missings(self) -> List[str]
This function checks required attributes
-and return a List[str] of missing required attributes.
- -
get_unexpecteds(self, log: bool = True) -> List[str]
This function return a List[str] of
-all attributes not in optional and
-required attributes.

-If log argument is True a Warning log message is
-write for all unexpected attributes.
- -
set_defaults(self) -> None
This function set defaults attribut with defaults values.
- -
update(self, **kwargs)
This function add/update attributes with **kwargs arguments.
- -
-Class methods inherited from utils.DefaultNamespace:
-
default_build(**kwargs) -> ~DefaultNamespace from builtins.type
Default build for DefaultNamespace (set defaults, add values,
-check requirements and unexpected values and build types).
- -
-Data descriptors inherited from utils.DefaultNamespace:
-
__weakref__
-
list of weak references to the object (if defined)
-
-
-Methods inherited from types.SimpleNamespace:
-
__delattr__(self, name, /)
Implement delattr(self, name).
- -
__eq__(self, value, /)
Return self==value.
- -
__ge__(self, value, /)
Return self>=value.
- -
__getattribute__(self, name, /)
Return getattr(self, name).
- -
__gt__(self, value, /)
Return self>value.
- -
__le__(self, value, /)
Return self<=value.
- -
__lt__(self, value, /)
Return self<value.
- -
__ne__(self, value, /)
Return self!=value.
- -
__reduce__(...)
Return state information for pickling
- -
__repr__(self, /)
Return repr(self).
- -
__setattr__(self, name, value, /)
Implement setattr(self, name, value).
- -
-Static methods inherited from types.SimpleNamespace:
-
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.
- -
-Data descriptors inherited from types.SimpleNamespace:
-
__dict__
-
-
-Data and other attributes inherited from types.SimpleNamespace:
-
__hash__ = None
- -

- - - - - - - -
 
-class Session(builtins.object)
   Session(user: commons.User, ip: str)

-Object to implement session.
 
 Methods defined here:
-
__init__(self, user: commons.User, ip: str)
Initialize self.  See help(type(self)) for accurate signature.
- -
__str__(self) -> str
This function returns a string to represent the Session object.
- -
-Class methods defined here:
-
build_session(user: commons.User, ip: str, Pages: ~Pages) -> str from builtins.type
This function build and add session and return the cookie.
- -
-Static methods defined here:
-
check_session(cookie: str, pages: ~Pages, ip: str, default_user: commons.User, session_max_time: float = 3600) -> commons.User
This function check session validity and return user.
- -
-Data descriptors defined here:
-
__dict__
-
dictionary for instance variables (if defined)
-
-
__weakref__
-
list of weak references to the object (if defined)
-
-

- - - - - - - -
 
-class TokenCSRF(builtins.object)
   This class brings together the functions related to the CSRF token
 
 Static methods defined here:
-
build_token(user: commons.User) -> str
This function build a CSRF token for a user.
- -
check_csrf(user: commons.User, token: str, csrf_max_time: float = 300, referer: str = None, baseurl: str = None) -> bool
This function check the validity of a csrf token.
- -
clean(user: commons.User, max_time: float) -> None
This function clean all old CSRF tokens for a user.
- -
-Data descriptors defined here:
-
__dict__
-
dictionary for instance variables (if defined)
-
-
__weakref__
-
list of weak references to the object (if defined)
-
-

- - - - - - - -
 
-class User(utils.DefaultNamespace)
   User(required: List[str] = [], optional: List[str] = [], default: dict = {}, types: dict = {})

-This class implements User object.
 
 
Method resolution order:
-
User
-
utils.DefaultNamespace
-
types.SimpleNamespace
-
builtins.object
-
-
-Data and other attributes defined here:
-
__defaults__ = {'categories': ['*'], 'check_csrf': False, 'csrf': {}, 'groups': [], 'scripts': ['*']}
- -
__required__ = ['id', 'name', 'groups', 'csrf', 'ip', 'categories', 'scripts', 'check_csrf']
- -
__types__ = {'categories': <class 'list'>, 'check_csrf': <class 'bool'>, 'groups': typing.List[int], 'id': <class 'int'>, 'scripts': <class 'list'>}
- -
-Methods inherited from utils.DefaultNamespace:
-
__getitem__(self, key: str)
Compatibility with dict.
- -
__init__(self, required: List[str] = [], optional: List[str] = [], default: dict = {}, types: dict = {})
Initialize self.  See help(type(self)) for accurate signature.
- -
build_type(self, attribut: str, value: Any, type_: type = None) -> None
This function builds type from configuration value.
- -
build_types(self) -> None
This function builds type from configuration values.
- -
check_required(self) -> None
This function checks required attributes
-if one of required attributes is missing this
-function raise MissingAttributesError.
- -
export_as_json(self, name: str = None) -> None
This function export namespace values (useful for debugging).
- -
get(self, key: str, default=None)
Compatibility with dict.
- -
get_dict(self) -> None
This function return a dict of attributes.
- -
get_missings(self) -> List[str]
This function checks required attributes
-and return a List[str] of missing required attributes.
- -
get_unexpecteds(self, log: bool = True) -> List[str]
This function return a List[str] of
-all attributes not in optional and
-required attributes.

-If log argument is True a Warning log message is
-write for all unexpected attributes.
- -
set_defaults(self) -> None
This function set defaults attribut with defaults values.
- -
update(self, **kwargs)
This function add/update attributes with **kwargs arguments.
- -
-Class methods inherited from utils.DefaultNamespace:
-
default_build(**kwargs) -> ~DefaultNamespace from builtins.type
Default build for DefaultNamespace (set defaults, add values,
-check requirements and unexpected values and build types).
- -
-Data descriptors inherited from utils.DefaultNamespace:
-
__weakref__
-
list of weak references to the object (if defined)
-
-
-Methods inherited from types.SimpleNamespace:
-
__delattr__(self, name, /)
Implement delattr(self, name).
- -
__eq__(self, value, /)
Return self==value.
- -
__ge__(self, value, /)
Return self>=value.
- -
__getattribute__(self, name, /)
Return getattr(self, name).
- -
__gt__(self, value, /)
Return self>value.
- -
__le__(self, value, /)
Return self<=value.
- -
__lt__(self, value, /)
Return self<value.
- -
__ne__(self, value, /)
Return self!=value.
- -
__reduce__(...)
Return state information for pickling
- -
__repr__(self, /)
Return repr(self).
- -
__setattr__(self, name, value, /)
Implement setattr(self, name, value).
- -
-Static methods inherited from types.SimpleNamespace:
-
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.
- -
-Data descriptors inherited from types.SimpleNamespace:
-
__dict__
-
-
-Data and other attributes inherited from types.SimpleNamespace:
-
__hash__ = None
- -

- - - - - -
 
-Data
       JsonValue = ~JsonValue
-ServerConfiguration = ~ServerConfiguration
-__all__ = ['User', 'Session', 'Argument', 'JsonValue', 'TokenCSRF', 'Blacklist', 'ScriptConfig', 'CallableFile', 'ServerConfiguration']
-__author_email__ = 'mauricelambert434@gmail.com'
-__copyright__ = '\nWebScripts Copyright (C) 2021, 2022, 2023 Mau...ome to redistribute it\nunder certain conditions.\n'
-__description__ = '\nThis tool runs CLI scripts and displays output ...mons functions and class for WebScripts package.\n'
-__license__ = 'GPL-3.0 License'
-__maintainer__ = 'Maurice Lambert'
-__maintainer_email__ = 'mauricelambert434@gmail.com'
-__url__ = 'https://github.com/mauricelambert/WebScripts'

- - - - - -
 
-Author
       Maurice Lambert
- \ No newline at end of file diff --git a/static/html/csp.html b/static/html/csp.html deleted file mode 100644 index b3b191bc..00000000 --- a/static/html/csp.html +++ /dev/null @@ -1,60 +0,0 @@ - -Python: module csp - - - - - -
 
- 
csp (version 0.0.1)
index
csp.py
-

This tool run scripts and display the result in a Web Interface.

-This file implement a Content-Security-Policy debug page.

-

- - - - - -
 
-Modules
       
json
-

- - - - - -
 
-Functions
       
debug(environ: os._Environ, user: ~User, configuration: ~ServerConfiguration, code: str, arguments: Dict[str, Dict[str, str]], inputs: List[str], csrf_token: str = None) -> Tuple[str, Dict[str, str], str]
This function implement a debug page.
-

- - - - - -
 
-Data
       Dict = typing.Dict
-List = typing.List
-ServerConfiguration = ~ServerConfiguration
-Tuple = typing.Tuple
-User = ~User
-__author_email__ = 'mauricelambert434@gmail.com'
-__copyright__ = '\nWebScripts Copyright (C) 2021, 2022 Maurice L...ome to redistribute it\nunder certain conditions.\n'
-__description__ = '\nThis tool run scripts and display the result in...e implement a Content-Security-Policy debug page.'
-__license__ = 'GPL-3.0 License'
-__maintainer__ = 'Maurice Lambert'
-__maintainer_email__ = 'mauricelambert434@gmail.com'
-__url__ = 'https://github.com/mauricelambert/WebScripts'
-copyright = '\nWebScripts Copyright (C) 2021, 2022 Maurice L...ome to redistribute it\nunder certain conditions.\n'
-csp_report = {'report': 'No CSP report yet.'}
-license = 'GPL-3.0 License'

- - - - - -
 
-Author
       Maurice Lambert
- \ No newline at end of file diff --git a/static/html/error_pages.html b/static/html/error_pages.html deleted file mode 100644 index 539038c0..00000000 --- a/static/html/error_pages.html +++ /dev/null @@ -1,119 +0,0 @@ - -Python: module error_pages - - - - - -
 
- 
error_pages (version 0.0.4)
index
error_pages.py
-

This tool run scripts and display the result in a Web Interface.

-This file implement error, report and request pages by default.

-

- - - - - -
 
-Modules
       
csv
-
json
-
ntpath
-
secrets
-

- - - - - -
 
-Classes
       
-
builtins.object -
-
-
Report -
Request -
-
-
-

- - - - - - - -
 
-class Report(builtins.object)
   This class implements pages for the report feature by default.
 
 Methods defined here:
-
new(environ: os._Environ, user: ~User, configuration: ~ServerConfiguration, code: str, arguments: List[str], inputs: List[str], csrf_token: str = None) -> Tuple[str, Dict[str, str], str]
This function returns the report page by default.
- -
-Data descriptors defined here:
-
__dict__
-
dictionary for instance variables (if defined)
-
-
__weakref__
-
list of weak references to the object (if defined)
-
-

- - - - - - - -
 
-class Request(builtins.object)
   This class implements pages for the report feature by default.
 
 Methods defined here:
-
save(username: str, code: str, url: str, user_agent: str, subject: str, name: str, reason: str) -> None
This function save the report/request to a CSV file.
- -
send(environ: os._Environ, user: ~User, configuration: ~ServerConfiguration, code: str, arguments: List[str], inputs: List[str], csrf_token: str = None) -> Tuple[str, Dict[str, str], str]
This function save and send request or report.
- -
send_mail(configuration: ~ServerConfiguration, notification: str) -> None
This function send a notification mail.
- -
-Data descriptors defined here:
-
__dict__
-
dictionary for instance variables (if defined)
-
-
__weakref__
-
list of weak references to the object (if defined)
-
-

- - - - - -
 
-Functions
       
page_401(error: str) -> Tuple[str, Dict[str, str], List[bytes]]
This function uses send_error_page to return the page 401 by default.
-
page_403(error: str) -> Tuple[str, Dict[str, str], List[bytes]]
This function uses send_error_page to return the page 403 by default.
-
page_404(error: str) -> Tuple[str, Dict[str, str], List[bytes]]
This function uses send_error_page to return the page 404 by default.
-
page_500(error: str) -> Tuple[str, Dict[str, str], List[bytes]]
This function uses send_error_page to return the page 500 by default.
-

- - - - - -
 
-Data
       __all__ = ['page_500', 'page_401', 'page_403', 'page_404', 'Request', 'Report']
-__author_email__ = 'mauricelambert434@gmail.com'
-__copyright__ = '\nWebScripts Copyright (C) 2021, 2022 Maurice L...ome to redistribute it\nunder certain conditions.\n'
-__description__ = '\nThis tool run scripts and display the result in...ement errors and report/request pages by default.'
-__license__ = 'GPL-3.0 License'
-__maintainer__ = 'Maurice Lambert'
-__maintainer_email__ = 'mauricelambert434@gmail.com'
-__url__ = 'https://github.com/mauricelambert/WebScripts'

- - - - - -
 
-Author
       Maurice Lambert
- \ No newline at end of file diff --git a/static/html/get_request.html b/static/html/get_request.html deleted file mode 100644 index 053e33a4..00000000 --- a/static/html/get_request.html +++ /dev/null @@ -1,47 +0,0 @@ - -Python: module get_request - - - - - -
 
- 
get_request (version 0.0.1)
index
scripts\request\get_request.py
-

This package implements a web server to run scripts or 
-executables from the command line and display the result 
-in a web interface.

-This file prints a user request.

-

- - - - - -
 
-Modules
       
sys
-

- - - - - -
 
-Data
       __all__ = []
-__author_email__ = 'mauricelambert434@gmail.com'
-__copyright__ = '\nWebScripts Copyright (C) 2021 Maurice Lambert...ome to redistribute it\nunder certain conditions.\n'
-__description__ = 'This package implements a web server to run scri...a web interface.\n\nThis file prints a user request'
-__license__ = 'GPL-3.0 License'
-__maintainer__ = 'Maurice Lambert'
-__maintainer_email__ = 'mauricelambert434@gmail.com'
-__url__ = 'https://github.com/mauricelambert/WebScripts'

- - - - - -
 
-Author
       Maurice Lambert
- \ No newline at end of file diff --git a/static/html/hardening.html b/static/html/hardening.html deleted file mode 100644 index acd57a1f..00000000 --- a/static/html/hardening.html +++ /dev/null @@ -1,299 +0,0 @@ - -Python: module hardening - - - - - -
 
- 
hardening (version 1.1.8)
index
hardening.py
-

This tool runs CLI scripts and displays output in a Web Interface.

-This file implement the hardening audit of the WebScripts installation and
-configuration.

-

- - - - - -
 
-Modules
       
ctypes
-
os
-
pip
-

- - - - - -
 
-Classes
       
-
builtins.object -
-
-
Audit -
Report -
Rule -
-
-
enum.Enum(builtins.object) -
-
-
SEVERITY -
-
-
-

- - - - - - - -
 
-class Audit(builtins.object)
   This function implement hardening checks.
 
 Methods defined here:
-
audit_active_auth(server: ~Server) -> hardening.Rule
This function checks authentication is enabled.
- -
audit_admin_account(server: ~Server) -> collections.abc.Iterator[hardening.Rule]
This function checks the admin password.
- -
audit_blacklist(server: ~Server) -> hardening.Rule
This function checks the blacklist configuration.
- -
audit_config_files(server: ~Server) -> hardening.Rule
This function checks the configurations files.
- -
audit_debug(server: ~Server) -> hardening.Rule
This function checks the debug configuration.
- -
audit_export_configuration(server: ~Server) -> hardening.Rule
This function checks the export configuration file.
- -
audit_force_auth(server: ~Server) -> hardening.Rule
This function checks authentication is forced.
- -
audit_in_venv(server: ~Server) -> hardening.Rule
This function checks the virtualenv.
- -
audit_interface(server: ~Server) -> hardening.Rule
This function checks the network interface.
- -
audit_limit_exclude_auth(server: ~Server) -> hardening.Rule
This function checks exclusions for authentication.
- -
audit_log_level(server: ~Server) -> hardening.Rule
This function checks the log level.
- -
audit_security(server: ~Server) -> hardening.Rule
This function checks the security configuration.
- -
audit_smtp_password(server: ~Server) -> hardening.Rule
This function checks the SMTP password protection.
- -
audit_system_user(server: ~Server) -> hardening.Rule
This function checks the user.
- -
audit_venv_modules(server: ~Server) -> hardening.Rule
This function checks the virtualenv modules.
- -
audit_webproxy_number(server: ~Server) -> hardening.Rule
This function checks exclusions for authentication.
- -
audits_file_owner(server: ~Server) -> collections.abc.Iterator[hardening.Rule]
This function checks the files owner.
- -
audits_file_rights(server: ~Server) -> collections.abc.Iterator[hardening.Rule]
This function checks the files rights.
- -
audits_launcher(server: ~Server) -> collections.abc.Iterator[hardening.Rule]
This function checks the configuration of the script launcher.
- -
audits_module_path(server: ~Server) -> hardening.Rule
This function checks the modules paths.
- -
audits_script_configuration_file_path(server: ~Server) -> collections.abc.Iterator[hardening.Rule]
This function checks the scripts configurations files path
-for absolute path configurations.
- -
audits_scripts_content_type(server: ~Server) -> collections.abc.Iterator[hardening.Rule]
This function checks the configuration of the script content type.
- -
audits_scripts_logs(server: ~Server) -> collections.abc.Iterator[hardening.Rule]
This function checks the configuration of the script log.
- -
audits_scripts_path(server: ~Server) -> collections.abc.Iterator[hardening.Rule]
This function checks the configuration of the script path.
- -
audits_scripts_stderr_content_type(server: ~Server) -> collections.abc.Iterator[hardening.Rule]
This function checks the configuration of the script stderr content
-type.
- -
audits_timeout(server: ~Server) -> collections.abc.Iterator[hardening.Rule]
This function checks scripts timeout.
- -
check_for_updates(logs: ~Logs) -> None
This function runs in a thread indefinitely, it checks the version
-and the latest published version of WebScripts every hour.
-If the version and the latest published version are different,
-this function sends an email notification.
- -
get_owner(filename: str) -> str
This function return the owner of a file.
- -
get_permissions(filename: str) -> str
This function returns the file permissions.
- -
log_rule(rule: hardening.Rule, logs: ~Logs) -> None
This function log rule.
- -
run(server: ~Server) -> List[hardening.Rule]
This function run audit and checks.
- -
-Data descriptors defined here:
-
__dict__
-
dictionary for instance variables (if defined)
-
-
__weakref__
-
list of weak references to the object (if defined)
-
-
-Data and other attributes defined here:
-
current_dir = r'C:\Program Files\Python310'
- -
is_windows = True
- -
latest = []
- -
latest_ = []
- -
network_up = True
- -

- - - - - - - -
 
-class Report(builtins.object)
   Report(rules: List[hardening.Rule], file_integrity: List[Dict[str, str]], server: ~Server)

-This class implement the report object.
 
 Methods defined here:
-
__init__(self, rules: List[hardening.Rule], file_integrity: List[Dict[str, str]], server: ~Server)
Initialize self.  See help(type(self)) for accurate signature.
- -
as_html(self) -> str
This function return a HTML string of audit results.
- -
as_json(self) -> str
This function returns a JSON string of audit results.
- -
as_text(self) -> str
This function return a HTML string of audit results.
- -
get_pourcent(self) -> None
This function calcul pourcent.
- -
notification(self) -> None
This function send an email notification
-to administrator with the audit report.
- -
-Static methods defined here:
-
get_HTML_table(headers: str, rules: List[hardening.Rule]) -> str
This function returns a HTML table with rule attributes as columns.
- -
get_text_table(headers: str, rules: List[hardening.Rule], joiner: str = ' ') -> str
This function return a text table with rule attributes as columns.
- -
truncate_string(string: str, length: int = 13, end: str = '...', separator: str = ',') -> str
This function truncate a string.
- -
-Data descriptors defined here:
-
__dict__
-
dictionary for instance variables (if defined)
-
-
__weakref__
-
list of weak references to the object (if defined)
-
-

- - - - - - - -
 
-class Rule(builtins.object)
   Rule(subject: str, id_: int, is_OK: bool, level: int, severity: str, category: str, reason: str) -&gt; None

-This class implement a rule for hardening.
 
 Methods defined here:
-
__eq__(self, other)
Return self==value.
- -
__init__(self, subject: str, id_: int, is_OK: bool, level: int, severity: str, category: str, reason: str) -> None
Initialize self.  See help(type(self)) for accurate signature.
- -
__repr__(self)
Return repr(self).
- -
-Data descriptors defined here:
-
__dict__
-
dictionary for instance variables (if defined)
-
-
__weakref__
-
list of weak references to the object (if defined)
-
-
-Data and other attributes defined here:
-
__annotations__ = {'category': <class 'str'>, 'id_': <class 'int'>, 'is_OK': <class 'bool'>, 'level': <class 'int'>, 'reason': <class 'str'>, 'severity': <class 'str'>, 'subject': <class 'str'>}
- -
__dataclass_fields__ = {'category': Field(name='category',type=<class 'str'>,default...appingproxy({}),kw_only=False,_field_type=_FIELD), 'id_': Field(name='id_',type=<class 'int'>,default=<dat...appingproxy({}),kw_only=False,_field_type=_FIELD), 'is_OK': Field(name='is_OK',type=<class 'bool'>,default=<...appingproxy({}),kw_only=False,_field_type=_FIELD), 'level': Field(name='level',type=<class 'int'>,default=<d...appingproxy({}),kw_only=False,_field_type=_FIELD), 'reason': Field(name='reason',type=<class 'str'>,default=<...appingproxy({}),kw_only=False,_field_type=_FIELD), 'severity': Field(name='severity',type=<class 'str'>,default...appingproxy({}),kw_only=False,_field_type=_FIELD), 'subject': Field(name='subject',type=<class 'str'>,default=...appingproxy({}),kw_only=False,_field_type=_FIELD)}
- -
__dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)
- -
__hash__ = None
- -
__match_args__ = ('subject', 'id_', 'is_OK', 'level', 'severity', 'category', 'reason')
- -

- - - - - - - -
 
-class SEVERITY(enum.Enum)
   SEVERITY(value, names=None, *, module=None, qualname=None, type=None, start=1)

-Severity level of the rules.
 
 
Method resolution order:
-
SEVERITY
-
enum.Enum
-
builtins.object
-
-
-Data and other attributes defined here:
-
CRITICAL = <SEVERITY.CRITICAL: 'CRITICAL'>
- -
HIGH = <SEVERITY.HIGH: 'HIGH'>
- -
INFORMATION = <SEVERITY.INFORMATION: 'INFORMATION'>
- -
LOW = <SEVERITY.LOW: 'LOW'>
- -
MEDIUM = <SEVERITY.MEDIUM: 'MEDIUM'>
- -
-Data descriptors inherited from enum.Enum:
-
name
-
The name of the Enum member.
-
-
value
-
The value of the Enum member.
-
-
-Readonly properties inherited from enum.EnumMeta:
-
__members__
-
Returns a mapping of member name->value.

-This mapping lists all enum members, including aliases. Note that this
-is a read-only view of the internal mapping.
-
-

- - - - - -
 
-Functions
       
main(server: ~Server) -> hardening.Report
The main function to perform WebScripts Server hardening audit.
-

- - - - - -
 
-Data
       __all__ = ['Report', 'Rule', 'Audit', 'SEVERITY', 'main']
-__author_email__ = 'mauricelambert434@gmail.com'
-__copyright__ = '\nWebScripts Copyright (C) 2021, 2022, 2023 Mau...ome to redistribute it\nunder certain conditions.\n'
-__description__ = '\nThis tool runs CLI scripts and displays output ...f the WebScripts installation and\nconfiguration.\n'
-__license__ = 'GPL-3.0 License'
-__maintainer__ = 'Maurice Lambert'
-__maintainer_email__ = 'mauricelambert434@gmail.com'
-__url__ = 'https://github.com/mauricelambert/WebScripts'

- - - - - -
 
-Author
       Maurice Lambert
- \ No newline at end of file diff --git a/static/html/index.html b/static/html/index.html deleted file mode 100644 index 2110e910..00000000 --- a/static/html/index.html +++ /dev/null @@ -1,282 +0,0 @@ - -Python: module __init__ - - - - - -
 
- 
__init__ (version 3.0.39)
index
__init__.py
-

This tool runs CLI scripts and displays output in a Web Interface.

-

- - - - - -
 
-Classes
       
-
builtins.object -
-
-
WebScripts.Server -
-
-
utils.DefaultNamespace(types.SimpleNamespace) -
-
-
WebScripts.Configuration -
-
-
-

- - - - - - - -
 
-class Configuration(utils.DefaultNamespace)
   Configuration(required: List[str] = [], optional: List[str] = [], default: dict = {}, types: dict = {})

-This class build the configuration from dict(s) with
-configuration files and arguments.
 
 
Method resolution order:
-
Configuration
-
utils.DefaultNamespace
-
types.SimpleNamespace
-
builtins.object
-
-
-Methods defined here:
-
add_conf(self, **kwargs)
Add configurations from other configuration files found.
- -
-Data and other attributes defined here:
-
__defaults__ = {'accept_unauthenticated_user': True, 'accept_unknow_user': True, 'active_auth': False, 'auth_failures_to_blacklist': None, 'auth_script': None, 'blacklist_time': None, 'cgi_path': [], 'documentations_path': [], 'exclude_auth_pages': ['/api/', '/auth/', '/web/auth/'], 'exclude_auth_paths': ['/static/', '/js/'], ...}
- -
__optional__ = ('debug', 'security', 'active_auth', 'auth_script', 'accept_unknow_user', 'accept_unauthenticated_user', 'exclude_auth_paths', 'exclude_auth_pages', 'modules', 'modules_path', 'js_path', 'statics_path', 'documentations_path', 'scripts_path', 'json_scripts_config', 'ini_scripts_config', 'log_level', 'log_filename', 'log_level', 'log_format', ...)
- -
__required__ = ('interface', 'port')
- -
__types__ = {'accept_unauthenticated_user': <class 'bool'>, 'accept_unknow_user': <class 'bool'>, 'active_auth': <class 'bool'>, 'admin_adresses': <class 'list'>, 'admin_groups': typing.List[int], 'auth_failures_to_blacklist': <class 'int'>, 'blacklist_time': <class 'int'>, 'csrf_max_time': <class 'int'>, 'debug': <class 'bool'>, 'documentations_path': <class 'list'>, ...}
- -
-Methods inherited from utils.DefaultNamespace:
-
__getitem__(self, key: str)
Compatibility with dict.
- -
__init__(self, required: List[str] = [], optional: List[str] = [], default: dict = {}, types: dict = {})
Initialize self.  See help(type(self)) for accurate signature.
- -
build_type(self, attribut: str, value: Any, type_: type = None) -> None
This function builds type from configuration value.
- -
build_types(self) -> None
This function builds type from configuration values.
- -
check_required(self) -> None
This function checks required attributes
-if one of required attributes is missing this
-function raise MissingAttributesError.
- -
export_as_json(self, name: str = None) -> None
This function export namespace values (useful for debugging).
- -
get(self, key: str, default=None)
Compatibility with dict.
- -
get_dict(self) -> None
This function return a dict of attributes.
- -
get_missings(self) -> List[str]
This function checks required attributes
-and return a List[str] of missing required attributes.
- -
get_unexpecteds(self, log: bool = True) -> List[str]
This function return a List[str] of
-all attributes not in optional and
-required attributes.

-If log argument is True a Warning log message is
-write for all unexpected attributes.
- -
set_defaults(self) -> None
This function set defaults attribut with defaults values.
- -
update(self, **kwargs)
This function add/update attributes with **kwargs arguments.
- -
-Class methods inherited from utils.DefaultNamespace:
-
default_build(**kwargs) -> ~DefaultNamespace from builtins.type
Default build for DefaultNamespace (set defaults, add values,
-check requirements and unexpected values and build types).
- -
-Data descriptors inherited from utils.DefaultNamespace:
-
__weakref__
-
list of weak references to the object (if defined)
-
-
-Methods inherited from types.SimpleNamespace:
-
__delattr__(self, name, /)
Implement delattr(self, name).
- -
__eq__(self, value, /)
Return self==value.
- -
__ge__(self, value, /)
Return self>=value.
- -
__getattribute__(self, name, /)
Return getattr(self, name).
- -
__gt__(self, value, /)
Return self>value.
- -
__le__(self, value, /)
Return self<=value.
- -
__lt__(self, value, /)
Return self<value.
- -
__ne__(self, value, /)
Return self!=value.
- -
__reduce__(...)
Return state information for pickling
- -
__repr__(self, /)
Return repr(self).
- -
__setattr__(self, name, value, /)
Implement setattr(self, name, value).
- -
-Static methods inherited from types.SimpleNamespace:
-
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.
- -
-Data descriptors inherited from types.SimpleNamespace:
-
__dict__
-
-
-Data and other attributes inherited from types.SimpleNamespace:
-
__hash__ = None
- -

- - - - - - - -
 
-class Server(builtins.object)
   Server(configuration: WebScripts.Configuration)

-This class implements the WebScripts server.
 
 Methods defined here:
-
__init__(self, configuration: WebScripts.Configuration)
Initialize self.  See help(type(self)) for accurate signature.
- -
add_module_or_package(self) -> None
This function add packages and modules to build custom page.
- -
add_paths(self) -> None
This function add js, static and scripts paths.
- -
app(self, environ_: os._Environ, respond: method) -> List[bytes]
This function get function page,
-return content page, catch errors and
-return HTTP errors.
- -
check_auth(self, environ: os._Environ) -> Tuple[commons.User, bool]
This function check if user is authenticated and blacklisted.
- -
check_blacklist(self, user: commons.User, ip: str) -> bool
This function checks that the IP and the
-username are not in the blacklist.
- -
get_URLs(self) -> List[str]
This function return a list of urls (scripts, documentation...)
-and the start of the URL of custom packages.
- -
get_function_page(self, path: str, filename: str) -> Tuple[~FunctionOrNone, str, bool]
This function find function from URL path.
-If the function is a WebScripts built-in function,
-return the function, filename and True. Else return the
-function, filename and False.
- -
get_session(self, cookies: List[str], ip: str) -> commons.User
This function return User from cookies.
- -
page_400(self, environ: os._Environ, user: commons.User, filename: str, method: str, respond: method)
This function return error 400 web page.
- -
page_401(self, environ: os._Environ, user: commons.User, filename: str, error_description: str, respond: method)
This function return error 401 web page.
- -
page_403(self, environ: os._Environ, user: commons.User, filename: str, error_description: str, respond: method)
This function return error 403 web page.
- -
page_404(self, environ: os._Environ, user: commons.User, filename: str, url: str, respond: method)
This function return error 404 web page.
- -
page_406(self, environ: os._Environ, user: commons.User, filename: str, error_description: str, respond: method)
This function return error 406 web page.
- -
page_500(self, environ: os._Environ, user: commons.User, filename: str, error: Union[str, bytes, Iterable[bytes]], respond: method) -> List[bytes]
This function return error 500 web page.
- -
parse_body(self, environ: os._Environ) -> Tuple[~Content, str, bool]
This function returns arguments from body.
- -
return_inputs(self, arguments: List[Dict[str, ~JsonValue]], is_webscripts_request: bool) -> Tuple[List[str], List[str]]
This function returns inputs (using Server.get_inputs).
- -
send_custom_error(self, environ: os._Environ, user: commons.User, filename: str, error: str, code: str) -> Tuple[Optional[str], Optional[Dict[str, str]], Optional[str]]
This function call custom errors pages.
- -
send_error_page(self, environ: os._Environ, user: commons.User, filename: str, error: str, data: bytes, respond: method) -> List[bytes]
This function send HTTP errors.
- -
send_headers(self, environ: os._Environ, respond: method, error: str = None, headers: Dict[str, str] = None) -> None
This function send error code, message and headers.
- -
set_default_values_for_response(self, error: str, headers: Dict[str, str]) -> Tuple[str, Dict[str, str]]
This function returns default error if not defined and
-default headers updated with custom headers.
- -
-Static methods defined here:
-
check_origin(environ_getter: collections.abc.Callable, environ: os._Environ) -> bool
This function checks Origin of POST methods.
- -
get_attributes(object_: object, attributes: List[str], is_not_package: bool = True) -> Tuple[~FunctionOrNone, bool]
This function get recursive attribute from object.
- -
get_baseurl(environ_getter: collections.abc.Callable, environ: os._Environ) -> str
This function returns URL base.
- -
get_content_length(environ: os._Environ) -> int
This function returns the content length.
- -
get_fullurl(environ: os._Environ) -> str
This function returns the full URL (based on the PEP 3333).

-Link: https://peps.python.org/pep-3333/
- -
get_inputs(arguments: List[Dict[str, ~JsonValue]]) -> Tuple[List[str], List[str]]
This function returns inputs and arguments from arguments.
- -
get_json_content(body: bytes, content_type: str) -> ~JsonValue
This functions returns the loaded JSON content.
- -
return_page(page: Union[bytes, str, Iterable[bytes]]) -> List[bytes]
This function returns response as a list of bytes.
- -
set_default_headers(headers: Dict[str, str], security: bool, configuration: WebScripts.Configuration) -> None
This function sets defaults headers.
- -
try_get_command(body: Dict[str, ~JsonValue]) -> Optional[Tuple[~Content, str, bool]]
This function returns arguments, CSRF token and True if is WebScripts
-request. If is not a WebScripts request because there's no "arguments"
-section in request content, this function returns None. If an error
-is raised in arguments parser, this function returns the JSON
-content, None and False.
- -
use_basic_auth(credentials: str, pages: Pages.Pages, *args) -> Tuple[str, Dict[str, str], str]
This function decodes basic auth and
-authenticates user with it.
- -
-Data descriptors defined here:
-
__dict__
-
dictionary for instance variables (if defined)
-
-
__weakref__
-
list of weak references to the object (if defined)
-
-
-Data and other attributes defined here:
-
CommonsClasses = <class 'WebScripts.Server.CommonsClasses'>
- -

- - - - - -
 
-Functions
       
main() -> int
Main function to build the
-configurations and launch the server.
-

- - - - - -
 
-Data
       __all__ = ['Configuration', 'Server', 'main']
-__author_email__ = 'mauricelambert434@gmail.com'
-__copyright__ = '\nWebScripts Copyright (C) 2021, 2022, 2023, 202...ome to redistribute it\nunder certain conditions.\n'
-__description__ = 'This tool runs CLI scripts and displays output in a Web Interface.'
-__license__ = 'GPL-3.0 License'
-__maintainer__ = 'Maurice Lambert'
-__maintainer_email__ = 'mauricelambert434@gmail.com'
-__url__ = 'https://github.com/mauricelambert/WebScripts'

- - - - - -
 
-Author
       Maurice Lambert
- \ No newline at end of file diff --git a/static/html/manage_defaults_databases.html b/static/html/manage_defaults_databases.html deleted file mode 100644 index 5d2c234c..00000000 --- a/static/html/manage_defaults_databases.html +++ /dev/null @@ -1,412 +0,0 @@ - -Python: module manage_defaults_databases - - - - - -
 
- 
manage_defaults_databases (version 2.0.2)
index
manage_defaults_databases.py
-

This tool runs CLI scripts and displays output in a Web Interface.

-This file implement some functions to manage WebScript default databases.

-

- - - - - -
 
-Classes
       
-
builtins.Exception(builtins.BaseException) -
-
-
GroupError -
UserError -
-
-
builtins.tuple(builtins.object) -
-
-
Group -
User -
-
-
-

- - - - - - - -
 
-class Group(builtins.tuple)
   Group(ID, name)

-Group(ID, name)
 
 
Method resolution order:
-
Group
-
builtins.tuple
-
builtins.object
-
-
-Methods defined here:
-
__getnewargs__(self)
Return self as a plain tuple.  Used by copy and pickle.
- -
__repr__(self)
Return a nicely formatted representation string
- -
_asdict(self)
Return a new dict which maps field names to their values.
- -
_replace(self, /, **kwds)
Return a new Group object replacing specified fields with new values
- -
-Class methods defined here:
-
_make(iterable) from builtins.type
Make a new Group object from a sequence or iterable
- -
-Static methods defined here:
-
__new__(_cls, ID, name)
Create new instance of Group(ID, name)
- -
-Data descriptors defined here:
-
ID
-
Alias for field number 0
-
-
name
-
Alias for field number 1
-
-
-Data and other attributes defined here:
-
__match_args__ = ('ID', 'name')
- -
_field_defaults = {}
- -
_fields = ('ID', 'name')
- -
-Methods inherited from builtins.tuple:
-
__add__(self, value, /)
Return self+value.
- -
__contains__(self, key, /)
Return key in self.
- -
__eq__(self, value, /)
Return self==value.
- -
__ge__(self, value, /)
Return self>=value.
- -
__getattribute__(self, name, /)
Return getattr(self, name).
- -
__getitem__(self, key, /)
Return self[key].
- -
__gt__(self, value, /)
Return self>value.
- -
__hash__(self, /)
Return hash(self).
- -
__iter__(self, /)
Implement iter(self).
- -
__le__(self, value, /)
Return self<=value.
- -
__len__(self, /)
Return len(self).
- -
__lt__(self, value, /)
Return self<value.
- -
__mul__(self, value, /)
Return self*value.
- -
__ne__(self, value, /)
Return self!=value.
- -
__rmul__(self, value, /)
Return value*self.
- -
count(self, value, /)
Return number of occurrences of value.
- -
index(self, value, start=0, stop=9223372036854775807, /)
Return first index of value.

-Raises ValueError if the value is not present.
- -
-Class methods inherited from builtins.tuple:
-
__class_getitem__(...) from builtins.type
See PEP 585
- -

- - - - - - - -
 
-class GroupError(builtins.Exception)
   This class can raise a GroupError.
 
 
Method resolution order:
-
GroupError
-
builtins.Exception
-
builtins.BaseException
-
builtins.object
-
-
-Data descriptors defined here:
-
__weakref__
-
list of weak references to the object (if defined)
-
-
-Methods inherited from builtins.Exception:
-
__init__(self, /, *args, **kwargs)
Initialize self.  See help(type(self)) for accurate signature.
- -
-Static methods inherited from builtins.Exception:
-
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.
- -
-Methods inherited from builtins.BaseException:
-
__delattr__(self, name, /)
Implement delattr(self, name).
- -
__getattribute__(self, name, /)
Return getattr(self, name).
- -
__reduce__(...)
Helper for pickle.
- -
__repr__(self, /)
Return repr(self).
- -
__setattr__(self, name, value, /)
Implement setattr(self, name, value).
- -
__setstate__(...)
- -
__str__(self, /)
Return str(self).
- -
with_traceback(...)
Exception.with_traceback(tb) --
-set self.__traceback__ to tb and return self.
- -
-Data descriptors inherited from builtins.BaseException:
-
__cause__
-
exception cause
-
-
__context__
-
exception context
-
-
__dict__
-
-
__suppress_context__
-
-
__traceback__
-
-
args
-
-

- - - - - - - -
 
-class User(builtins.tuple)
   User(ID, name, password, salt, enumerations, IPs, groups, apikey, categories, scripts)

-User(ID, name, password, salt, enumerations, IPs, groups, apikey, categories, scripts)
 
 
Method resolution order:
-
User
-
builtins.tuple
-
builtins.object
-
-
-Methods defined here:
-
__getnewargs__(self)
Return self as a plain tuple.  Used by copy and pickle.
- -
__repr__(self)
Return a nicely formatted representation string
- -
_asdict(self)
Return a new dict which maps field names to their values.
- -
_replace(self, /, **kwds)
Return a new User object replacing specified fields with new values
- -
-Class methods defined here:
-
_make(iterable) from builtins.type
Make a new User object from a sequence or iterable
- -
-Static methods defined here:
-
__new__(_cls, ID, name, password, salt, enumerations, IPs, groups, apikey, categories, scripts)
Create new instance of User(ID, name, password, salt, enumerations, IPs, groups, apikey, categories, scripts)
- -
-Data descriptors defined here:
-
ID
-
Alias for field number 0
-
-
name
-
Alias for field number 1
-
-
password
-
Alias for field number 2
-
-
salt
-
Alias for field number 3
-
-
enumerations
-
Alias for field number 4
-
-
IPs
-
Alias for field number 5
-
-
groups
-
Alias for field number 6
-
-
apikey
-
Alias for field number 7
-
-
categories
-
Alias for field number 8
-
-
scripts
-
Alias for field number 9
-
-
-Data and other attributes defined here:
-
__match_args__ = ('ID', 'name', 'password', 'salt', 'enumerations', 'IPs', 'groups', 'apikey', 'categories', 'scripts')
- -
_field_defaults = {}
- -
_fields = ('ID', 'name', 'password', 'salt', 'enumerations', 'IPs', 'groups', 'apikey', 'categories', 'scripts')
- -
-Methods inherited from builtins.tuple:
-
__add__(self, value, /)
Return self+value.
- -
__contains__(self, key, /)
Return key in self.
- -
__eq__(self, value, /)
Return self==value.
- -
__ge__(self, value, /)
Return self>=value.
- -
__getattribute__(self, name, /)
Return getattr(self, name).
- -
__getitem__(self, key, /)
Return self[key].
- -
__gt__(self, value, /)
Return self>value.
- -
__hash__(self, /)
Return hash(self).
- -
__iter__(self, /)
Implement iter(self).
- -
__le__(self, value, /)
Return self<=value.
- -
__len__(self, /)
Return len(self).
- -
__lt__(self, value, /)
Return self<value.
- -
__mul__(self, value, /)
Return self*value.
- -
__ne__(self, value, /)
Return self!=value.
- -
__rmul__(self, value, /)
Return value*self.
- -
count(self, value, /)
Return number of occurrences of value.
- -
index(self, value, start=0, stop=9223372036854775807, /)
Return first index of value.

-Raises ValueError if the value is not present.
- -
-Class methods inherited from builtins.tuple:
-
__class_getitem__(...) from builtins.type
See PEP 585
- -

- - - - - - - -
 
-class UserError(builtins.Exception)
   This class can raise a UserError.
 
 
Method resolution order:
-
UserError
-
builtins.Exception
-
builtins.BaseException
-
builtins.object
-
-
-Data descriptors defined here:
-
__weakref__
-
list of weak references to the object (if defined)
-
-
-Methods inherited from builtins.Exception:
-
__init__(self, /, *args, **kwargs)
Initialize self.  See help(type(self)) for accurate signature.
- -
-Static methods inherited from builtins.Exception:
-
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.
- -
-Methods inherited from builtins.BaseException:
-
__delattr__(self, name, /)
Implement delattr(self, name).
- -
__getattribute__(self, name, /)
Return getattr(self, name).
- -
__reduce__(...)
Helper for pickle.
- -
__repr__(self, /)
Return repr(self).
- -
__setattr__(self, name, value, /)
Implement setattr(self, name, value).
- -
__setstate__(...)
- -
__str__(self, /)
Return str(self).
- -
with_traceback(...)
Exception.with_traceback(tb) --
-set self.__traceback__ to tb and return self.
- -
-Data descriptors inherited from builtins.BaseException:
-
__cause__
-
exception cause
-
-
__context__
-
exception context
-
-
__dict__
-
-
__suppress_context__
-
-
__traceback__
-
-
args
-
-

- - - - - -
 
-Functions
       
add_group(name: str, id_: int) -> manage_defaults_databases.Group
This function add group in database or raise a GroupError.
-
add_user(name: str, password: str, groups: List[int], ips: List[str] = ['*'], categories: List[str] = ['*'], scripts: List[str] = ['*']) -> manage_defaults_databases.User
This function add user in database or raise a UserError.
-
change_user_password(id_: str, new_password: str, old_password: str = None) -> manage_defaults_databases.User
This function change a user password.
-
create_default_databases() -> None
This function create defaults users and groups.
-
delete_group(id_: int) -> manage_defaults_databases.Group
This function delete a group by id and return the deleted group.
-
delete_user(id_: int) -> manage_defaults_databases.User
This function delete a user by id and return the deleted user.
-
get_apikey(id_: str, password: str) -> str
This function returns the API key after verification of authentication.
-
get_dict_groups(by_name: bool = False) -> Dict[str, str]
This function returns the dict of groups (ID: Name or Name: ID).
-
get_groups() -> collections.abc.Iterator[manage_defaults_databases.Group]
This function get groups from CSV database.
-
get_users() -> collections.abc.Iterator[manage_defaults_databases.User]
This function get users from CSV database.
-

- - - - - -
 
-Data
       __all__ = ['User', 'Group', 'add_user', 'add_group', 'get_users', 'UserError', 'GroupError', 'get_groups', 'get_apikey', 'delete_user', 'delete_group', 'get_dict_groups', 'change_user_password', 'create_default_databases']
-__author_email__ = 'mauricelambert434@gmail.com'
-__copyright__ = '\nWebScripts Copyright (C) 2021, 2022, 2023 Mau...ome to redistribute it\nunder certain conditions.\n'
-__description__ = '\nThis tool runs CLI scripts and displays output ...ctions to manage WebScript default user database\n'
-__license__ = 'GPL-3.0 License'
-__maintainer__ = 'Maurice Lambert'
-__maintainer_email__ = 'mauricelambert434@gmail.com'
-__url__ = 'https://github.com/mauricelambert/WebScripts'
-__warningregistry__ = {'version': 0}

- - - - - -
 
-Author
       Maurice Lambert
- \ No newline at end of file diff --git a/static/html/notification.html b/static/html/notification.html deleted file mode 100644 index dd12d169..00000000 --- a/static/html/notification.html +++ /dev/null @@ -1,47 +0,0 @@ - -Python: module notification - - - - - -
 
- 
notification (version 0.0.1)
index
notification.py
-

This tool run scripts and display the result in a Web Interface.

-This module adds notifications on WebScripts pages.

-

- - - - - -
 
-Functions
       
add(environ: os._Environ, user: ~User, server: ~Server, filename: str, arguments: List[str], inputs: List[str], csrf_token: str = None) -> Tuple[str, Dict[str, str], str]
This function adds a new notification
-in WebScripts pages.
-

- - - - - -
 
-Data
       __all__ = ['add']
-__annotations__ = {'NEW_LINE': <class 'str'>, 'notification_id': <class 'int'>}
-__author_email__ = 'mauricelambert434@gmail.com'
-__copyright__ = '\nWebScripts Copyright (C) 2021, 2022 Maurice L...ome to redistribute it\nunder certain conditions.\n'
-__description__ = '\nThis tool run scripts and display the result in...s module adds notifications on WebScripts pages.\n'
-__license__ = 'GPL-3.0 License'
-__maintainer__ = 'Maurice Lambert'
-__maintainer_email__ = 'mauricelambert434@gmail.com'
-__url__ = 'https://github.com/mauricelambert/WebScripts'

- - - - - -
 
-Author
       Maurice Lambert
- \ No newline at end of file diff --git a/static/html/requests_management.html b/static/html/requests_management.html deleted file mode 100644 index 1d9a26a5..00000000 --- a/static/html/requests_management.html +++ /dev/null @@ -1,184 +0,0 @@ - -Python: module requests_management - - - - - -
 
- 
requests_management (version 0.1.0)
index
requests_management.py
-

#    This tool runs CLI scripts and displays output in a Web Interface.

-This file implement some functions to manage requests/reports on WebScripts.

-

- - - - - -
 
-Modules
       
csv
-
ntpath
-

- - - - - -
 
-Classes
       
-
builtins.tuple(builtins.object) -
-
-
Request -
-
-
-

- - - - - - - -
 
-class Request(builtins.tuple)
   Request(ID, Time, UserName, ErrorCode, Page, UserAgent, Subject, Reason, Name)

-Request(ID, Time, UserName, ErrorCode, Page, UserAgent, Subject, Reason, Name)
 
 
Method resolution order:
-
Request
-
builtins.tuple
-
builtins.object
-
-
-Methods defined here:
-
__getnewargs__(self)
Return self as a plain tuple.  Used by copy and pickle.
- -
__repr__(self)
Return a nicely formatted representation string
- -
_asdict(self)
Return a new dict which maps field names to their values.
- -
_replace(self, /, **kwds)
Return a new Request object replacing specified fields with new values
- -
-Class methods defined here:
-
_make(iterable) from builtins.type
Make a new Request object from a sequence or iterable
- -
-Static methods defined here:
-
__new__(_cls, ID, Time, UserName, ErrorCode, Page, UserAgent, Subject, Reason, Name)
Create new instance of Request(ID, Time, UserName, ErrorCode, Page, UserAgent, Subject, Reason, Name)
- -
-Data descriptors defined here:
-
ID
-
Alias for field number 0
-
-
Time
-
Alias for field number 1
-
-
UserName
-
Alias for field number 2
-
-
ErrorCode
-
Alias for field number 3
-
-
Page
-
Alias for field number 4
-
-
UserAgent
-
Alias for field number 5
-
-
Subject
-
Alias for field number 6
-
-
Reason
-
Alias for field number 7
-
-
Name
-
Alias for field number 8
-
-
-Data and other attributes defined here:
-
__match_args__ = ('ID', 'Time', 'UserName', 'ErrorCode', 'Page', 'UserAgent', 'Subject', 'Reason', 'Name')
- -
_field_defaults = {}
- -
_fields = ('ID', 'Time', 'UserName', 'ErrorCode', 'Page', 'UserAgent', 'Subject', 'Reason', 'Name')
- -
-Methods inherited from builtins.tuple:
-
__add__(self, value, /)
Return self+value.
- -
__contains__(self, key, /)
Return key in self.
- -
__eq__(self, value, /)
Return self==value.
- -
__ge__(self, value, /)
Return self>=value.
- -
__getattribute__(self, name, /)
Return getattr(self, name).
- -
__getitem__(self, key, /)
Return self[key].
- -
__gt__(self, value, /)
Return self>value.
- -
__hash__(self, /)
Return hash(self).
- -
__iter__(self, /)
Implement iter(self).
- -
__le__(self, value, /)
Return self<=value.
- -
__len__(self, /)
Return len(self).
- -
__lt__(self, value, /)
Return self<value.
- -
__mul__(self, value, /)
Return self*value.
- -
__ne__(self, value, /)
Return self!=value.
- -
__rmul__(self, value, /)
Return value*self.
- -
count(self, value, /)
Return number of occurrences of value.
- -
index(self, value, start=0, stop=9223372036854775807, /)
Return first index of value.

-Raises ValueError if the value is not present.
- -
-Class methods inherited from builtins.tuple:
-
__class_getitem__(...) from builtins.type
See PEP 585
- -

- - - - - -
 
-Functions
       
delete_request(id_: str) -> requests_management.Request
This function rewrite the request database without the specified request.
-
get_request(id_: str) -> requests_management.Request
This function return a specific request.
-
get_requests() -> collections.abc.Iterator[requests_management.Request]
This function build Request from database.
-

- - - - - -
 
-Data
       __all__ = ['Request', 'get_requests', 'get_request', 'delete_request']
-__author_email__ = 'mauricelambert434@gmail.com'
-__copyright__ = '\nWebScripts Copyright (C) 2021, 2022, 2023 Mau...ome to redistribute it\nunder certain conditions.\n'
-__description__ = '\nThis tool runs CLI scripts and displays output ...nctions to manage requests/reports on WebScripts\n'
-__license__ = 'GPL-3.0 License'
-__maintainer__ = 'Maurice Lambert'
-__maintainer_email__ = 'mauricelambert434@gmail.com'
-__url__ = 'https://github.com/mauricelambert/WebScripts'

- - - - - -
 
-Author
       Maurice Lambert
- \ No newline at end of file diff --git a/static/html/rss.html b/static/html/rss.html deleted file mode 100644 index 3592712d..00000000 --- a/static/html/rss.html +++ /dev/null @@ -1,208 +0,0 @@ - -Python: module rss - - - - - -
 
- 
rss (version 0.0.1)
index
rss.py
-

This tool runs CLI scripts and displays output in a Web Interface.

-This file implements a RSS feed.

-

- - - - - -
 
-Classes
       
-
builtins.object -
-
-
Feed -
-
-
enum.Enum(builtins.object) -
-
-
FIELDS -
-
-
-

- - - - - - - -
 
-class FIELDS(enum.Enum)
   FIELDS(value, names=None, *, module=None, qualname=None, type=None, start=1)

-An enumeration.
 
 
Method resolution order:
-
FIELDS
-
enum.Enum
-
builtins.object
-
-
-Data and other attributes defined here:
-
author = <FIELDS.author: 1>
- -
categories = <FIELDS.categories: 5>
- -
comments = <FIELDS.comments: 7>
- -
description = <FIELDS.description: 3>
- -
guid = <FIELDS.guid: 0>
- -
link = <FIELDS.link: 4>
- -
pubDate = <FIELDS.pubDate: 6>
- -
title = <FIELDS.title: 2>
- -
-Data descriptors inherited from enum.Enum:
-
name
-
The name of the Enum member.
-
-
value
-
The value of the Enum member.
-
-
-Readonly properties inherited from enum.EnumMeta:
-
__members__
-
Returns a mapping of member name->value.

-This mapping lists all enum members, including aliases. Note that this
-is a read-only view of the internal mapping.
-
-

- - - - - - - -
 
-class Feed(builtins.object)
   Feed(environ: os._Environ, user: ~User, server: ~Server, category: str, arguments: Dict[str, Dict[str, str]], inputs: List[str], csrf_token: str = None) -&gt; Tuple[str, Dict[str, str], Iterable[bytes]]

-This class implements the RSS feed.
 
 Class methods defined here:
-
csv(environ: os._Environ, user: ~User, server: ~Server, category: str, arguments: Dict[str, Dict[str, str]], inputs: List[str], csrf_token: str = None) -> Tuple[str, Dict[str, str], str] from builtins.type
This function prints the RSS feed content as CSV.
- -
generator(full_url: str, base_url: str, rss_path: str, category: str) -> Iterable[bytes] from builtins.type
This generator returns RSS feed content.
- -
json(environ: os._Environ, user: ~User, server: ~Server, category: str, arguments: Dict[str, Dict[str, str]], inputs: List[str], csrf_token: str = None) -> Tuple[str, Dict[str, str], str] from builtins.type
This function prints the RSS feed content as JSON.
- -
-Static methods defined here:
-
__new__(cls: type, environ: os._Environ, user: ~User, server: ~Server, category: str, arguments: Dict[str, Dict[str, str]], inputs: List[str], csrf_token: str = None) -> Tuple[str, Dict[str, str], Iterable[bytes]]
This function prints the RSS feed.
- -
-Data descriptors defined here:
-
__dict__
-
dictionary for instance variables (if defined)
-
-
__weakref__
-
list of weak references to the object (if defined)
-
-
-Data and other attributes defined here:
-
__annotations__ = {'default': typing.List[str], 'optional': typing.List[str], 'required': typing.List[str], 'rss_path': <class 'str'>}
- -
default = ['author', 'guid', 'pubDate', 'lastBuildDate']
- -
optional = ['comments']
- -
required = ['title', 'description', 'link', 'categories']
- -
rss_path = None
- -

- - - - - -
 
-Functions
       
get_rss_path(server: ~Server) -> str
This function returns the rss path.
-
localtime(...)
localtime([seconds]) -> (tm_year,tm_mon,tm_mday,tm_hour,tm_min,
-                          tm_sec,tm_wday,tm_yday,tm_isdst)

-Convert seconds since the Epoch to a time tuple expressing local time.
-When 'seconds' is not passed in, convert the current time instead.
-
strftime(...)
strftime(format[, tuple]) -> string

-Convert a time tuple to a string according to a format specification.
-See the library reference manual for formatting codes. When the time tuple
-is not present, current time as returned by localtime() is used.

-Commonly used format codes:

-%Y  Year with century as a decimal number.
-%m  Month as a decimal number [01,12].
-%d  Day of the month as a decimal number [01,31].
-%H  Hour (24-hour clock) as a decimal number [00,23].
-%M  Minute as a decimal number [00,59].
-%S  Second as a decimal number [00,61].
-%z  Time zone offset from UTC.
-%a  Locale's abbreviated weekday name.
-%A  Locale's full weekday name.
-%b  Locale's abbreviated month name.
-%B  Locale's full month name.
-%c  Locale's appropriate date and time representation.
-%I  Hour (12-hour clock) as a decimal number [01,12].
-%p  Locale's equivalent of either AM or PM.

-Other codes may be available on your platform.  See documentation for
-the C library strftime function.
-
writer(...)
csv_writer = csv.writer(fileobj [, dialect='excel']
-                            [optional keyword args])
-    for row in sequence:
-        csv_writer.writerow(row)

-    [or]

-    csv_writer = csv.writer(fileobj [, dialect='excel']
-                            [optional keyword args])
-    csv_writer.writerows(rows)

-The "fileobj" argument can be any object that supports the file API.
-

- - - - - -
 
-Data
       Dict = typing.Dict
-Iterable = typing.Iterable
-List = typing.List
-QUOTE_ALL = 1
-Server = ~Server
-Tuple = typing.Tuple
-User = ~User
-__author_email__ = 'mauricelambert434@gmail.com'
-__copyright__ = '\nWebScripts Copyright (C) 2021, 2022, 2023 Mau...ome to redistribute it\nunder certain conditions.\n'
-__description__ = '\nThis tool runs CLI scripts and displays output ...Web Interface.\n\nThis file implements a RSS feed.\n'
-__license__ = 'GPL-3.0 License'
-__maintainer__ = 'Maurice Lambert'
-__maintainer_email__ = 'mauricelambert434@gmail.com'
-__url__ = 'https://github.com/mauricelambert/WebScripts'
-copyright = '\nWebScripts Copyright (C) 2021, 2022, 2023 Mau...ome to redistribute it\nunder certain conditions.\n'
-license = 'GPL-3.0 License'

- - - - - -
 
-Author
       Maurice Lambert
- \ No newline at end of file diff --git a/static/html/share.html b/static/html/share.html deleted file mode 100644 index 0938cec4..00000000 --- a/static/html/share.html +++ /dev/null @@ -1,103 +0,0 @@ - -Python: module share - - - - - -
 
- 
share (version 0.1.0)
index
share.py
-

This tool run scripts and display the result in a Web Interface.

-This file download and upload functions for scripts,
-tools and command line client.

-

- - - - - -
 
-Modules
       
ntpath
-

- - - - - -
 
-Classes
       
-
builtins.object -
-
-
Download -
-
-
-

- - - - - - - -
 
-class Download(builtins.object)
   This class implement download functions for filename or ID.
 
 Methods defined here:
-
filename(environ: os._Environ, user: ~User, server_configuration: ~ServerConfiguration, filename: str, arguments: List[str], inputs: List[str], csrf_token: str = None) -> Tuple[str, Dict[str, str], str]
This funtion download file by filename.
- -
id(environ: os._Environ, user: ~User, server_configuration: ~ServerConfiguration, id_: str, arguments: List[str], inputs: List[str], csrf_token: str = None) -> Tuple[str, Dict[str, str], str]
This funtion download file by ID.
- -
-Static methods defined here:
-
get_data(file: uploads_management.Upload) -> bytes
This function get file and manage the compression.
- -
-Data descriptors defined here:
-
__dict__
-
dictionary for instance variables (if defined)
-
-
__weakref__
-
list of weak references to the object (if defined)
-
-

- - - - - -
 
-Functions
       
upload(environ: os._Environ, user: ~User, server_configuration: ~ServerConfiguration, filename: str, data: bytes, none: None, csrf_token: str = None) -> Tuple[str, Dict[str, str], str]
This funtion upload file.
-

- - - - - -
 
-Data
       Dict = typing.Dict
-List = typing.List
-ServerConfiguration = ~ServerConfiguration
-Tuple = typing.Tuple
-User = ~User
-__author_email__ = 'mauricelambert434@gmail.com'
-__copyright__ = '\nWebScripts Copyright (C) 2021, 2022 Maurice L...ome to redistribute it\nunder certain conditions.\n'
-__description__ = '\nThis tool run scripts and display the result in...tions for scripts,\ntools and command line client.'
-__license__ = 'GPL-3.0 License'
-__maintainer__ = 'Maurice Lambert'
-__maintainer_email__ = 'mauricelambert434@gmail.com'
-__url__ = 'https://github.com/mauricelambert/WebScripts'
-copyright = '\nWebScripts Copyright (C) 2021, 2022 Maurice L...ome to redistribute it\nunder certain conditions.\n'
-env = environ({'ALLUSERSPROFILE': 'C:\\ProgramData', '...\\WebScripts\\go\\bin', '_OLD_VIRTUAL_PROMPT': '$P$G'})
-license = 'GPL-3.0 License'
-syspath = [r'/home/WebScripts\scripts\doc', r'C:\Program Files\Python\python39.zip', r'C:\Program Files\Python\DLLs', r'C:\Program Files\Python\lib', r'C:\Program Files\Python', r'C:\Users\WebScripts\Documents\dev\test', r'C:\Users\WebScripts\Documents\dev\test\lib\site-packages', r'c:\users\WebScripts\documents\dev\modules\webscripts', r'C:\Users\WebScripts\Documents\dev\test\lib\site-packages\win32', r'C:\Users\WebScripts\Documents\dev\test\lib\site-packages\win32\lib', r'C:\Users\WebScripts\Documents\dev\test\lib\site-packages\Pythonwin', r'/home/WebScripts\modules']

- - - - - -
 
-Author
       Maurice Lambert
- \ No newline at end of file diff --git a/static/html/uploads_management.html b/static/html/uploads_management.html deleted file mode 100644 index 76f4579c..00000000 --- a/static/html/uploads_management.html +++ /dev/null @@ -1,266 +0,0 @@ - -Python: module uploads_management - - - - - -
 
- 
uploads_management (version 1.0.0)
index
uploads_management.py
-

This tool runs CLI scripts and displays output in a Web Interface.

-This file implement some functions to manage uploads on WebScripts.

-

- - - - - -
 
-Classes
       
-
builtins.object -
-
-
FileMetadata -
UploadedFile -
-
-
builtins.tuple(builtins.object) -
-
-
Upload -
-
-
-

- - - - - - - -
 
-class FileMetadata(builtins.object)
   This class implements file metadata for
-uploaded files.
 
 Methods defined here:
-
__init__(self)
Initialize self.  See help(type(self)) for accurate signature.
- -
add(self, stat: os.stat_result, timestamp: float)
This function add a version to file metadata.
- -
-Data descriptors defined here:
-
__dict__
-
dictionary for instance variables (if defined)
-
-
__weakref__
-
list of weak references to the object (if defined)
-
-

- - - - - - - -
 
-class Upload(builtins.tuple)
   Upload(ID, name, read_permission, write_permission, delete_permission, hidden, is_deleted, is_binary, no_compression, timestamp, user, version)

-Upload(ID, name, read_permission, write_permission, delete_permission, hidden, is_deleted, is_binary, no_compression, timestamp, user, version)
 
 
Method resolution order:
-
Upload
-
builtins.tuple
-
builtins.object
-
-
-Methods defined here:
-
__getnewargs__(self)
Return self as a plain tuple.  Used by copy and pickle.
- -
__repr__(self)
Return a nicely formatted representation string
- -
_asdict(self)
Return a new dict which maps field names to their values.
- -
_replace(self, /, **kwds)
Return a new Upload object replacing specified fields with new values
- -
-Class methods defined here:
-
_make(iterable) from builtins.type
Make a new Upload object from a sequence or iterable
- -
-Static methods defined here:
-
__new__(_cls, ID, name, read_permission, write_permission, delete_permission, hidden, is_deleted, is_binary, no_compression, timestamp, user, version)
Create new instance of Upload(ID, name, read_permission, write_permission, delete_permission, hidden, is_deleted, is_binary, no_compression, timestamp, user, version)
- -
-Data descriptors defined here:
-
ID
-
Alias for field number 0
-
-
name
-
Alias for field number 1
-
-
read_permission
-
Alias for field number 2
-
-
write_permission
-
Alias for field number 3
-
-
delete_permission
-
Alias for field number 4
-
-
hidden
-
Alias for field number 5
-
-
is_deleted
-
Alias for field number 6
-
-
is_binary
-
Alias for field number 7
-
-
no_compression
-
Alias for field number 8
-
-
timestamp
-
Alias for field number 9
-
-
user
-
Alias for field number 10
-
-
version
-
Alias for field number 11
-
-
-Data and other attributes defined here:
-
__match_args__ = ('ID', 'name', 'read_permission', 'write_permission', 'delete_permission', 'hidden', 'is_deleted', 'is_binary', 'no_compression', 'timestamp', 'user', 'version')
- -
_field_defaults = {}
- -
_fields = ('ID', 'name', 'read_permission', 'write_permission', 'delete_permission', 'hidden', 'is_deleted', 'is_binary', 'no_compression', 'timestamp', 'user', 'version')
- -
-Methods inherited from builtins.tuple:
-
__add__(self, value, /)
Return self+value.
- -
__contains__(self, key, /)
Return key in self.
- -
__eq__(self, value, /)
Return self==value.
- -
__ge__(self, value, /)
Return self>=value.
- -
__getattribute__(self, name, /)
Return getattr(self, name).
- -
__getitem__(self, key, /)
Return self[key].
- -
__gt__(self, value, /)
Return self>value.
- -
__hash__(self, /)
Return hash(self).
- -
__iter__(self, /)
Implement iter(self).
- -
__le__(self, value, /)
Return self<=value.
- -
__len__(self, /)
Return len(self).
- -
__lt__(self, value, /)
Return self<value.
- -
__mul__(self, value, /)
Return self*value.
- -
__ne__(self, value, /)
Return self!=value.
- -
__rmul__(self, value, /)
Return value*self.
- -
count(self, value, /)
Return number of occurrences of value.
- -
index(self, value, start=0, stop=9223372036854775807, /)
Return first index of value.

-Raises ValueError if the value is not present.
- -
-Class methods inherited from builtins.tuple:
-
__class_getitem__(...) from builtins.type
See PEP 585
- -

- - - - - - - -
 
-class UploadedFile(builtins.object)
   UploadedFile(name: str, read_access: int, write_access: int, delete_access: int, hidden: bool, binary: bool, no_compression: bool, with_access: bool = True)

-This class implements the file type for
-uploaded files.
 
 Methods defined here:
-
__del__(self, *args, **kwargs)
- -
__enter__(self, *args, **kwargs)
- -
__exit__(self, *args, **kwargs)
- -
__getattr__(self, attr: str)
- -
__init__(self, name: str, read_access: int, write_access: int, delete_access: int, hidden: bool, binary: bool, no_compression: bool, with_access: bool = True)
Initialize self.  See help(type(self)) for accurate signature.
- -
__iter__(self, *args, **kwargs)
- -
__next__(self, *args, **kwargs)
- -
-Data descriptors defined here:
-
__dict__
-
dictionary for instance variables (if defined)
-
-
__weakref__
-
list of weak references to the object (if defined)
-
-

- - - - - -
 
-Functions
       
delete_file(name: str) -> uploads_management.Upload
This function delete an uploaded file.
-
get_file(name: str, id_: str = None) -> Tuple[List[uploads_management.Upload], collections.Counter]
This function return the history of a file.

-If name is None, this function get Upload by ID.
-
get_file_content(name: str = None, id_: str = None) -> Tuple[str, str]
This function return a base64 of the file
-content and the filename (without check permissions).

-If id_ and name arguments are None this function return (None, None).

-Using a name this function return the last versions of the file content.
-Using an ID this function return the version of this ID.
-
get_metadata() -> Dict[str, uploads_management.FileMetadata]
This function returns metadata of
-each uploaded files and versions.
-
get_reader(file: uploads_management.Upload) -> _io._TextIOBase
This function returns a reader
-of the uploaded file.
-
get_visible_files() -> collections.abc.Iterator[uploads_management.Upload]
This function return upload if not hidden.
-
read_file(name: str) -> str
This function check permission and
-return a base64 of the file content.
-
write_file(data: str, name: str, read_access: int, write_access: int, delete_access: int, hidden: bool, binary: bool, no_compression: bool, is_b64: bool, with_access: bool = True) -> uploads_management.Upload
This function uploads a file.
-

- - - - - -
 
-Data
       __all__ = ['Upload', 'get_file', 'read_file', 'write_file', 'get_reader', 'delete_file', 'get_metadata', 'FileMetadata', 'UploadedFile', 'get_file_content', 'get_visible_files']
-__author_email__ = 'mauricelambert434@gmail.com'
-__copyright__ = '\nWebScripts Copyright (C) 2021, 2022, 2023 Mau...ome to redistribute it\nunder certain conditions.\n'
-__description__ = '\nThis tool runs CLI scripts and displays output ...t some functions to manage uploads on WebScripts\n'
-__license__ = 'GPL-3.0 License'
-__maintainer__ = 'Maurice Lambert'
-__maintainer_email__ = 'mauricelambert434@gmail.com'
-__url__ = 'https://github.com/mauricelambert/WebScripts'
-__warningregistry__ = {'version': 0}

- - - - - -
 
-Author
       Maurice Lambert
- \ No newline at end of file diff --git a/static/html/utils.html b/static/html/utils.html deleted file mode 100644 index 26fe3d91..00000000 --- a/static/html/utils.html +++ /dev/null @@ -1,439 +0,0 @@ - -Python: module utils - - - - - -
 
- 
utils (version 1.0.2)
index
utils.py
-

This tool runs CLI scripts and displays output in a Web Interface.

-This file implements some tools for WebScripts server
-and scripts (Logs, Namespace for configuration, ...).

-

- - - - - -
 
-Modules
       
logging
-
ntpath
-

- - - - - -
 
-Classes
       
-
builtins.object -
-
-
_Logs -
-
-
logging.handlers.RotatingFileHandler(logging.handlers.BaseRotatingHandler) -
-
-
CustomLogHandler -
-
-
types.SimpleNamespace(builtins.object) -
-
-
DefaultNamespace -
-
-
-

- - - - - - - -
 
-class CustomLogHandler(logging.handlers.RotatingFileHandler)
   CustomLogHandler(filename, mode='a', maxBytes=0, backupCount=0, encoding=None, delay=False, errors=None)

-This class is a custom logging handler.
 
 
Method resolution order:
-
CustomLogHandler
-
logging.handlers.RotatingFileHandler
-
logging.handlers.BaseRotatingHandler
-
logging.FileHandler
-
logging.StreamHandler
-
logging.Handler
-
logging.Filterer
-
builtins.object
-
-
-Methods defined here:
-
doRollover(self)
Do a rollover, as described in __init__().
- -
namer(self, name: str) -> str
This function returns the new name of the old log files.
- -
rotator(self, source: str, destination: str) -> None
This function compresses old log files.
- -
-Methods inherited from logging.handlers.RotatingFileHandler:
-
__init__(self, filename, mode='a', maxBytes=0, backupCount=0, encoding=None, delay=False, errors=None)
Open the specified file and use it as the stream for logging.

-By default, the file grows indefinitely. You can specify particular
-values of maxBytes and backupCount to allow the file to rollover at
-a predetermined size.

-Rollover occurs whenever the current log file is nearly maxBytes in
-length. If backupCount is >= 1, the system will successively create
-new files with the same pathname as the base file, but with extensions
-".1", ".2" etc. appended to it. For example, with a backupCount of 5
-and a base file name of "app.log", you would get "app.log",
-"app.log.1", "app.log.2", ... through to "app.log.5". The file being
-written to is always "app.log" - when it gets filled up, it is closed
-and renamed to "app.log.1", and if files "app.log.1", "app.log.2" etc.
-exist, then they are renamed to "app.log.2", "app.log.3" etc.
-respectively.

-If maxBytes is zero, rollover never occurs.
- -
shouldRollover(self, record)
Determine if rollover should occur.

-Basically, see if the supplied record would cause the file to exceed
-the size limit we have.
- -
-Methods inherited from logging.handlers.BaseRotatingHandler:
-
emit(self, record)
Emit a record.

-Output the record to the file, catering for rollover as described
-in doRollover().
- -
rotate(self, source, dest)
When rotating, rotate the current log.

-The default implementation calls the 'rotator' attribute of the
-handler, if it's callable, passing the source and dest arguments to
-it. If the attribute isn't callable (the default is None), the source
-is simply renamed to the destination.

-:param source: The source filename. This is normally the base
-               filename, e.g. 'test.log'
-:param dest:   The destination filename. This is normally
-               what the source is rotated to, e.g. 'test.log.1'.
- -
rotation_filename(self, default_name)
Modify the filename of a log file when rotating.

-This is provided so that a custom filename can be provided.

-The default implementation calls the 'namer' attribute of the
-handler, if it's callable, passing the default name to
-it. If the attribute isn't callable (the default is None), the name
-is returned unchanged.

-:param default_name: The default name for the log file.
- -
-Methods inherited from logging.FileHandler:
-
__repr__(self)
Return repr(self).
- -
close(self)
Closes the stream.
- -
-Methods inherited from logging.StreamHandler:
-
flush(self)
Flushes the stream.
- -
setStream(self, stream)
Sets the StreamHandler's stream to the specified value,
-if it is different.

-Returns the old stream, if the stream was changed, or None
-if it wasn't.
- -
-Data and other attributes inherited from logging.StreamHandler:
-
terminator = '\n'
- -
-Methods inherited from logging.Handler:
-
acquire(self)
Acquire the I/O thread lock.
- -
createLock(self)
Acquire a thread lock for serializing access to the underlying I/O.
- -
format(self, record)
Format the specified record.

-If a formatter is set, use it. Otherwise, use the default formatter
-for the module.
- -
get_name(self)
- -
handle(self, record)
Conditionally emit the specified logging record.

-Emission depends on filters which may have been added to the handler.
-Wrap the actual emission of the record with acquisition/release of
-the I/O thread lock. Returns whether the filter passed the record for
-emission.
- -
handleError(self, record)
Handle errors which occur during an emit() call.

-This method should be called from handlers when an exception is
-encountered during an emit() call. If raiseExceptions is false,
-exceptions get silently ignored. This is what is mostly wanted
-for a logging system - most users will not care about errors in
-the logging system, they are more interested in application errors.
-You could, however, replace this with a custom handler if you wish.
-The record which was being processed is passed in to this method.
- -
release(self)
Release the I/O thread lock.
- -
setFormatter(self, fmt)
Set the formatter for this handler.
- -
setLevel(self, level)
Set the logging level of this handler.  level must be an int or a str.
- -
set_name(self, name)
- -
-Data descriptors inherited from logging.Handler:
-
name
-
-
-Methods inherited from logging.Filterer:
-
addFilter(self, filter)
Add the specified filter to this handler.
- -
filter(self, record)
Determine if a record is loggable by consulting all the filters.

-The default is to allow the record to be logged; any filter can veto
-this and the record is then dropped. Returns a zero value if a record
-is to be dropped, else non-zero.

-.. versionchanged:: 3.2

-   Allow filters to be just callables.
- -
removeFilter(self, filter)
Remove the specified filter from this handler.
- -
-Data descriptors inherited from logging.Filterer:
-
__dict__
-
dictionary for instance variables (if defined)
-
-
__weakref__
-
list of weak references to the object (if defined)
-
-

- - - - - - - -
 
-class DefaultNamespace(types.SimpleNamespace)
   DefaultNamespace(required: List[str] = [], optional: List[str] = [], default: dict = {}, types: dict = {})

-This class build simple namespace with default
-attributs.
 
 
Method resolution order:
-
DefaultNamespace
-
types.SimpleNamespace
-
builtins.object
-
-
-Methods defined here:
-
__getitem__(self, key: str)
Compatibility with dict.
- -
__init__(self, required: List[str] = [], optional: List[str] = [], default: dict = {}, types: dict = {})
Initialize self.  See help(type(self)) for accurate signature.
- -
build_type(self, attribut: str, value: Any, type_: type = None) -> None
This function builds type from configuration value.
- -
build_types(self) -> None
This function builds type from configuration values.
- -
check_required(self) -> None
This function checks required attributes
-if one of required attributes is missing this
-function raise MissingAttributesError.
- -
export_as_json(self, name: str = None) -> None
This function export namespace values (useful for debugging).
- -
get(self, key: str, default=None)
Compatibility with dict.
- -
get_dict(self) -> None
This function return a dict of attributes.
- -
get_missings(self) -> List[str]
This function checks required attributes
-and return a List[str] of missing required attributes.
- -
get_unexpecteds(self, log: bool = True) -> List[str]
This function return a List[str] of
-all attributes not in optional and
-required attributes.

-If log argument is True a Warning log message is
-write for all unexpected attributes.
- -
set_defaults(self) -> None
This function set defaults attribut with defaults values.
- -
update(self, **kwargs)
This function add/update attributes with **kwargs arguments.
- -
-Class methods defined here:
-
default_build(**kwargs) -> ~DefaultNamespace from builtins.type
Default build for DefaultNamespace (set defaults, add values,
-check requirements and unexpected values and build types).
- -
-Data descriptors defined here:
-
__weakref__
-
list of weak references to the object (if defined)
-
-
-Methods inherited from types.SimpleNamespace:
-
__delattr__(self, name, /)
Implement delattr(self, name).
- -
__eq__(self, value, /)
Return self==value.
- -
__ge__(self, value, /)
Return self>=value.
- -
__getattribute__(self, name, /)
Return getattr(self, name).
- -
__gt__(self, value, /)
Return self>value.
- -
__le__(self, value, /)
Return self<=value.
- -
__lt__(self, value, /)
Return self<value.
- -
__ne__(self, value, /)
Return self!=value.
- -
__reduce__(...)
Return state information for pickling
- -
__repr__(self, /)
Return repr(self).
- -
__setattr__(self, name, value, /)
Implement setattr(self, name, value).
- -
-Static methods inherited from types.SimpleNamespace:
-
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.
- -
-Data descriptors inherited from types.SimpleNamespace:
-
__dict__
-
-
-Data and other attributes inherited from types.SimpleNamespace:
-
__hash__ = None
- -

- - - - - - - -
 
-Logs = class _Logs(builtins.object)
   This class implements basic python logs.
 
 Methods defined here:
-
access(log: str) -> None
This function implements access logs for WebScripts.
- -
authentication(log: str) -> None
This function implements authentication logs for WebScripts.
- -
command(log: str) -> None
This function implements response logs for WebScripts.
- -
config(*args, **kwargs)
This function config ROOT logger.
- -
critical(log: str) -> None
This function implements basic python critical logs for WebScripts.
- -
debug(log: str) -> None
This function implements basic python debug logs for WebScripts.
- -
error(log: str) -> None
This function implements basic python error logs for WebScripts.
- -
exception(log: str) -> None
This function implements basic python exception (error) logs for
-WebScripts.
- -
info(log: str) -> None
This function implements basic python info logs for WebScripts.
- -
response(log: str) -> None
This function implements response logs for WebScripts.
- -
trace(log: str) -> None
This function implements trace logs for WebScripts.
- -
warning(log: str) -> None
This function implements basic python warning logs for WebScripts.
- -
-Data descriptors defined here:
-
__dict__
-
dictionary for instance variables (if defined)
-
-
__weakref__
-
list of weak references to the object (if defined)
-
-
-Data and other attributes defined here:
-
__annotations__ = {'console': <class 'logging.Logger'>, 'file': <class 'logging.Logger'>, 'log_access': <class 'logging.Logger'>, 'log_authentication': <class 'logging.Logger'>, 'log_command': <class 'logging.Logger'>, 'log_critical': <class 'logging.Logger'>, 'log_debug': <class 'logging.Logger'>, 'log_error': <class 'logging.Logger'>, 'log_info': <class 'logging.Logger'>, 'log_response': <class 'logging.Logger'>, ...}
- -
console = <Logger WebScripts.console (WARNING)>
- -
file = <Logger WebScripts.file (WARNING)>
- -
log_access = <Logger WebScripts.access (WARNING)>
- -
log_authentication = <Logger WebScripts.authentication (WARNING)>
- -
log_command = <Logger WebScripts.command (WARNING)>
- -
log_critical = <Logger WebScripts.critical (WARNING)>
- -
log_debug = <Logger WebScripts.debug (WARNING)>
- -
log_error = <Logger WebScripts.error (WARNING)>
- -
log_info = <Logger WebScripts.info (WARNING)>
- -
log_response = <Logger WebScripts.response (WARNING)>
- -
log_trace = <Logger WebScripts.trace (WARNING)>
- -
log_warning = <Logger WebScripts.warning (WARNING)>
- -

- - - - - -
 
-Functions
       
check_file_permission(configuration: utils.DefaultNamespace, filepath: str, recursive: bool = False, executable: bool = False, dir_check: bool = True) -> bool
This function checks files and directories permissions for security.
-
get_arguments_count(object_: collections.abc.Callable)
This function return the number of argument to call this Callable object.
-
get_encodings()
This function returns the probable encodings.
-
get_file_content(file_path, *args, as_iterator: bool = False, **kwargs) -> ~StrOrBytes
This function return the file content.
-
get_ini_dict(filename: str) -> Dict[str, Dict[str, str]]
This function return a dict from ini filename.
-
get_ip(environ: os._Environ, ip_number: int = None, protected: bool = True) -> str
This function return the real IP.
-
get_real_path(file_path: str, is_dir: bool = False, no_error: bool = False) -> str
This function return the real path for files.
-
log_trace(function: Union[function, method]) -> Union[function, method]
This decorator traces functions (start and end).
-
logger_access = access(log: str) -> None
This function implements access logs for WebScripts.
-
logger_auth = authentication(log: str) -> None
This function implements authentication logs for WebScripts.
-
logger_command = command(log: str) -> None
This function implements response logs for WebScripts.
-
logger_critical = critical(log: str) -> None
This function implements basic python critical logs for WebScripts.
-
logger_debug = debug(log: str) -> None
This function implements basic python debug logs for WebScripts.
-
logger_error = error(log: str) -> None
This function implements basic python error logs for WebScripts.
-
logger_info = info(log: str) -> None
This function implements basic python info logs for WebScripts.
-
logger_response = response(log: str) -> None
This function implements response logs for WebScripts.
-
logger_warning = warning(log: str) -> None
This function implements basic python warning logs for WebScripts.
-

- - - - - -
 
-Data
       __all__ = ['Logs', 'DefaultNamespace', 'log_trace', 'get_ip', 'get_arguments_count', 'get_file_content', 'get_real_path', 'get_encodings', 'get_ini_dict', 'server_path', 'CustomLogHandler', 'logger_debug', 'logger_info', 'logger_auth', 'logger_access', 'logger_response', 'logger_command', 'logger_warning', 'logger_error', 'logger_critical', ...]
-__annotations__ = {'date_format': <class 'str'>, 'logger_access': <class 'collections.abc.Callable'>, 'logger_auth': <class 'collections.abc.Callable'>, 'logger_command': <class 'collections.abc.Callable'>, 'logger_critical': <class 'collections.abc.Callable'>, 'logger_debug': <class 'collections.abc.Callable'>, 'logger_error': <class 'collections.abc.Callable'>, 'logger_info': <class 'collections.abc.Callable'>, 'logger_response': <class 'collections.abc.Callable'>, 'logger_trace': <class 'collections.abc.Callable'>, ...}
-__author_email__ = 'mauricelambert434@gmail.com'
-__copyright__ = '\nWebScripts Copyright (C) 2021, 2022, 2023 Mau...ome to redistribute it\nunder certain conditions.\n'
-__description__ = '\nThis tool run scripts and display the result in...cripts (Logs, Namespace for configuration, ...).\n'
-__license__ = 'GPL-3.0 License'
-__maintainer__ = 'Maurice Lambert'
-__maintainer_email__ = 'mauricelambert434@gmail.com'
-__url__ = 'https://github.com/mauricelambert/WebScripts'
-server_path = /home/WebScripts

- - - - - -
 
-Author
       Maurice Lambert
- \ No newline at end of file diff --git a/static/images/WebScripts1.png b/static/images/WebScripts1.png deleted file mode 100644 index d2fcf29c..00000000 Binary files a/static/images/WebScripts1.png and /dev/null differ diff --git a/static/images/WebScripts2.png b/static/images/WebScripts2.png deleted file mode 100644 index 6e274d19..00000000 Binary files a/static/images/WebScripts2.png and /dev/null differ diff --git a/static/images/WebScripts3.png b/static/images/WebScripts3.png deleted file mode 100644 index 7befd39d..00000000 Binary files a/static/images/WebScripts3.png and /dev/null differ diff --git a/static/images/WebScripts4.png b/static/images/WebScripts4.png deleted file mode 100644 index a8bd0507..00000000 Binary files a/static/images/WebScripts4.png and /dev/null differ diff --git a/static/images/WebScripts5.png b/static/images/WebScripts5.png deleted file mode 100644 index 2ac4297b..00000000 Binary files a/static/images/WebScripts5.png and /dev/null differ diff --git a/static/images/WebScripts6.png b/static/images/WebScripts6.png deleted file mode 100644 index d8f4fb45..00000000 Binary files a/static/images/WebScripts6.png and /dev/null differ diff --git a/static/images/WebScripts7.png b/static/images/WebScripts7.png deleted file mode 100644 index 99c66c78..00000000 Binary files a/static/images/WebScripts7.png and /dev/null differ diff --git a/static/images/webscripts_header.jpg b/static/images/webscripts_header.jpg deleted file mode 100644 index 8a5453f9..00000000 Binary files a/static/images/webscripts_header.jpg and /dev/null differ diff --git a/static/images/webscripts_header.png b/static/images/webscripts_header.png deleted file mode 100644 index 2ac4297b..00000000 Binary files a/static/images/webscripts_header.png and /dev/null differ diff --git a/static/images/webscripts_icon.jpg b/static/images/webscripts_icon.jpg deleted file mode 100644 index 8a5453f9..00000000 Binary files a/static/images/webscripts_icon.jpg and /dev/null differ diff --git a/static/images/webscripts_icon.png b/static/images/webscripts_icon.png deleted file mode 100644 index d8f4fb45..00000000 Binary files a/static/images/webscripts_icon.png and /dev/null differ diff --git a/static/js/webscripts_index_js_scripts.js b/static/js/webscripts_index_js_scripts.js deleted file mode 100644 index dd1477b0..00000000 --- a/static/js/webscripts_index_js_scripts.js +++ /dev/null @@ -1,21 +0,0 @@ -/* - - Scripts for index pages. - Copyright (C) 2021 Maurice Lambert - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -*/ - -is_index = true; diff --git a/static/js/webscripts_js_scripts.js b/static/js/webscripts_js_scripts.js deleted file mode 100644 index 11da5de4..00000000 --- a/static/js/webscripts_js_scripts.js +++ /dev/null @@ -1,583 +0,0 @@ -/* - - Basic web scripts for WebScript pages. - Copyright (C) 2021, 2022 Maurice Lambert - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -*/ - -let scripts; -let subpath = "../"; -let is_index = false; -let url = new URL(window.location); -let dark_theme = window.matchMedia("(prefers-color-scheme: dark)").matches; - -/* -This class implements a script object. -*/ -class Script { - constructor(script) { - let name = this.name = script.name; - this.name_lower = name.toLowerCase(); - - let category = this.category = script.category; - this.category_lower = category.toLowerCase(); - - let description = this.description = script.description; - this.description_lower = description.toLowerCase(); - - this.arguments = script.args; - - this.scripts[name] = this; - } - - /* - This function builds the script "cards" for the index page and the - search bar results. - */ - build_card(attribut, ...classes) { - let doc_createElement = document.createElement.bind(document); - let link_script_card = this[attribut] = doc_createElement("a"); - let div_script_card = doc_createElement("div"); - let classList = div_script_card.classList; - let div_class_list_add = classList.add.bind(classList); - let append_child = div_script_card.appendChild.bind( - div_script_card); - let name = this.name; - - if (name === "/auth/") { - link_script_card.href = subpath + "web/auth/"; - } else { - link_script_card.href = subpath + "web/scripts/" + name; - } - - link_script_card.style.textDecoration = 'none'; - - for (let class_ of classes) { - div_class_list_add(class_); - } - - let title = doc_createElement("h4"); - title.innerText = name + " (" + this.category + ")"; - - let description = doc_createElement("p"); - description.innerText = this.description; - description.classList.add("search_result_description"); - - append_child(title); - append_child(description); - link_script_card.appendChild(div_script_card); - } - - /* - This function implements the search method to research a script, - on a script page or/and the index page. - */ - search() { - let is_light = document.getElementsByClassName('light').length; - let getElementById = document.getElementById.bind(document); - - let path = url.pathname; - let path_split = path.split('/web/'); - let path_search = path_split.length === 2 && ! - path_split[1].includes("/") && path_split[1]; - let search_value = getElementById("webscripts_search_bar").value; - let pattern = search_value || path_search || ""; - pattern = pattern.toLowerCase(); - - let search_result_container = getElementById("search_result"); - let result_container_appendChild = search_result_container - .appendChild.bind(search_result_container); - - let container = getElementById("webscripts_content"); - let container_appendChild = container.appendChild.bind(container); - - let used_categories = new Set(); - let used_categories_add = used_categories.add.bind(used_categories); - let used_categories_has = used_categories.has.bind(used_categories); - let categories = Script.prototype.categories; - - if (is_index) { - container.innerHTML = ""; - } - - search_result_container.innerHTML = ""; - - if (search_value) { - search_result_container.style.display = 'initial'; - - } else { - search_result_container.style.display = 'none'; - } - - let no_result = true; - - for (let script of Object.values(Script.prototype.scripts)) { - let category_name = script.category; - if (script.name_lower.includes(pattern) || script.category_lower - .includes(pattern) || script.description_lower.includes( - pattern)) { - if (is_index && category_name) { - no_result = false; - let category = categories[category_name]; - category.appendChild(script.link_card); - - if (!used_categories_has(category_name)) { - used_categories_add(category_name); - container_appendChild(category); - } - } - - if (search_value) { - let button = script.search_button; - if ( - is_light && !button.classList.contains("light") || - !is_light && button.classList.contains("light") - ) { - let div = button.firstChild; - button.classList.toggle("light"); - div.classList.toggle("light"); - div.getElementsByClassName( - "search_result_description" - )[0].classList.toggle("light"); - } - result_container_appendChild(script.search_button); - } - } - } - - if (path_search && no_result) { - container.innerHTML = - "

There is no script matching " + - "your search.

"; - } - } - - /* - This function builds the script category if not exists. - */ - build_category() { - let category = this.category; - let categories = this.categories; - if (category && !categories.hasOwnProperty(category)) { - let doc_createElement = document.createElement.bind(document); - let div_category = categories[category] = doc_createElement( - "div"); - let dic_classList = div_category.classList; - let div_class_list_add = dic_classList.add.bind(dic_classList); - - div_class_list_add("category"); - // div_class_list_add("category_content"); - - let title = doc_createElement("h3"); - let title_classList = title.classList; - let title_class_list_add = title_classList.add.bind( - title_classList); - title_class_list_add("category"); - title_class_list_add("category_title"); - } - } - - /* - This function is a "constructor" to build all scripts. - */ - build_scripts(scripts) { - for (let script_basic of Object.values(scripts)) { - let script = new Script(script_basic); - script.build_category(); - script.build_card("link_card", "script_cards", - "category_content"); // "category" - script.build_card("search_button", "search_result"); - } - - Script.prototype.search(); - } -} - -Script.prototype.categories = {}; -Script.prototype.scripts = {}; - -function get_scripts(...functions) { - let xhttp = new XMLHttpRequest(); - xhttp.onreadystatechange = () => { - if (xhttp.readyState === 4 && xhttp.status === 200) { - scripts = JSON.parse(xhttp.responseText); - Script.prototype.build_scripts(scripts); - - for (let func of functions) { - if (func) { - func(); - } - } - } - }; - - xhttp.open("GET", subpath + "api/", true); - xhttp.send(); -} - -/* -This class implements theme functions. -*/ -class Theme { - - constructor() { - this.button = document.getElementById("webscripts_theme_button"); - } - - /* - This function gets elements from the web page and changes the theme of each. - */ - change_elements(class_name = 'light', element = null) { - let elements = null; - - if (element === null) { - let getElementsByTagName = document.getElementsByTagName.bind( - document); - let getElementByClass = document.getElementsByClassName.bind( - document); - let getElementById = document.getElementById.bind(document); - - elements = [ - getElementsByTagName('html')[0], - document.body, - getElementById("webscripts_content"), - getElementById("webscripts_menu"), - ...getElementByClass('border'), - ...getElementByClass('category'), - ...getElementByClass('search_result'), - ...getElementByClass('category_content'), - ...getElementByClass('webscripts_column_select'), - ...getElementByClass('search_result_description'), - ...getElementsByTagName('button'), - ...getElementsByTagName('input'), - ...getElementsByTagName('select'), - ...getElementsByTagName('a'), - ...getElementsByTagName('td'), - ...getElementsByTagName('option'), - ...getElementsByTagName('progress'), - ]; - - let bar = getElementById("bar"); - if (bar !== null) { - elements.push(bar); - } - } else { - let getElementsByTagName = element.getElementsByTagName.bind( - element); - - elements = [ - ...element.getElementsByClassName( - 'webscripts_column_select'), - ...element.getElementsByClassName('border'), - ...getElementsByTagName('button'), - ...getElementsByTagName('input'), - ...getElementsByTagName('select'), - ...getElementsByTagName('a'), - ...getElementsByTagName('td'), - ]; - } - - for (let temp_element of elements) { - temp_element.classList.toggle(class_name); - } - } - - /* - This function reverses the theme of the Web page. - */ - reverse() { - let theme = localStorage.getItem('theme'); - - if (theme === "light") { - dark_theme = true; - localStorage.setItem('theme', 'dark'); - this.button.innerText = "Light theme"; - } else if (theme === "dark") { - dark_theme = false; - localStorage.setItem('theme', 'light'); - this.button.innerText = "Dark theme"; - } - - Theme.prototype.change_elements(); - } - - /* - This function changes the theme when the page loads. - */ - load() { - if ((localStorage.getItem('theme') === null && dark_theme) || - localStorage.getItem('theme') === "dark") { - localStorage.setItem('theme', 'dark'); - } else if (localStorage.getItem('theme') === "light" || localStorage - .getItem('theme') === null) { - localStorage.setItem('theme', 'light'); - Theme.prototype.change_elements(); - this.button.innerText = "Dark theme"; - } else { - localStorage.setItem('theme', 'dark'); - } - } -} - -/* -This class builds the header sticker. -*/ -class HeaderSticker { - constructor() { - let canvas = this.canvas = document.createElement("canvas"); - canvas.id = "webscripts_header_canvas_image"; - - let height = this.height = document.getElementById( - 'webscripts_header_text_position').offsetHeight; - canvas.style.height = height + "px"; - - this.context = canvas.getContext("2d"); - - let image = this.image = new Image(); - image.onload = this.add.bind(this); - image.src = subpath + 'static/webscripts_icon.png'; - } - - /* - This method adds the sticker to the header of the web page. - */ - add() { - let context = this.context; - let image = this.image; - let height = this.height; - let divise = image.height / height; - let width = Math.round(image.width / divise); - let canvas = this.canvas; - - let start_x = Math.round((canvas.width - 200) / 2); - let start_y = Math.round((canvas.height - 160) / 2); - - context.drawImage(image, start_x, start_y, 200, 160); - let sticker = this.effect(20); - context.drawImage(sticker, start_x, start_y, 200, 160); - - let container = document.getElementById( - 'webscripts_header_canvas_container'); - container.style.height = height + "px"; - container.appendChild(this.canvas); - } - - /* - This method builds the sticker effect. - */ - effect(grow) { - let canvas1 = document.createElement("canvas"); - let context1 = canvas1.getContext("2d"); - let canvas2 = document.createElement("canvas"); - let context2 = canvas2.getContext("2d"); - let image = this.image; - - canvas1.width = canvas2.width = image.width + grow * 2; - canvas1.height = canvas2.height = image.height + grow * 2; - context1.drawImage(image, grow, grow); - context2.shadowColor = 'white'; - context2.shadowBlur = 2; - - for (let i = 0; i < grow; i++) { - context2.drawImage(canvas1, 0, 0); - context1.drawImage(canvas2, 0, 0); - } - - context2.shadowColor = 'rgba(0,0,0,0)'; - context2.drawImage(image, grow, grow); - - this.sticker = canvas2; - return canvas2; - } -} - -/* -This class implements the button menu actions. -*/ -class Menu { - - constructor() { - this.container = document.getElementById("webscripts_menu_values"); - } - - /* - This function cleans the console. - */ - clear() { - document.getElementById("script_outputs").innerText = ""; - download_text = ""; - } - - /* - This function go back ton index page. - */ - index() { - window.location = new URL(subpath + "web/", window.location); - } - - /* - This function downloads the console content. - */ - download() { - let body = document.body; - let download_link = document.createElement('a'); - let download_link_set = download_link.setAttribute.bind( - download_link); - - download_link_set('href', - `data:text/${download_type};charset=utf-8,` + - encodeURIComponent( - download_text)); - download_link_set('download', `result_${script_name}` + - download_extension); - - body.appendChild(download_link); - download_link.click(); - body.removeChild(download_link); - } - - /* - This function shows or hides the buttons. - */ - change_display() { - let display = this.container.style.display; - - if (!display || display == "none") { - this.container.style.display = "inline-block"; - } else { - this.container.style.display = "none"; - } - } - - /* - This function build an URL to relaunch this script execution. - */ - get_execution_url() { - let getElementsByTagName = document.getElementsByTagName.bind( - document); - let elements = Array.from(getElementsByTagName('input')).concat( - Array.from(getElementsByTagName('select'))); - - url.search = ""; - let append = url.searchParams.append.bind(url.searchParams) - - for (let element of elements) { - if (element.name && element.value && element.type !== - "password" && element.type !== "file" && element.type !== - "submit" && element.type !== "button" && element.name !== - "csrf_token") { - append(element.name, element.value); - } - } - - navigator.clipboard.writeText(url.href); - this.toast("Copied"); - } - - /* - This function copy the full output. - */ - copy_output() { - navigator.clipboard.writeText(download_text); - this.toast("Copied"); - } - - /* - This function creates a notify toast. - */ - toast(text) { - let toast = document.createElement('div'); - toast.classList.add("toast", "show"); - toast.innerText = text; - document.body.appendChild(toast); - setTimeout(() => { - document.body.removeChild(toast); - }, 3000) - } -} - -/* -This class implements notification system. -*/ -class Notification { - /* - This function closes a notification. - */ - close() { - this.style.display = "none"; - let notifications = JSON.parse(localStorage.getItem( - 'notifications_closed')); - - if (notifications) { - notifications.push(this.id); - } else { - notifications = [this.id]; - } - - localStorage.setItem('notifications_closed', JSON.stringify( - notifications)); - } -} - -/* -This function is performed when the Web page is loaded. -*/ -window.onload = (first, script_onload = null, ...functions) => { - let getById = document.getElementById.bind(document); - - let theme = new Theme(); - get_scripts(script_onload, theme.load.bind(theme)); - - let header_sticker = new HeaderSticker(); - - getById("webscripts_search_bar").onkeyup = Script.prototype.search; - - let menu = new Menu(); - getById("webscripts_menu_button_left").onclick = menu.change_display - .bind(menu); - getById("webscripts_theme_button").onclick = theme.reverse.bind(theme); - - for (let func of functions) { - func(); - } - - let notifications = new Set(JSON.parse(localStorage.getItem( - 'notifications_closed'))); - - if (notifications) { - for (let notification of notifications) { - let div = getById(notification); - - if (div) { - div.style.display = "none"; - } else { - notifications.delete(notification); - } - - } - } - - localStorage.setItem('notifications_closed', JSON.stringify([... - notifications - ])); - - notifications = document.getElementsByClassName('notification_close'); - - for (let notification of notifications) { - notification.onclick = Notification.prototype.close.bind( - notification.parentNode); - } -} \ No newline at end of file diff --git a/static/js/webscripts_script_js_scripts.js b/static/js/webscripts_script_js_scripts.js deleted file mode 100644 index 50a163d5..00000000 --- a/static/js/webscripts_script_js_scripts.js +++ /dev/null @@ -1,1500 +0,0 @@ -/* - - Scripts for script.html - Copyright (C) 2021, 2022, 2024 Maurice Lambert - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -*/ - -let script_name; -let script; -let download_extension = ".txt"; -let download_text = ""; -let download_type = "plain"; -let download_separator = "\n"; -let execution_number = 0; - -/* -This class implements an argument. -*/ -class Argument { - constructor(argument) { - let container = this.container = document.createElement("div"); - this.javascript_attributs = argument.javascript_attributs; - this.predefined_values = argument.predefined_values; - this.label = document.createElement("label"); - this.default_value = argument.default_value; - this.description = argument.description; - this.is_advanced = argument.is_advanced; - this.html_type = argument.html_type; - this.example = argument.example; - this.name = argument.name; - this.list = argument.list; - - container.classList.add("row"); - } - - /* - This method groups arguments elements. - */ - group_argument_elements(...dom_elements) { - let container = this.container; - let appendChild = container.appendChild.bind(container); - - for (let element of dom_elements) { - appendChild(element); - } - - return container; - } - - /* - This method adds the description if exists. - */ - add_description() { - let description = this.description; - - if (description === undefined && description === null) { - return; - } - - let paragraph = document.createElement("p"); - let classList = paragraph.classList; - let add = classList.add.bind(classList); - - add("inline"); - add("description"); - add("script_presentation"); - - paragraph.innerText = description; - - return paragraph; - } - - /* - This method adds the label (argument name). - */ - add_label() { - let name = this.name; - let label = this.label; - let classList = label.classList; - let add_class = classList.add.bind(classList); - - label.htmlFor = name; - label.innerText = name + " :"; - add_class("inline"); - add_class("script_presentation"); - - return label; - } - - /* - This method generates argument values - when this argument has predefined values. - */ - build_select() { - let select = this.dom_value = document.createElement("select"); - let default_value = this.default_value; - let name = this.name; - let option; - - let appendChild = select.appendChild.bind(select); - select.name = name; - select.id = name; - - if (this.list) { - select.multiple = true; - } - - if (default_value !== undefined && default_value !== null) { - select.value = default_value; - } - - for (let value of this.predefined_values) { - option = document.createElement("option"); - option.value = option.innerText = value; - - appendChild(option); - } - - return select; - } - - /* - This method builds the argument input. - */ - build_input() { - let input = this.dom_value = document.createElement("input"); - let default_value = this.default_value; - let example = this.example; - let name = this.name; - - input.id = name; - input.name = name; - input.type = this.html_type; - - input.value = default_value || ""; - input.placeholder = example || ""; - - if (this.list) { - input.id = name + document.getElementsByName(name).length; - input.onkeyup = this.onchange_input_list.bind(input); - } - - return input; - } - - /* - This method implements the onchange event to have multiple values for - an argument. - */ - onchange_input_list(event) { - let source = event.target || event.srcElement; - let name = source.name; - - let elements = document.getElementsByName(name); - let one_empty = false; - - for (let element of elements) { - if (element.value === "" && one_empty) { - element.remove() - } else if (element.value === "") { - one_empty = true; - } - } - - if (!one_empty) { - let id_num = elements.length; - let id = name + id_num; - let element = document.getElementById(id); - - while (element) { - id_num++; - id = name + id_num; - element = document.getElementById(id); - } - - let new_element = source.cloneNode(); - new_element.id = id; - source.parentNode.appendChild(new_element); - new_element.onkeyup = this.onkeyup.bind(new_element); - new_element.value = ""; - } - } -} - -/* -This class implements the script interface. -*/ -class ScriptInterface { - constructor(name) { - this.name = name; - this.script = Script.prototype.scripts[name]; - - let getElementById = document.getElementById.bind(document); - this.advanced_button = getElementById("print_advanced"); - this.description_container = getElementById("script_description"); - this.advanced_arguments_container = getElementById( - "advanced_container"); - let script_container = this.script_container = getElementById( - "script_interface"); - let advanced_arguments = this.advanced_arguments = getElementById( - "advanced_arguments"); - - this.advanced_arguments_add = advanced_arguments.appendChild.bind( - advanced_arguments); - this.insert_argument = script_container.insertBefore.bind( - script_container); - } - - /* - This method adds the script description on the web page. - */ - add_description() { - this.description_container.innerText = this.script.description; - } - - /* - This method sets HTML/CSS custom attributes. - */ - set_custom_attributes(dom_element, attributes) { - for (let [attribute, value] of Object.entries(attributes)) { - dom_element.setAttribute(attribute, value); - } - } - - /* - This method hides the advanced arguments container - or defined the button behavior. - */ - config_advanced_arguments() { - let advanced_arguments_container = this - .advanced_arguments_container; - if (!advanced_arguments_container.getElementsByClassName("row") - .length) { - advanced_arguments_container.style.display = "none"; - } else { - let arguments_ = this.advanced_arguments; - let button = this.advanced_button; - button.onclick = () => { - if (arguments_.style.display && - arguments_.style.display !== "none") { - arguments_.style.display = "none"; - button.innerText = "Show advanced arguments"; - } else { - arguments_.style.display = "block"; - button.innerText = "Hide advanced arguments"; - } - }; - } - } - - /* - This method sets values stocked in URL query string. - */ - set_url_values() { - let event; - let element, element_id; - let query = location.search; - let counters = {}; - - query = query.substr(1); - query.split("&").forEach(function(part) { - let item = part.split("="); - element_id = element = decodeURIComponent(item[0].replaceAll("+", - " ")); - counters[element] = counters[element] ? counters[element] : 0; - - if (element) { - element = document.getElementById(element) || document.getElementById(element + counters[element]); - counters[element_id] += 1; - - if (element) { - if (element.type === "checkbox" && item[1] === - "on") { - element.checked = true; - } else { - element.value = decodeURIComponent(item[1] - .replaceAll("+", " ")); - event = new Event('change'); - element.dispatchEvent(event); - } - - if (element.onkeyup) { - element.onkeyup({'target': element}) - } - } - } - }); - } - - /* - This method adds script arguments in web interface. - */ - add_arguments() { - for (let argument of this.script.arguments) { - let dom_argument; - argument = new Argument(argument); - let container = document.createElement("div"); - let classList = container.classList; - let addClass = classList.add.bind(classList); - - addClass("argument_container"); - addClass("inline"); - - dom_argument = (argument.predefined_values !== undefined && - argument.predefined_values !== null) ? argument - .build_select() : argument.build_input(); - - dom_argument.addEventListener('keypress', (event) => { - if (event.keyCode === 13) { - ScriptExecution.prototype.start(); - } - }); - - this.set_custom_attributes(dom_argument, argument - .javascript_attributs); - - container.appendChild(dom_argument); - - let label = argument.add_label(dom_argument); - let paragraph = argument.add_description(); - let elements_container = argument.group_argument_elements(label, - paragraph, container); - - argument.is_advanced ? this.advanced_arguments_add( - elements_container) : this.insert_argument( - elements_container, this.advanced_arguments_container); - } - } -} - -/* -Add a function to run when the Web page is loaded. -*/ -let onload2 = window.onload; -window.onload = (first, script_onload = null, ...functions) => { - onload2(window, script_onload = () => { - script = new ScriptInterface(script_name); - - script.add_description(); - script.add_arguments(); - - script.set_url_values(); - script.config_advanced_arguments(); - - document.getElementById("submit_button").onclick = - ScriptExecution.prototype.start; - - let menu = new Menu(); - let history = new History(); - document.getElementById("webscripts_copy_execution_button") - .onclick = menu.get_execution_url.bind(menu); - document.getElementById("webscripts_menu_button_right") - .onclick = history.change_display.bind(history); - document.getElementById("webscripts_copy_output_button") - .onclick = menu.copy_output.bind(menu); - document.getElementById("webscripts_download_button") - .onclick = menu.download.bind(menu); - document.getElementById("webscripts_index_button").onclick = - menu.index.bind(menu); - document.getElementById("webscripts_clear_button").onclick = - menu.clear.bind(menu); - }); -}; - -/* -This class implements object and methods to run scripts. -*/ -class ScriptExecution { - constructor() { - let getElementsByTagName = document.getElementsByTagName.bind( - document); - let getElementById = document.getElementById.bind(document); - this.dom_arguments = Array.from(getElementsByTagName('input')) - .concat( - Array.from(getElementsByTagName('select'))); - this.script_container = getElementById("script_interface"); - this.start_button = getElementById("submit_button"); - this.progressbar = getElementById("progressbar"); - this.error_container = getElementById("error"); - this.csrf = getElementById("csrf_token"); - this.progress_position = 0; - this.first_ouput = false; - this.is_running = false; - this.full_output = ""; - this.progress = true; - this.full_error = ""; - this.arguments = {}; - this.start = null; - this.time = null; - this.counter = 0; - this.end = null; - } - - /* - This method stringify the request body. - */ - send_json_request() { - this.send_requests({ - "csrf_token": this.csrf.value, - "arguments": this.arguments, - }); - } - - /* - This method gets a new DOM element and calls the - argument handler to get the value or prepares the - body and sends the request. - */ - get_argument_value() { - let argument = this.dom_arguments.pop(); - - if (argument) { - this.counter++; - this[`get_${argument.tagName}_value`](argument); - } else { - this.sort_arguments(); - this.send_json_request(); - this.start_button.disabled = true; - return; - } - } - - /* - Method handler for null arguments. - */ - get_NULL_value() {} - - /* - This method sorts arguments to send a valid request. - */ - sort_arguments() { - let sort = []; - - for (let [name, argument] of Object.entries(this.arguments)) { - sort.push([name, argument, argument["position"]]); - } - - sort.sort(function(a, b) { - return a[2] - b[2]; - }); - - let arguments_ = this.arguments = {}; - - for (let [name, argument, position] of sort) { - arguments_[name] = { - "value": argument["value"], - "input": argument["input"] - }; - } - } - - /* - This method is the onclick function for - start button (create a new instance - of ScriptExecution and use it). - */ - start(event) { - let script_exec = new ScriptExecution(); - script_exec.get_argument_value(); - } - - /* - This method animates the progress bar. - */ - progress_animation() { - let test, operation; - - if (progressbar.value >= 100) { - test = (value) => { - return value <= 0; - } - operation = (value) => { - return value - 1; - } - } else { - test = (value) => { - return value >= 100; - } - operation = (value) => { - return value + 1; - } - } - - if (this.progress) { - this.progress = false; - let interval = setInterval(() => { - let progressbar = this.progressbar; - if (test(progressbar.value)) { - clearInterval(interval); - this.progress = true; - - if (this.is_running) { - this.progress_animation(); - } - } else { - progressbar.value = operation(progressbar - .value); - } - }, 20); - } - } - - /* - This method gets input values. - */ - get_INPUT_value(input) { - if (input.type === "submit" || input.name === "csrf_token") { - this.get_argument_value(); - return; - } - - if (input.type === "checkbox") { - this.add_argument_value( - input.id, - input.name, - input.checked, - ); - } else if (input.type === "file") { - let reader = new FileReader(); - - reader.onload = (a) => { - this.add_argument_value( - input.id, - input.name, - window.btoa(a.target.result), - ); - }; - - if (input.files.length) { - reader.readAsBinaryString(input.files[0]); - } else { - this.get_argument_value(); - } - } else { - this.add_argument_value( - input.id, - input.name, - input.value, - ); - } - } - - /* - This method gets select values. - */ - get_SELECT_value(select) { - let dom_arguments = this.dom_arguments; - let selected = []; - let first = true; - - for (let option of select.options) { - if (option.selected) { - selected.push(option.value); - if (first) { - first = false; - } else { - dom_arguments.push({ - "tagName": "NULL" - }); - } - } - } - - if (selected.length) { - selected.forEach((item) => { - this.add_argument_value( - select.id, - select.name, - item, - ); - }); - } else { - this.add_argument_value( - select.id, - select.name, - "", - ); - } - - return dom_arguments; - } - - /* - This method adds an arguments value in the request data. - */ - add_argument_value(id, name, value) { - let arguments_ = this.arguments; - let argument = arguments_[name]; - - if (argument !== undefined) { - if (!Array.isArray(argument["value"])) { - argument["value"] = [argument["value"]]; - } - - if (value) { - argument["value"].push(value); - } - } else { - argument = arguments_[name] = { - "value": value, - "position": this.script_container.innerHTML.indexOf( - `id="${id}"`) - }; - - for (let argument_ of script.script.arguments) { - if (argument_.name !== name) { - continue; - } - - argument["input"] = (argument_.input === true) ? true : - false; - break; - } - } - - this.get_argument_value(); - } - - /* - This method returns 'light' when theme is light. - */ - get_theme() { - if (localStorage.getItem('theme') === "light" || window.matchMedia( - "(prefers-color-scheme: light)").matches) { - return 'light'; - } - } - - /* - This method redirects to referrer or to "/web/". - */ - redirect() { - let referrer = document.referrer; - window.location = (referrer && referrer.startsWith(window.location - .origin) && !referrer.endsWith("/web/auth/")) ? referrer : - window.location = new URL(subpath + "web/", window.location); - } - - /* - This method adds the error message when HTTP error is raised. - */ - http_error(status, message = null) { - this.error_container.innerText = "HTTP ERROR " + status; - - if (message) { - this.error_container.innerText += ": " + message - } - - this.error_container.innerText += ". \nYou can report a bug "; - - let class_link = this.get_theme(); - let link = document.createElement("a"); - - if (class_link) { - link.classList.add(class_link); - } - - link.href = subpath + "error_pages/Report/new/" + status; - link.innerText = "on the local report page"; - this.error_container.appendChild(link); - - this.script_end(); - } - - /* - This method sends the POST request to start script execution. - */ - send_requests(json, first = true) { - let xhttp; - this.xhttp = xhttp = new XMLHttpRequest(); - - xhttp.onreadystatechange = () => { - let status = xhttp.status; - - if (xhttp.readyState === 4) { - if (status === 200) { - this.response_manager(JSON.parse(xhttp - .responseText)); - } else if (status === 302 && script_name === "/auth/") { - this.redirect(); - } else if (status === 500) { - this.http_error( - status, - "\x49\x6e\x74\x65\x72\x6e\x61\x6c\x20" + - "\x53\x65\x72\x76\x65\x72\x20\x45\x72" + - "\x72\x6f\x72" - ); - } else if (status === 403) { - this.http_error(status, "Forbidden"); - } else { - this.http_error(status); - } - } - } - - let url = subpath + ( - script_name[0] === "/" ? script_name.slice(1) : "api/scripts/" + - script_name - ); - - xhttp.open("POST", url, true); - xhttp.setRequestHeader('Content-Type', 'application/json'); - xhttp.send(JSON.stringify(json)); - this.start = Date.now(); - - this.is_running = true; - this.progress_animation(); - } - - /* - This method requests the WebScripts server to - get a new line for "real time output". - */ - get_new_line(response) { - this.xhttp.open( - 'GET', subpath + `api/script/get/${response.key}`, true - ); - this.xhttp.send(); - } - - /* - This method resets the variables and calculates the time. - */ - script_end() { - let end = this.end = Date.now(); - this.start_button.disabled = false; - this.is_running = false; - this.full_output = ""; - this.full_error = ""; - - let diff_seconds = Math.round((end.valueOf() - this.start - .valueOf()) / - 1000); - let minutes = Math.round(diff_seconds / 60); - let seconds = diff_seconds - minutes * 60; - - if (minutes < 10) { - minutes = `0${minutes}`; - } - if (seconds < 10) { - seconds = `0${seconds}`; - } - - this.time = minutes + ":" + seconds; - this.first_ouput = true; - } - - /* - This method prints a new line and send - the new request to get a new line. - */ - real_time_handler(response) { - if (!response.code) { - response.code = "Running..."; - } - - if (!response.error) { - response.error = "Running..."; - } - - let output_builder = new OutputBuilder( - response, - false, - "Running...", - this.first_ouput, - false, - null, - null, - this.arguments, - ); - - if (output_builder.build()) { - this.first_ouput = false; - }; - this.get_new_line(response); - - return [response.stdout, response.stderr]; - } - - /* - This method detects the type of response and - uses the good behavior for this type of response. - */ - response_manager(response) { - let output, error; - - if (response.csrf) { - this.csrf.value = response.csrf; - } - - if (response.key) { - [output, error] = this.real_time_handler(response); - this.full_output += output; - this.full_error += error; - return; - } - - this.script_end(); - - let output_builder = new OutputBuilder( - response, - true, - this.time, - false, - true, - this.full_output, - this.full_error, - this.arguments, - ); - - output_builder.build(); - - document.getElementById('code').id = - `last_code_${execution_number}`; - document.getElementById('last_output').id = - `last_output_${execution_number}`; - document.getElementById('console').id = - `console_${execution_number}`; - } -} - -/* -This class implements functions to add a script execution in the web page. -*/ -class OutputBuilder { - constructor(output, add_history_ = true, time = null, make_new_output = - true, update = false, full_output = null, full_error = null, - user_inputs = {}) { - this.output = output; - this.add_history_ = add_history_; - this.time = time; - this.make_new_output = make_new_output; - this.update = update; - this.full_output = full_output; - this.full_error = full_error; - - this.console_div = document.getElementById("script_outputs"); - this.content_type = output["Content-Type"]; - this.stderr_content_type = "text/plain"; - this.text = ""; - this.html = ""; - this.code; - this.new_output; - - this.user_inputs = user_inputs; - - this.error_string = this.clean_string(output.stderr); - this.output_string = this.clean_string(output.stdout); - } - - /* - This function deletes whitespace characters on - the start and the end of the string. - */ - clean_string(string) { - return string.replace(/^\s+|\s+$/g, ''); - }; - - /* - This function creates the "code" element and - add the script execution status. - */ - code_builder(output, time) { - let code = document.createElement("code"); - code.id = "code"; - code.classList.add("code"); - - code.innerText = - `>>> ${script_name} ExitCode: ${output.code} ` + - `Error: ${output.error}`; - - if (time) { - code.innerText += ` ExecutionTime: ${time}`; - } - - return code; - } - - /* - This function creates containers - for text and HTML content. - */ - new(code) { - let new_output = document.createElement("div"); - let console_ = document.createElement("pre"); - - new_output.id = "last_output"; - - console_.id = "console"; - console_.classList.add("console"); - - console_.appendChild(code); - new_output.appendChild(console_); - - this.make_new_output = true; - - return new_output; - } - - /* - This function unescapes HTML special characters. - */ - unescape = str => str.replace(/</g, '<').replace(/>/g, '>') - .replace(/'/g, "'").replace(/"/g, '"').replace(/&/g, '&'); - - /* - This function escapes HTML special characters. - */ - escape = str => str.replace(/&/g, '&').replace(//g, '>').replace(/'/g, "'").replace(/"/g, '"'); - - /* - This function replaces CRLF by universal new line. - */ - universal_new_line = str => str.replace(/\r\n/g, "\n"); - - /* - This is the main function to put the script - content in the web interface. - */ - build() { - this.get_output_container(); - this.update_status(); - this.add_history(); - this.set_stderr_content_type(); - - if ((this.full_output + this.full_error + this.output_string + this - .error_string).length === 0 && this.add_history_) { - this.error_string = this.output.stderr = - "WebScripts warning: There is no output or " + - "error for this execution.\n"; - this.stderr_content_type = "text/plain"; - } - - this.add_stderr_content(); - this.build_content(); - this.add_content(); - this.add_to_download(); - this.theme(); - - return true; - } - - /* - This function builds a new container - or use the last builded container. - */ - get_output_container() { - if (this.make_new_output) { - this.code = this.code_builder(this.output, this.time); - this.new_output = this.new(this.code); - } else { - this.code = document.getElementById("code") || this - .code_builder(this.output, this.time); - this.new_output = document.getElementById("last_output") || this - .new(this.code); - } - } - - /* - This function updates the status at the - end of the script execution. - */ - update_status() { - if (this.update) { - this.code.innerText = this.code.innerText.replace('Running...', - this.output.code).replace('Running...', this.output - .error).replace('Running...', this.time); - } - } - - /* - This function adds a new script content in the history. - */ - add_history() { - if (this.add_history_) { - let history = new History(); - history.add(this); - } - } - - /* - This function sets the stderr - content type from the server response. - */ - set_stderr_content_type() { - if (this.output.hasOwnProperty("Stderr-Content-Type")) { - this.stderr_content_type = this.output["Stderr-Content-Type"]; - } - } - - /* - This function adds the stderr to the string content. - */ - add_stderr_content() { - if (this.error_string.length !== 0) { - if (this.stderr_content_type.includes("text/html")) { - this.html += this.anti_XSS(this.output.stderr); - } else if (this.stderr_content_type.includes("text/csv")) { - this.html += csv_to_html(this.output.stderr); - } else if (this.stderr_content_type.includes("text/json")) { - this.text += JSON.stringify(JSON.parse(this.output.stderr), - null, " "); - } else { - this.text += `\n${this.output.stderr}`; - } - } - } - - /* - This function sets the download parameters - and adds the stdout to the string content. - */ - build_content() { - let html_content = () => { - download_separator = "\n
\n"; - download_extension = ".html"; - download_type = "html"; - } - - let text_content = () => { - download_extension = ".txt"; - download_separator = "\n"; - download_type = "plain"; - } - - let add_text_output = (text) => { - this.text = this.make_new_output ? `\n${text}${this.text}` : - `${this.text}${text}`;; - } - - if (this.content_type.includes("text/html")) { - html_content(); - this.html = this.anti_XSS(this.output.stdout) + this.html; - } else if (this.content_type.includes("text/csv")) { - html_content(); - this.html = ParserCSV.prototype.csv_to_html(null, this.output - .stdout, '"', ',', '\r\n').outerHTML; - } else if (this.content_type.includes("text/json")) { - text_content(); - add_text_output(JSON.stringify(JSON.parse(this.output.stdout), - null, " ")); - } else { - text_content(); - add_text_output(this.output.stdout); - } - } - - /* - This function cleans and adds the string content to the container. - */ - add_content() { - this.code.innerText += this.universal_new_line(this.unescape(this - .text)); - this.new_output.innerHTML += this.html; - this.console_div.appendChild(this.new_output); - ShortTable.prototype.add_listeners(); - } - - /* - This function adds the string content to the download content. - */ - add_to_download() { - download_text += `${this.text}\n${this.html}${download_separator}`; - } - - /* - This function changes the color theme of the child elements of the - container. - */ - theme() { - if (localStorage.getItem('theme') === "light" || (localStorage - .getItem('theme') === null && !dark_theme)) { - Theme.prototype.change_elements('light', this.new_output); - } - /* else if (localStorage.getItem('theme') === null) { - change_theme( - class_name = 'default_theme', - element = this.new_output, - ); - }*/ - } - - /* - This function protects the browser against the XSS - vulnerabilities based on the user inputs only. - */ - anti_XSS(content) { - for (let value of Object.values(this.user_inputs)) { - value = value.value; - if (value.constructor.name !== "String" && value.constructor.name !== "Array") continue; - if (value.constructor.name !== "Array") value = [value]; - for (let v of value) { - let secure_value = this.escape(v); - if (v !== secure_value) { - content = content.replaceAll(v, secure_value); - } - } - } - - return content; - } -} - -/* -This function implements this history actions. -*/ -class History { - constructor() { - this.container = document.getElementById("webscripts_history"); - } - - /* - This function deletes the history content. - */ - clear() { - execution_number = 0; - this.container.innerText = ""; - } - - /* - This function display or hide history. - */ - change_display() { - let display = this.container.style.display; - - if (!display || display == "none") { - this.container.style.display = "inline-block"; - } else { - this.container.style.display = "none"; - - } - } - - /* - This function adds a script execution in history. - */ - add(output_builder) { - let button = document.createElement("button"); - - output_builder.add_history_ = false; - button.onclick = () => { - output_builder.get_output_container(); - output_builder.add_content(); - output_builder.add_to_download(); - output_builder.theme(); - } - - button.innerText = "Execution " + execution_number; - execution_number++; - this.container.appendChild(button); - - if (localStorage.getItem('theme') === "light") { - button.classList.toggle("light"); - } else if (localStorage.getItem('theme') === null) { - button.classList.toggle("default_theme"); - } - } -} - -/* -This class parses a CSV file. -*/ -class ParserCSV { - constructor(quote = '"', value_delimiter = ',', line_delimiter = "\n") { - let value_regex_string = - `(${quote}([^${quote}]|${quote}${quote})*${quote}|` + - `[^${quote}${value_delimiter}${line_delimiter}]*)`; - this.regex_line = new RegExp('((' + value_regex_string + - value_delimiter + ')*' + value_regex_string + '+|(' + - value_regex_string + value_delimiter + ')+' + - value_regex_string + ')', "gm"); - this.regex_value = new RegExp( - `((${quote}([^${quote}]|${quote}${quote})*${quote}|[^${quote}` + - `${value_delimiter}${line_delimiter}]+)|${value_delimiter})`, - "gm"); - } - - /* - This function parses CSV and build an HTML output. - */ - csv_to_html(headers, data, ...args) { - let csv_parser = new ParserCSV(...args); - let arrays = csv_parser.parse(data); - - headers = headers || arrays.shift(); - - let table = document.createElement("table"); - let thead = table.createTHead(); - let tbody = table.createTBody(); - - let line = document.createElement("tr"); - thead.appendChild(line); - - for (let header of headers) { - let column = document.createElement("th"); - line.appendChild(column); - column.innerText = header; - } - - for (let line_values of arrays) { - line = document.createElement("tr"); - tbody.appendChild(line); - for (let column_value of line_values) { - let column = document.createElement("td"); - line.appendChild(column); - column.innerText = column_value; - } - } - - return table; - } - - /* - This function parses a CSV file. - */ - parse(data) { - let lines = data.matchAll(this.regex_line); - - let arrays = []; - let array = []; - - for (let line of lines) { - let text_line = line[0]; - if (text_line) { - this.parse_line(text_line, array); - arrays.push(array); - array = []; - } - } - - if (array.length) { - arrays.push(array); - } - - return arrays; - } - - /* - This function parses a CSV line. - */ - parse_line(line, array) { - let values = line.matchAll(this.regex_value); - let not_empty = false; - - for (let value of values) { - let data = value[0]; - - if (data === ",") { - if (!not_empty) { - array.push(""); - } - not_empty = false; - continue; - } - - not_empty = true; - this.parse_value(data, array); - } - - if (!not_empty) { - array.push(""); - } - } - - /* - This function parses a CSV value. - */ - parse_value(data, array) { - if (data[0] === '"') { - array.push(data.substring(1, data.length - 1).replace('""', - '"')); - } else { - array.push(data); - } - } -} - -/* -This class adds an event listener on each -table header to shorts tables by values. -*/ -class ShortTable { - - /* - This function returns the column value. - */ - get_value(line, id) { - return line.children[id].innerText || line.children[id].textContent; - } - - /* - This function compares two values. - */ - compare(value1, value2) { - if (value1 !== '' && value2 !== '' && !isNaN(value1) && !isNaN( - value2)) { - return value1 - value2; - } else { - return value1.toString().localeCompare(value2) - } - } - - /* - This function generates the event listener callback. - */ - get_callback(id, ascendant) { - return function short_callback(line1, line2) { - if (!ascendant) { - let temp = line1; - line1 = line2; - line2 = temp; - } - - return ShortTable.prototype.compare(ShortTable.prototype - .get_value(line1, id), ShortTable.prototype - .get_value(line2, id)); - }; - } - - /* - This function shorts the table. - */ - event() { - let table = this.closest('table'); - let id = Array.from(this.parentNode.children).indexOf(this); - - Array.from(table.querySelectorAll('tbody > tr')) - .filter(tr => table == tr.closest('table')) - .sort(ShortTable.prototype.get_callback(id, window.ascendant = ! - window.ascendant)) - .forEach(line => line.parentNode.appendChild(line)); - } - - /* - This function adds listeners on each table headers. - */ - add_listeners() { - - Array.from(document.querySelectorAll('th')).forEach((header) => { - if (!header.have_short_event) { - header.addEventListener('click', ShortTable - .prototype.event.bind(header)); - header.innerText = "⋁ " + header.innerText; - header.have_short_event = true; - header.style.cursor = "pointer"; - setTimeout(() => { - let search = new TableSearch(header - .closest('table')) - }, 500); - } - }); - } -} - -/* -This class implements a tool to search lines in HTML table. -*/ -class TableSearch { - constructor(table) { - if (table.have_search) { - return; - } - - let is_light = document.getElementsByClassName('light').length; - - let input, parent; - this.table = table; - input = this.input = document.createElement('input'); - - parent = this.parent = table.parentNode; - input.type = "text"; - input.classList.add("webscripts_search_table"); - input.onchange = this.search.bind(this); - input.placeholder = "🔍 Search/Filter table values"; - table.have_search = true; - - this.selected_column = null; - parent.insertBefore(input, table); - - this.headers = table.getElementsByTagName('th'); - - if (is_light) input.classList.add('light'); - - this.add_selects(is_light); - } - - /* - This function adds a select box to headers to filter only on this column. - */ - add_selects(is_light) { - let counter = 0; - - for (let header of this.headers) { - let id = counter; - let select = document.createElement("span"); - select.innerText = "☐"; - select.classList.add("webscripts_column_select"); - if (is_light) select.classList.add('light'); - select.addEventListener('click', () => { - this.select_column(id); - }); - header.appendChild(select); - header.selected = false; - header.select = select; - - counter++; - } - } - - /* - This function unselects columns. - */ - unselect_column() { - this.selected_column = null; - - for (let header of this.headers) { - header.select.innerText = "☐"; - header.select.classList.remove("selected"); - header.select.classList.remove("unselected"); - } - - this.search(); - } - - /* - This function selects columns. - */ - select_column(id) { - if (this.selected_column !== null) { - this.unselect_column(); - return; - } - - this.selected_column = id; - let counter = 0; - - for (let header of this.headers) { - if (counter === id) { - header.select.innerText = "☑"; - header.select.classList.add("selected"); - } else { - header.select.innerText = "☒"; - header.select.classList.add("unselected"); - } - - counter++; - } - - this.search(); - } - - /* - This function searchs in table. - */ - search() { - let filter = this.input.value.toUpperCase(); - let lines = this.table.getElementsByTagName("tr"); - - for (let line of lines) { - let columns = line.getElementsByTagName("td"); - - if (!columns.length) { - continue; - } - - if (this.selected_column !== null) { - columns = [columns[this.selected_column]]; - } - - let is_matching = false; - for (let column of columns) { - let value = column.textContent || column.innerText; - - if (value.toUpperCase().indexOf(filter) > -1) { - is_matching = true; - } - } - - if (is_matching) { - line.style.display = ""; - } else { - line.style.display = "none"; - } - } - } -} diff --git a/static/pdf/WebScripts.pdf b/static/pdf/WebScripts.pdf deleted file mode 100644 index 001c1fbd..00000000 Binary files a/static/pdf/WebScripts.pdf and /dev/null differ diff --git a/static/templates/footer.html b/static/templates/footer.html deleted file mode 100644 index e6495379..00000000 --- a/static/templates/footer.html +++ /dev/null @@ -1,25 +0,0 @@ - \ No newline at end of file diff --git a/static/templates/header.html b/static/templates/header.html deleted file mode 100644 index e9f389e6..00000000 --- a/static/templates/header.html +++ /dev/null @@ -1,47 +0,0 @@ -
-
-

WebScripts Server

- -

This server can help administrators, SOC teams (Security Operations Center) and devops teams to deploy faster some scripts, to share some "console scripts" with people who have no particular computer knowledge and share environnements of scripts with their teams without install requirements on all computers of the team.

-
- -
-
- - -
- -
-
- - - - - - -
-
-
- - -
-
- -
-
\ No newline at end of file diff --git a/static/templates/index.html b/static/templates/index.html deleted file mode 100644 index e7cdefca..00000000 --- a/static/templates/index.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - Index of WebScripts Server - - - - - - - - - - - %(header)s - -
-
- - %(footer)s - - \ No newline at end of file diff --git a/static/templates/script.html b/static/templates/script.html deleted file mode 100644 index 71ecbc74..00000000 --- a/static/templates/script.html +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - %(name)s of WebScripts Server - - - - - - - - - - - %(header)s - -
-
-

Script: %(name)s

-

Documentation -
- -

Welcome on script "%(name)s" user "%(user)s" !

- -
-
-
-
- -
- -
-
- -
- -
- -
-
-
- - - -
- -
- -
-
- - %(footer)s - - - - \ No newline at end of file