Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions community_scripts.json
Original file line number Diff line number Diff line change
Expand Up @@ -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=<string>]\n[PING_TIMEOUT=<number>]\n[PING_STACKTRACE=<boolean>]",
"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=<string>]\ninstall <string>...\nuninstall <string>...\nupgrade <string>...",
"args": [],
"default_timeout": "60",
"shell": "python",
"supported_platforms": [
"windows",
"linux",
"darwin"
],
"category": "TRMM (All):3rd Party Software"
}
]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

__version__ = "0.1.0"
__version__ = "0.1.1"
__license__ = "MIT"
__authors__ = "NiceGuyIT"

Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

__version__ = "0.1.0"
__version__ = "0.1.1"
__license__ = "MIT"
__authors__ = "NiceGuyIT, silversword411"

Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand Down