This commit is contained in:
SkyperTHC 2023-09-06 12:29:06 +01:00
parent 1baf8f7744
commit 54511d0cd4
No known key found for this signature in database
GPG Key ID: A9BD386DF9113CD6
8 changed files with 110 additions and 0 deletions

17
contrib/db-sync.sh Executable file

@ -0,0 +1,17 @@
#! /usr/bin/env bash
## In the format of:
# HOSTS+=("adm")
# HOSTS+=("lgm")
source .env_hosts || exit
for h in "${HOSTS[@]}"; do
echo "Syncing ${h} DOWN"
rsync -ral "${h}":/sf/config/db/banned "${h}":/sf/config/db/token "${h}":/sf/config/db/limits .
done
for h in "${HOSTS[@]}"; do
echo "Syncing ${h} UP"
rsync -ral banned token limits "${h}":'/sf/config/db'
done

BIN
guest/fs-root-amd64/usr/bin/xmap Executable file

Binary file not shown.

11
guest/fs-root/sf/bin/asn Executable file

@ -0,0 +1,11 @@
#! /usr/bin/env bash
{ [[ -n $SF_BINDIR ]] && source "${SF_BINDIR}/funcs.sh"; } || source "/sf/bin/funcs.sh"
# ASN lookup (Careful, using government's beloved team-cymru)
asn() {
[[ -n $1 ]] && { echo -e "begin\nverbose\n${1}\nend"|netcat whois.cymru.com 43| tail -n +2; return; }
(echo -e 'begin\nverbose';cat -;echo end)|netcat whois.cymru.com 43|tail -n +2
}
asn "$@"

14
guest/fs-root/sf/bin/gsexec Executable file

@ -0,0 +1,14 @@
#! /usr/bin/env bash
{ [[ -n $SF_BINDIR ]] && source "${SF_BINDIR}/funcs.sh"; } || source "/sf/bin/funcs.sh"
# cut & paste this into your shell on your workstation or add to ~/.bashrc
gsexec() {
local sec
sec="$1"
shift 1
echo "$*; exit; __START"|gs-netcat -s "$sec"|sed -n '/__START/,$p'|tail +2
}
[[ $# -ne 2 ]] && { echo -e >&2 "${CY}ERROR${CN}: gsexec SECRET 'command'"; exit 255; }
gsexec "$@"

15
guest/fs-root/sf/bin/gssec Executable file

@ -0,0 +1,15 @@
#! /usr/bin/env bash
{ [[ -n $SF_BINDIR ]] && source "${SF_BINDIR}/funcs.sh"; } || source "/sf/bin/funcs.sh"
gssec() {
[[ -z $GS_SEED ]] && { echo -e >&2 "${CY}ERROR${CN}: Please first set: ${CDC}GS_SEED=MySuperStrongMasterSeed${CN}"; return 255; }
str="$(echo "${GS_SEED:?}$1" | sha512sum | base64 | tr -d -c a-z0-9)"
str="${str:0:22}"
[[ ! -t 1 ]] && { echo "${str}"; return; }
echo -e "DEPLOY: ${CM}X=${str}"' bash -c "$(curl -fsSL https://gsocket.io/x)"'"${CN}"
echo -e "ACCESS: ${CM}S=${str}"' bash -c "$(curl -fsSL https://gsocket.io/x)"'"${CN}"
echo -e "ACCESS: ${CM}gs-netcat -s ${str} -i${CN}"
}
gssec "$@"

13
guest/fs-root/sf/bin/shred Executable file

@ -0,0 +1,13 @@
#! /usr/bin/env bash
{ [[ -n $SF_BINDIR ]] && source "${SF_BINDIR}/funcs.sh"; } || source "/sf/bin/funcs.sh"
## SHRED without shred command
shred()
{
[[ -z $1 || ! -f "$1" ]] && { echo >&2 "shred [FILE]"; return 255; }
dd bs=1k count=$(du -sk ${1:?} | cut -f1) if=/dev/urandom >"$1"
rm -f "${1:?}"
}
shred "$@"

19
guest/fs-root/sf/bin/sshj Executable file

@ -0,0 +1,19 @@
#! /usr/bin/env bash
{ [[ -n $SF_BINDIR ]] && source "${SF_BINDIR}/funcs.sh"; } || source "/sf/bin/funcs.sh"
# sshj # Generates a random tunnel ID [e.g. 5dmxf27tl4kx] and keeps the tunnel connected
# sshj foobarblahblub # Creates tunnel with specific tunnel ID
# sshj foobarblahblub 192.168.0.1 2222 # Tunnel to host 192.168.0.1:2222 on the LAN
sshj()
{
local pw
pw="${1,,}"
[[ -z $pw ]] && { pw=$(head -c64 </dev/urandom | base64 | tr -d -c a-z0-9); pw=${pw:0:12}; }
echo "Press Ctrl-C to stop this tunnel."
echo -e "To ssh to ${USER:-root}@${2:-127.0.0.1}:${3:-22} type: \e[0;36mssh -J ${pw}@ssh-j.com ${USER:-root}@${pw}\e[0m"
ssh -o StrictHostKeyChecking=accept-new -o ServerAliveInterval=30 -o ExitOnForwardFailure=yes ${pw}@ssh-j.com -N -R ${pw}:22:${2:-0}:${3:-22}
}
sshj "$@"

21
guest/fs-root/sf/bin/thcssh Executable file

@ -0,0 +1,21 @@
#! /usr/bin/env bash
{ [[ -n $SF_BINDIR ]] && source "${SF_BINDIR}/funcs.sh"; } || source "/sf/bin/funcs.sh"
### Cut & Paste the following to your shell, then execute
### thcssh user@server.org
thcssh()
{
local ttyp
echo -e "\e[0;35mTHC says: pimp up your prompt: Cut & Paste the following into your remote shell:\e[0;36m"
echo -e 'PS1="{THC} \[\\033[36m\]\\u\[\\033[m\]@\[\\033[32m\]\\h:\[\\033[33;1m\]\\w\[\\033[m\]\\$ "\e[0m'
ttyp=$(stty -g)
stty raw -echo opost
[[ $(ssh -V 2>&1) == OpenSSH_[67]* ]] && a="no"
ssh -o UpdateHostKeys=no -o StrictHostKeyChecking="${a:-accept-new}" -T \
"$@" \
"unset SSH_CLIENT SSH_CONNECTION; TERM=xterm-256color BASH_HISTORY=/dev/null exec -a [ntp] script -qc 'exec -a [uid] /bin/bash -i' /dev/null"
stty "${ttyp}"
}
thcssh "$@"