Skip to content

Instantly share code, notes, and snippets.

View perfecto25's full-sized avatar

mrx perfecto25

  • NYC
View GitHub Profile
@perfecto25
perfecto25 / file_integrity.yaml
Created July 21, 2021 17:53
ElastAlert Rule Examples
# 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 19:04
Bash arg parser
get_params(){
PARAMS=""
while (( "$#" )); do
case "$1" in
## RESET - boolean
-r|--reset)
RESET=true
shift
@perfecto25
perfecto25 / deploy_config.sh
Last active April 23, 2021 03:45
Bash examples - shows use of key=val parameter passing, error checking, functions, etc
#!/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")
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 March 27, 2023 04:30
Win 10 decrap scripts

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 September 13, 2023 03:18
netcat Connectivity test script
#!/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
@perfecto25
perfecto25 / gpg.py
Created January 6, 2020 22:04
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)
[Unit]
Description=sshuttle service
After=network.target
[Service]
User=sshuttle
Restart=always
Type=forking
WorkingDirectory=/home/sshuttle
ExecStart=/home/sshuttle/sshuttle.sh start
@perfecto25
perfecto25 / README.md
Last active October 16, 2019 13:40
Libreswan IPSEC VPN

Libreswan config example (Centos 7)

using libreswan 3.25

connecting A to B using IKEv2, AES-256 encryption with Diffe Hellman 14 group

A and C are on same subnet, B is on a different subnet. B cannot talk directly to A or C.

A = 172.31.23.167
C = 172.31.23.197
B = 172.31.31.17
@perfecto25
perfecto25 / answers
Last active September 20, 2019 13:51
Thinlinc Server install on Centos 7 using Saltstack
install-pygtk=yes
[email protected]
install-python-ldap=yes
setup-firewall=yes
setup-selinux=yes
setup-web-integration=yes
setup-apparmor=yes
server-type=master
missing-answer=abort
install-nfs=yes