Last active
July 9, 2024 15:57
-
-
Save chapimenge3/0855f6e3539af5e098e99160a8069393 to your computer and use it in GitHub Desktop.
My custom bash script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function lower_case() { | |
echo $1 | tr '[:upper:]' '[:lower:]' | |
} | |
function upper_case() { | |
echo $1 | tr '[:lower:]' '[:upper:]' | |
} | |
function encrypt_text() { | |
if [ -z "$2" ]; then | |
echo "Usage: encrypt_text <text> <key>" | |
return 1 | |
fi | |
echo $1 | openssl enc -aes-256-cbc -a -salt -pbkdf2 -iter 100000 -k $2 | |
} | |
function decrypt_text() { | |
if [ -z "$2" ]; then | |
echo "Usage: decrypt_text <encrypted_text> <key>" | |
return 1 | |
fi | |
echo $1 | openssl enc -aes-256-cbc -d -a -salt -pbkdf2 -iter 100000 -k $2 | |
} | |
function encrypt_file() { | |
if [ -z "$2" ]; then | |
echo "Usage: encrypt_file <file> <key>" | |
return 1 | |
fi | |
openssl enc -aes-256-cbc -a -salt -pbkdf2 -iter 100000 -in $1 -out $1.enc -k $2 | |
} | |
function decrypt_file() { | |
if [ -z "$2" ]; then | |
echo "Usage: decrypt_file <encrypted_file> <key>" | |
return 1 | |
fi | |
openssl enc -aes-256-cbc -d -a -salt -pbkdf2 -iter 100000 -in $1 -out $1.dec -k $2 | |
} | |
function py-server() { | |
local dir $1 # default to current directory | |
local port $2 # default to 8000 | |
if [ -z "$1" ]; then | |
dir="." | |
port=8000 | |
else | |
dir=$1 | |
port=$2 | |
fi | |
python3 -m http.server $port -d $dir | |
} | |
function py-env() { | |
local pyver $1 # default to 3.10 | |
if [ -z "$1" ]; then | |
pyver=python3 | |
else | |
pyver=$1 | |
fi | |
virtualenv -p $pyver venv | |
source venv/bin/activate | |
} | |
function sub-find() { | |
subfinder -d $1 --silent | ~/go/bin/httpx -silent -status-code -title -tech-detect | |
} | |
function generate_password() { | |
local length=$1 | |
openssl rand -base64 $((length*3/4)) | head -c $length | tr -d /=+ | |
echo "" | |
} | |
alias myip='curl http://ipecho.net/plain; echo' | |
alias df-h='df -h' | |
alias dirsize='du -sh' | |
# Git shortcuts | |
alias gs='git status' | |
alias ga='git add' | |
alias gc='git commit' | |
alias gp='git push' | |
alias gl='git pull' | |
# Python shortcuts | |
alias py='python3' | |
alias py3='python3' | |
# AWS shortcuts | |
alias aws-s3-ls='aws s3 ls' | |
# pen test shortcuts | |
alias nmap='nmap -sS -sV -Pn' | |
# replace cat for bat | |
alias cat=bat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment