This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import smtplib | |
| from email.message import EmailMessage | |
| from pathlib import Path | |
| from os.path import basename | |
| from argparse import ArgumentParser | |
| REQUIRE_FROM_DOMAIN = '@test.com' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # discover all existing agent-jobs | |
| SELECT name, step_name, jobs.job_id FROM msdb.dbo.sysjobsteps job_steps INNER JOIN msdb.dbo.sysjobs jobs ON jobs.job_id = job_steps.job_id | |
| # get status for each job | |
| SELECT subsystem, database_name, command, last_run_outcome, last_run_duration, last_run_date, last_run_time FROM msdb.dbo.sysjobsteps WHERE step_name = '{#STEP_NAME}' AND job_id = '{#JOB_ID}' | |
| # check the status and trigger if not ok | |
| ## json query: $..last_run_outcome.first() | |
| ## error if last_run_outcome=0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| vms="$(qm list | sed 's|^\s*||g' | cut -d ' ' -f1 | tail -n +2)" | |
| for vm in $vms | |
| do | |
| echo "Shutdown vm $vm" | |
| qm shutdown "$vm" | |
| done | |
| cts="$(pct list | sed 's|^\s*||g' | cut -d ' ' -f1 | tail -n +2)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Task Scheduler | |
| # General | |
| # Use local service-user of SYSTEM | |
| # Enable 'Run whether user is logged in or not' | |
| # Enable 'Do not store password' | |
| # Enable 'Run with highest privileges' | |
| # | |
| # Action | |
| # Program: C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe | |
| # Arguments: -File C:\scripts\GracefulReboot.ps1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Task Scheduler | |
| # General | |
| # Select user SYSTEM (admin user will not work correctly) | |
| # Enable 'Run with highest privileges' | |
| # | |
| # Action | |
| # Program: C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe | |
| # Arguments: -File C:\scripts\RemoveUserFWRules.ps1 | |
| # NOTE: to get the rule-names you need to execute 'Get-NetFirewallRule' as SYSTEM-USER - some rules have other display-names in that context.. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Task Scheduler | |
| # General | |
| # Use local service-user of SYSTEM | |
| # Enable 'Run whether user is logged in or not' | |
| # Enable 'Do not store password' | |
| # Enable 'Run with highest privileges' | |
| # | |
| # Action | |
| # Program: C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe | |
| # Arguments: -File C:\scripts\rds\RemoveTmpProfiles.ps1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| if [ -z "$1" ] | |
| then | |
| echo 'Provide the target hostname!' | |
| exit 1 | |
| fi | |
| TARGET="$1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| if [ -z "$1" ] | |
| then | |
| echo 'Provide a hostname of a website to check!' | |
| exit 1 | |
| fi | |
| if [ -z "$2" ] | |
| then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| from sys import argv as sys_argv | |
| from socket import socket, AF_INET, AF_INET6, SOCK_STREAM | |
| if len(sys_argv) < 3: | |
| raise ValueError(""" | |
| You need to provide two arguments: | |
| 1 > Target IP | |
| 2 > Target port (only TCP) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # this can be useful in CI environments if you need to process config or secrets and pipe them to the parent process in a secure manner | |
| # example file: secrets.yml | |
| > my_secret1: !vault | | |
| > $ANSIBLE_VAULT;1.1;AES256 | |
| > ... | |
| > service_xyz: !vault | | |
| > $ANSIBLE_VAULT;1.1;AES256 | |
| > ... |