Skip to content

eVAL-Agency/ScriptsCollection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scripts Collection

A collection of useful scripts for various Linux distributions

Scripts

Category / Script Supports
Python Asset Tracking / Collect Asset Inventory (SuiteCRM) [Linux] README archlinux centos debian fedora linuxmint redhat rocky suse ubuntu
PowerShell Asset Tracking / Collect Asset Inventory (SuiteCRM) [Windows] README windows
Bash/Shell Disks / Check Disk Health [Linux] archlinux centos debian fedora linuxmint redhat rocky ubuntu
PowerShell Disks / Check Disk Health [Windows] windows
Python Disks / Check Disk Space [Linux] archlinux centos debian fedora linuxmint redhat rocky suse ubuntu
PowerShell Disks / Check Disk Space [Windows] windows
Bash/Shell Game Server / Install ARK Survival Ascended Dedicated Server README debian ubuntu
Bash/Shell Game Server / Install Palworld debian ubuntu
Bash/Shell Game Server / Install Project Zomboid debian ubuntu
PowerShell Licensing / Get Windows License Information windows
Bash/Shell Memory / Check Memory Usage [Linux] archlinux centos debian fedora linuxmint redhat rocky suse ubuntu
PowerShell Memory / Check Memory Usage [Windows] windows
Bash/Shell Monitoring / Install Zabbix Agent2 [Linux] centos debian redhat rocky ubuntu
Bash/Shell Monitoring / Install Zabbix Proxy [Linux] centos debian redhat rocky ubuntu
Bash/Shell Network Utility / Install net-diag utilities [Linux] archlinux centos debian fedora linuxmint redhat rocky suse ubuntu
PowerShell Security / Check Defender Status [Windows] windows
Bash/Shell Security / Check Firewall Status [Linux] archlinux centos debian fedora linuxmint redhat rocky suse ubuntu
PowerShell Security / Check Firewall Status [Windows] windows
Bash/Shell Security / Install Firewall (UFW) [Linux] archlinux centos debian fedora linuxmint redhat rocky suse ubuntu
Bash/Shell Updates / Check if Reboot Required [Linux] archlinux centos debian fedora linuxmint redhat rocky suse ubuntu
PowerShell Updates / Check if Reboot Required [Windows] windows
Python User Management / Authorize SSH key for a user archlinux centos debian fedora linuxmint redhat rocky suse ubuntu
Bash/Shell User Management / Firewall - Whitelist IP archlinux centos debian fedora linuxmint redhat rocky suse ubuntu

Compile all scripts

Will compile each script into a single distributable file with all dependencies included within.

python3 compile.py

Script Metadata

Most of the metadata is collected from the file header. To ensure rendering, please ensure all file headers start with # , and separating lines contain a #.

Header scanning will stop as soon as an empty line is encountered.

Example, this will not see the "Supports" section as a header field, and thus will not include it.

#!/bin/bash
#
# Some title

# Supports:
#    Debian 12

Correct form includes a '#' to ensure the entire block is seen as the file header.

#!/bin/bash
#
# Some title
#
# Supports:
#    Debian 12

Script Header

The first non-empty line retrieved from the script will be used as the title, (one line only).

Syntax

Lists how to run the application to the end user, and gets saved in the help icon in TRMM.

#/bin/bash
# ...
# Syntax:
#   --option1 - Short description of option 1
#   --option2=... - Short description of option 2
#!/usr/bin/env python3
"""
...
Syntax:
	--option1 - Short description of option 1
	--option2=... - Short description of option 2
"""

(BASH only) Optionally, you can include the destination variable name before each argument to allow for dynamic generation of the argument parsing via compile:argparse.

In this example, passing --noninteractive will set the variable NONINTERACTIVE to 1.

(The compiler will filter out the prefix)

#/bin/bash
# ...
# Syntax:
#   NONINTERACTIVE=--noninteractive - Run in non-interactive mode, (will not ask for prompts)
#   VERSION=--version=... - Version of Zabbix to install DEFAULT=7.0
#   ZABBIX_SERVER=--server=... - Hostname or IP of Zabbix server
#   ZABBIX_AGENT_HOSTNAME=--hostname=... - Hostname of local device for matching with a Zabbix host entry
# ...

# compile:argparse

Generates:

#/bin/bash
# ...
# Syntax:
#   --noninteractive - Run in non-interactive mode, (will not ask for prompts)
#   --version=... - Version of Zabbix to install DEFAULT=7.0
#   --server=... - Hostname or IP of Zabbix server
#   --hostname=... - Hostname of local device for matching with a Zabbix host entry
# ...

# Parse arguments
NONINTERACTIVE="0"
VERSION="7.0"
ZABBIX_SERVER=""
ZABBIX_AGENT_HOSTNAME=""
while [ "$#" -gt 0 ]; do
	case "$1" in
		--noninteractive) NONINTERACTIVE=1; shift 1;;
		--version=*) VERSION="${1#*=}"; shift 1;;
		--server=*) ZABBIX_SERVER="${1#*=}"; shift 1;;
		--hostname=*) ZABBIX_AGENT_HOSTNAME="${1#*=}"; shift 1;;
		-h|--help) usage;;
	esac
done
if [ -z "$SOURCE" ]; then
	usage
fi

TRMM Arguments

Lists the default arguments and their values to be used when running the script in TRMM.

DOES support TRMM variable replacement for site, client, and agent. To use these, wrap the variable in double curly braces, like so: {{client.zabbix_hostname}}

#/bin/bash
# ...
# TRMM Arguments:
#   --option1
#   --option2=something
#!/usr/bin/env python3
"""
...
Syntax:
	--option1 - Short description of option 1
	--option2=... - Short description of option 2
"""

TRMM Environment

Behaves the same as TRMM Arguments, but is used for environment variables.

#/bin/bash
# ...
# TRMM Environment:
#   VAR1=something
#   VAR2={{client.zabbix_hostname}}
#!/usr/bin/env python3
"""
...
TRMM Environment:
	VAR1=something
	VAR2={{client.zabbix_hostname}}
"""

Supports

Lists the OS support for the script.

#/bin/bash
# ...
# Supports:
#   Debian 12
#   Ubuntu 24.04
#!/usr/bin/env python3
"""
...
Supports:
	Debian 12
	Ubuntu 24.04
"""

Distros can be listed individually, or one of the group declarations for multiple distros.

  • Linux-All - All Linux-based distros (completely os-agnostic script)
  • Debian-All - Any Debian-based distro (Debian, Ubuntu, Mint, etc)
  • RHEL-All - Any Red Hat-based distro (RHEL, CentOS, Fedora, etc)
  • ArchLinux / arch
  • CentOS
  • Debian
  • Fedora
  • LinuxMint
  • RedHat / RHEL
  • Rocky / RockyLinux
  • SuSE / OpenSuSE
  • Ubuntu
  • Windows

Author Tag

#/bin/bash
# ...
# Author:
#   Some Name <[email protected]>

alternative syntax:

#/bin/bash
# ...
# @AUTHOR  Some Name <[email protected]>
#!/usr/bin/env python3
"""
...
@AUTHOR  Some Name <[email protected]>
"""

Category Tag

#/bin/bash
# ...
# Category:
#   Some Category

alternative syntax:

#/bin/bash
# ...
# @CATEGORY  Some Category
#!/usr/bin/env python3
"""
...
Category:
	Some Category
"""

TRMM Timeout Setting

#/bin/bash
# ...
# @TRMM-TIMEOUT  120
#!/usr/bin/env python3
"""
...
@TRMM-TIMEOUT  120
"""

Draft

Set to true to skip finalizing of the script. The script will still be generated to dist/, but will not be recorded in the README and TRMM metafile.

#/bin/bash
# ...
# Draft:
#   True
#!/usr/bin/env python3
"""
...
Draft:
	True
"""

Generative Code

The compiler can generate dynamic code based on script comments, notably for usage and arguments

Compile usage()

Will generate a "usage()" function with the description and syntax arguments.

# compile:usage

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published