Skip to content

Instantly share code, notes, and snippets.

@borisisok
borisisok / sshbuf_playground.c
Created November 1, 2018 16:43
Anatomy of sshbuf.c
/* sshbuf_playground.c
*
* All sshbuf code from openssh-portable for learning how sshbuf
* is used for storing ssh cert information during before signing it.
*
* Original Copyright Notice:
*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
* Copyright (c) 2008 Alexander von Gernler. All rights reserved.
* Copyright (c) 2010,2011 Damien Miller. All rights reserved.
@borisisok
borisisok / create_ssh_chroot_jail.sh
Last active September 19, 2018 06:29
LAB: create a chroot jail for ssh logins on Centos 7 using the sshd AuthorizedKeysCommand
#!/bin/bash
set -x
jailusr=$1
pfix=jail
jaildir=/home/${pfix}_${jailusr}
devdir=${jaildir}/dev
bindir=${jaildir}/bin
@borisisok
borisisok / googletron.py
Last active July 26, 2018 09:12
Google Translate and TTS fun
import random
import sys
from googletrans import Translator
import feedparser
import hashlib
from gtts import gTTS
from time import sleep
@borisisok
borisisok / aws-updown.sh
Last active December 17, 2021 07:52
LAB: VPN with BGP
#!/bin/bash
# debug: print all vars and function
env
set
# debug: print all commands during execution
set -x
TUNNEL_NAME="${PLUTO_CONNECTION}"
@borisisok
borisisok / coprocs.sh
Last active April 11, 2018 11:42
TIL: multiple bash coprocs with dynamic names
#!/usr/bin/bash
PID_MAIN=$$
# notify subshells on ctrl-c
trap "kill 0" SIGINT
function wrk() { while read data; do echo $1 _${data}_; done }
function shw() {
pid=$1
@borisisok
borisisok / coproc.sh
Last active April 9, 2018 13:07
TIL: bash subshell processing of data from stdin
#!/usr/bin/bash
PID_MAIN=$$
# notify subshell on ctrl-c
trap "kill 0" SIGINT
# spawn processing subshell via coproc
coproc WORK { while IFS= read x; do echo " processed: $x" ; done }
PID_WORKER=$!