Skip to content

Instantly share code, notes, and snippets.

Avatar

mrx perfecto25

  • NYC
View GitHub Profile
@perfecto25
perfecto25 / conncheck.sh
Last active Nov 3, 2021
checks netcat and ssh connectivity to all hosts in /etc/hosts file, outputs Errors
View conncheck.sh
#!/bin/bash
# Run as root
# /home/sshuttle/conncheck.sh
## replace 'sshuttle' user with any user that has global SSH access to servers
file=${1:-"/etc/hosts"}
ncat_port=22
RED='\033[1;31m'
GREEN='\033[1;32m'
NC='\033[0m' # no color
@perfecto25
perfecto25 / pipeline
Created Oct 7, 2021
sample Jenkins pipeline with slack notifications (slack plugin)
View pipeline
pipeline {
agent any
stages {
stage("Deploy Config"){
steps {
slackSend color: "#15FFE9", message: """Jenkins is deploying Config to:
@perfecto25
perfecto25 / file_integrity.yaml
Created Jul 21, 2021
ElastAlert Rule Examples
View file_integrity.yaml
# alerts if system file is changed or modified
name: File Integrity Changed
# Alert on x events in y seconds
type: frequency
# Alert when this many documents matching the query occur within a timeframe
num_events: 1
@perfecto25
perfecto25 / parser.sh
Last active May 20, 2021
Bash arg parser
View parser.sh
get_params(){
PARAMS=""
while (( "$#" )); do
case "$1" in
## RESET - boolean
-r|--reset)
RESET=true
shift
@perfecto25
perfecto25 / deploy_config.sh
Last active Apr 23, 2021
Bash examples - shows use of key=val parameter passing, error checking, functions, etc
View deploy_config.sh
#!/bin/bash
#set -x
# source common function and variables
source "$(readlink -f $0 | xargs dirname)/shared"
REPO_DIR="${HOME}/NewDeploy/Repositories/Config_$(date +%Y%m%d%H%M%S)"
# check if another instance of this deployment is in progress
check_another_instance $(basename -- "$0")
View init.sls
sshuttle:
pkg.installed: []
group.present:
- gid: 2024
user.present:
- fullname: sshuttle
- uid: 2024
- gid: 2024
- allow_uid_change: True
@perfecto25
perfecto25 / README.md
Last active Apr 10, 2021
Win 10 decrap scripts
View README.md

make sure to set execution policy

C:> powershell.exe -ExecutionPolicy Unrestricted -File c:\Win_10_decrap.ps1

C:> powershell.exe -ExecutionPolicy Unrestricted -File c:\remove_default_apps.ps1

@perfecto25
perfecto25 / netcat.sh
Last active Jan 13, 2020
netcat Connectivity test script
View netcat.sh
#!/bin/bash
### This script reads in a file in /etc/hosts format <ip> <hostname>, then attempts to netcat to the host using provided port
### if no port is provided, it will attempt to connect via port 22
### if no file is provided, it will use /etc/hosts to read in IPs
### Usage: ./netcat.sh <port> <file>
### Example: ./netcat.sh <- this will try scanning /etc/hosts and connect to each IP via port 22
### Example: ./netcat.sh 21500 /home/user/testfile
View gpg.py
#!/usr/bin/env python
import gnupg
from pprint import pprint
gpg_home = '/home/user/.gnupg'
def show_keys():
gpg = gnupg.GPG(gnupghome=gpg_home)
public_keys = gpg.list_keys()
private_keys = gpg.list_keys(True)
@perfecto25
perfecto25 / bootstrap_xubuntu.sh
Last active Jun 2, 2022
Xubuntu 22.04 LTS Bootstrap
View bootstrap_xubuntu.sh
#!/bin/bash
## Bootstrap script for Xubuntu 22.04 (run as root)
cd /opt
### DECRAP
apt-get -y remove --purge libreoffice* thunderbird* rhythmbox*
apt-get clean
apt-get -y autoremove