diff --git a/community_scripts.json b/community_scripts.json index 0488a85a..5e292a42 100644 --- a/community_scripts.json +++ b/community_scripts.json @@ -1655,5 +1655,39 @@ "windows" ], "category": "TRMM (Win):Hardware" + }, + { + "guid": "52f6873c-ea02-4126-89c9-f6c1471cdf6d", + "filename": "all_network_online_check.py", + "submittedBy": "https://github.com/NiceGuyIT", + "name": "Network - Online check", + "description": "Check to be alerted when a PC comes online. Returns failure if the PC is online.", + "syntax": "[PING_HOSTNAME=]\n[PING_TIMEOUT=]\n[PING_STACKTRACE=]", + "args": [], + "default_timeout": "10", + "shell": "python", + "supported_platforms": [ + "windows", + "linux", + "darwin" + ], + "category": "TRMM (All):Network" + }, + { + "guid": "8a08cee9-bdc8-4d7a-8389-a201bb8ac7f1", + "filename": "all_python_module_manager.py", + "submittedBy": "https://github.com/NiceGuyIT", + "name": "Python - Module Manager", + "description": "List/Install/Remove/Update modules in the Python distribution", + "syntax": "help\ninfo [--verbose|--no-verbose]\nlist [--format=]\ninstall ...\nuninstall ...\nupgrade ...", + "args": [], + "default_timeout": "60", + "shell": "python", + "supported_platforms": [ + "windows", + "linux", + "darwin" + ], + "category": "TRMM (All):3rd Party Software" } ] diff --git a/scripts_wip/all_pc_online_check.py b/scripts/all_network_online_check.py similarity index 84% rename from scripts_wip/all_pc_online_check.py rename to scripts/all_network_online_check.py index 29cd93d3..5bab523c 100644 --- a/scripts_wip/all_pc_online_check.py +++ b/scripts/all_network_online_check.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -__version__ = "0.1.0" +__version__ = "0.1.1" __license__ = "MIT" __authors__ = "NiceGuyIT" @@ -12,6 +12,23 @@ - If the ping is successful, a return code of 1 used to indicate failure so an alert can be sent. - If the ping is not successful, a return code of 0 is used to indicate success and no alert is sent. +Command line arguments: + There are no command line arguments. All parameters are passed using environmental variables. + +Environmental variables: + - PING_HOSTNAME: Hostname or IP to ping. Default: localhost + The hostname or IP to ping. If not set, "localhost" is used. + + - PING_TIMEOUT: Timeout, in seconds. Default: 5 + The timeout in seconds for the ping arguments. The ping command has various timeouts in various arguments on + different systems. PING_TIMEOUT is used for those arguments. An additional timeout of PING_TIMEOUT + 1 is used + for Python to time out the exec. The idea is that the ping timeout arguments will cause the exec to return before + Pythong kills the program. + + - PING_STACKTRACE: Include the stack trace on error? + If true, the stacktrace is included in the output on failure. This may or may not be useful. + Note: In true Python sense, the value needs to be PascalCase: True + Possible enhancements: Use ping3[1] or tcping[2] which do not require exec'ing an external program. The down side is they require installing another module. diff --git a/scripts_wip/all_python_module_manager.py b/scripts/all_python_module_manager.py similarity index 92% rename from scripts_wip/all_python_module_manager.py rename to scripts/all_python_module_manager.py index 8b0ff429..5993d57d 100644 --- a/scripts_wip/all_python_module_manager.py +++ b/scripts/all_python_module_manager.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -__version__ = "0.1.0" +__version__ = "0.1.1" __license__ = "MIT" __authors__ = "NiceGuyIT, silversword411" @@ -12,7 +12,7 @@ **Use at your own risk.** Nothing stops you from breaking your Python install. -This script will install, uninstall, upgrade and list Python modules in the Python installation on the agent. The +This script will list, install, uninstall, and upgrade Python modules in the Python installation on the agent. The Python location and version is provided by the "info" command. The minimum version of Python supported is 3.8. Older versions are not supported and may generate an error. @@ -253,23 +253,28 @@ def main(): help_parser.set_defaults(func=lambda _: parser.print_help()) info_parser = subparsers.add_parser("info", help="Get the Python site (system) info") - info_parser.add_argument("--verbose", action="store_true") - info_parser.add_argument("--no-verbose", dest="verbose", action="store_false") + info_parser.add_argument("--verbose", action="store_true", + help="Output more information about the system installation") + info_parser.add_argument("--no-verbose", dest="verbose", action="store_false", + help="Output less information about the system installation (default)") info_parser.set_defaults(verbose=False) list_parser = subparsers.add_parser("list", help="List the installed modules") - list_parser.add_argument("--format", default="columns", choices=["columns", "freeze", "json"]) + list_parser.add_argument("--format", default="columns", choices=["columns", "freeze", "json"], + help="Same as python -m pip list --format option") install_parser = subparsers.add_parser("install", help="Install the specified modules") - install_parser.add_argument("modules", nargs="+") + install_parser.add_argument("modules", nargs="+", + help="A (space separated) list of modules to install") uninstall_parser = subparsers.add_parser("uninstall", help="Uninstall the specified modules") - uninstall_parser.add_argument("modules", nargs="+") + uninstall_parser.add_argument("modules", nargs="+", + help="A (space separated) list of modules to uninstall") upgrade_parser = subparsers.add_parser("upgrade", help="Upgrade all installed modules") - upgrade_parser.add_argument("modules", nargs="+") + upgrade_parser.add_argument("modules", nargs="+", + help="A (space separated) list of modules to upgrade") - # parser.add_argument_group("list", help="Command to run") args = parser.parse_args() # Change default log level to INFO