Skip to content

Instantly share code, notes, and snippets.

View perfecto25's full-sized avatar

mrx perfecto25

  • NYC
View GitHub Profile
@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-address=admin@company.com
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
#!py
import yaml
import salt
import logging
log = logging.getLogger(__name__)
def configure_user(host_users, all_users, config, host):
''' configure a User - add Group, Home Dir, SSH keys, etc '''
---
pvespa:
uid: 5037
fullname: Princess Vespa
groups: ['users']
ssh_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDWuwV75hyhECKpIXeu2w7hb6FpfiP2Nwap46i6ohPPj9Uqx6efCUE0xTS/7AtIYRaCL97k9mUEGvqsx6ZoLfa/QzV8LcxtVmvYa9IMyVKddiSEys7Ngh5hS+J5ZHJegQC4fD6DdUG+6XYT7Vfh6XblSQ8Tjg25nuvDrv/ObwYS8vgef9EnO3nooqiVYq0PuLb+ZLM15TE1bXVBh5P5lhr8aJDpsjBuB0FFGjCFN7fPSTmw8/oyp4lRPQ/vYNheyqBEZmyJceMT15SvVgyCLkTJCy2cpXxALjh56WCfKadx0JfwRwFUvERMQ+ZUKEMTqW3cAPkn6vX2xYMXa5WuN6G1mB vespa@imac
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABACCdTgFK5fB4mkuIRcLAGfPPn6WDWZBH3Ew8hCCL26KCkuiitjdZbLospuBk6BAAZfWCaGzZN04bveLP48cTd5JZ/PMcaPytJ23oEpvobl99tHG6L/Q/XQs6jDIB3ex0YByh70Cic7oBSMFaidDmm4VPl5DVKBeLrcuaIE1PgDvFlb/bk+sHCb+93CZDbOxU3WNKYubDKQEIOZcuYPsW1vyVSFnBb9O8F1x2g3YtOWxI42qq/4LbqiJbRwRlzrKAId73azgX/0o97CffKYr8DPBqykTA5FBABQSY376zcgkfQbJD8wnAxyssTPiOEiWRYJ8hDg3P5ZUUBfd0S5PnvE9z pvespa@mac2
lstar: