Skip to content

Instantly share code, notes, and snippets.

@Gram21
Last active November 6, 2023 17:00
Show Gist options
  • Select an option

  • Save Gram21/35dc66c4673bb63fa8c1 to your computer and use it in GitHub Desktop.

Select an option

Save Gram21/35dc66c4673bb63fa8c1 to your computer and use it in GitHub Desktop.
Standard .zshrc files
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="gnzh"
# Texteditor and zshconfig aliases
alias sublime="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"
alias s="sublime"
alias zshconfig="sublime ~/.zshrc"
# Set to this to use case-sensitive completion
# CASE_SENSITIVE="true"
# Comment this out to disable weekly auto-update checks
# DISABLE_AUTO_UPDATE="true"
# Uncomment following line if you want to disable colors in ls
# DISABLE_LS_COLORS="true"
# Uncomment following line if you want to disable autosetting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment following line if you want red dots to be displayed while waiting for completion
COMPLETION_WAITING_DOTS="true"
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(m git mercurial repo python cargo history-substring-search osx vagrant docker brew pip zsh-syntax-highlighting encode64 web-search colored-man-pages extract)
source $ZSH/oh-my-zsh.sh
# Customize to your needs...
# Path for custom binaries, scripts, etc.
export PATH=$PATH:$HOME/bin:/Users/JanKeim/.cargo/bin
export PATH="/usr/local/sbin:/Users/JanKeim/repos/go/bin:$PATH"
export GOPATH="/Users/JanKeim/repos/go/"
fpath+=~/.zfunc
# Set up rvm if installed
if [ -d $HOME/.rvm ]; then
export PATH=$PATH:$HOME/.rvm/bin
source $HOME/.rvm/scripts/rvm
fi
# Announce 256 bit color support
export TERM=xterm-256color
# Alias for quickly reaching my ctfbox
alias ctfbox='cd ~/vagrant/boxes/ctfbox'
alias ctfboxup='ctfbox; vagrant up; vagrant ssh'
# Good old netcat
# alias nc=ncat
# Mac list open ports
alias show_open_ports="sudo lsof -i -n -P"
alias open_ports="show_open_ports"
# Start Radare2 with -A flag.
alias r2='r2 -AA'
# Start ROPgadget automatically with a binary as first argument
alias ROPgadget='ROPgadget --binary'
# Alias for quick asking questions with the help of howdoi
alias how='howdoi '
# Less gdb output
alias gdb='gdb -q'
# burp
alias burp='open ~/vagrant/boxes/ctfbox/Burp/burpsuite_free_v1.6.32.jar'
# Launch sqlmap * Change directory if necessary *
alias sqlmap='python ~/rand/sqlmap-dev/sqlmap.py'
# Launch Linux_Exploit_Suggester * Change directory if necessary *
alias Linux_Exploit_Suggester='perl ~/rand/Linux_Exploit_Suggester/Linux_Exploit_Suggester.pl'
# Launch The Backdoor Factory * Change directory if necessary *
alias backdoor='~/rand/the-backdoor-factory/backdoor.py'
# Launch Metasploit and Armitage with root
alias msfconsole='sudo -E msfconsole'
alias armitage='sudo -E armitage'
# Update pip packages
alias pipupgrade="pip list --format=legacy --outdated | cut -d ' ' -f1 | xargs -n1 pip install -U"
alias pipupgrade_sudo="pip list --format=legacy --outdated | cut -d ' ' -f1 | xargs -n1 sudo pip install -U"
# Update osx software
alias updateosx="sudo softwareupdate -ia"
# osc show battery status
alias battery='pmset -g batt | egrep "([0-9]+\%).*" -o --colour=auto'
# Use C++11 standard by default
alias g++='g++ --std=c++11'
alias clang++='clang++ --std=c++11'
# starting "idiot" as daemon
alias idiot='idiot &'
# adb
#alias adb="~/Library/Android/sdk/platform-tools/adb"
#
# Highlights every occurande of the search pattern while displaying the whole content
#
# usage: cmd | highlight search_pattern
# highlight search_pattern file
highlight() {
grep -E "$|$1" --color $2
}
#
# Interface to the OS clipboard
#
# usage: clip # show clipboard content
# clip <file> # copy file content to clipboard
# cmd | clip # copy output of cmd to clipboard
clip() {
if [[ -t 0 && -z "$1" ]]; then
# output contents of clipboard
xclip -out -selection clipboard
elif [[ -n "$1" ]]; then
# copy file contents to clipboard
xclip -in -selection clipboard < "$1"
else
# read from stdin
xclip -in -selection clipboard
fi
}
#
# cat with syntax highlighting
#
# usage: scat file1 file2 ...
#
scat() {
for arg in "$@"; do
pygmentize -g "$arg" 2> /dev/null || cat "$arg"
done
}
#
# Create a new directory and cd into it
# Similar to "mkdir xxx && cd $_"
#
mkcd() {
if [ ! -n "$1" ]; then
echo "Enter a directory name"
elif [ -d $1 ]; then
echo "\`$1' already exists"
else
mkdir $1 && cd $1
fi
}
#
# Share files using transfer.io
#
# Uploads the provided file or data (if being piped to) to https://transfer.sh and puts the resulting URL into the OS clipboard.
#
# usage:
# transfer <file>
# some_command | transfer filename.txt
#
transfer() {
if [ $# -eq 0 ]; then
echo "No arguments specified. Usage:\ntransfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"
return 1
fi
file=$1
tmpfile=$(mktemp -t transferXXX)
basefile=$(basename "$file" | sed -e 's/[^a-zA-Z0-9._-]/-/g')
if [ -t 0 ]; then
# stdin is a terminal, so assume the user wants to upload a local file/directory (as opposed to piping the data to this function).
if [ ! -e $file ]; then
echo "File $file doesn't exists."
return 1
fi
if [ -d $file ]; then
# zip directory content and transfer.
zipfile=$(mktemp -t transferXXX.zip)
cd $(dirname $file) && zip -r -q - $(basename $file) >> $zipfile
curl --progress-bar --upload-file "$zipfile" "https://transfer.sh/$basefile.zip" >> $tmpfile
rm -f $zipfile
else
# transfer file.
curl --progress-bar --upload-file "$file" "https://transfer.sh/$basefile" >> $tmpfile
fi
else
# stdin is not a terminal. Presumably someone is piping something to us, so upload that.
curl --progress-bar --upload-file - "https://transfer.sh/$basefile" >> $tmpfile
fi
cat $tmpfile
# Put resulting URL (without trailing whitespace) into the OS clipboard (OS X only)
cat $tmpfile | tr -d '\n\r' | pbcopy
rm -f $tmpfile
}
test -e ${HOME}/.iterm2_shell_integration.zsh && source ${HOME}/.iterm2_shell_integration.zsh
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="gnzh"
# Set to this to use case-sensitive completion
# CASE_SENSITIVE="true"
# Comment this out to disable weekly auto-update checks
# DISABLE_AUTO_UPDATE="true"
# Uncomment following line if you want to disable colors in ls
# DISABLE_LS_COLORS="true"
# Uncomment following line if you want to disable autosetting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment following line if you want red dots to be displayed while waiting for completion
COMPLETION_WAITING_DOTS="true"
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git mercurial repo python cargo history-substring-search pip zsh-syntax-highlighting encode64 web-search colored-man-pages extract)
source $ZSH/oh-my-zsh.sh
# Customize to your needs...
# Path for custom binaries, scripts, etc.
export PATH=$PATH:$HOME/bin
# Set up rvm if installed
if [ -d $HOME/.rvm ]; then
export PATH=$PATH:$HOME/.rvm/bin
source $HOME/.rvm/scripts/rvm
fi
# Announce 256 bit color support
export TERM=xterm-256color
# Less gdb output
alias gdb='gdb -q'
# Update pip packages
alias pipupgrade="pip list --outdated | cut -d ' ' -f1 | xargs -n1 pip install -U"
alias pipupgrade_sudo="pip list --outdated | cut -d ' ' -f1 | xargs -n1 sudo pip install -U"
# Use C++11 standard by default
alias g++='g++ --std=c++11'
alias clang++='clang++ --std=c++11'
# Clear pacman cache: Only keep the latest version of every installed package in the cache
alias clearcache='sudo paccache -r -k 1; sudo paccache -r -u -k 0'
#
# Highlights every occurande of the search pattern while displaying the whole content
#
# usage: cmd | highlight search_pattern
# highlight search_pattern file
highlight() {
grep -E "$|$1" --color $2
}
#
# cat with syntax highlighting
#
# usage: scat file1 file2 ...
#
scat() {
for arg in "$@"; do
pygmentize -g "$arg" 2> /dev/null || cat "$arg"
done
}
#
# Create a new directory and cd into it
# Similar to "mkdir xxx && cd $_"
#
mkcd() {
if [ ! -n "$1" ]; then
echo "Enter a directory name"
elif [ -d $1 ]; then
echo "\`$1' already exists"
else
mkdir $1 && cd $1
fi
}
# ossec service
alias ossec="sudo /var/ossec/bin/ossec-control"
alias ossec_start="sudo /var/ossec/bin/ossec-control start"
alias ossec_stop="sudo /var/ossec/bin/ossec-control stop"
# tails on the alerts.log
alias alertlog="sudo tail -f /var/ossec/logs/alerts/alerts.log"
alias log_syscheck="sudo tail -f /var/ossec/logs/alerts/alerts.log"
alias syscheck_log="sudo tail -f /var/ossec/logs/alerts/alerts.log"
# gprof stuff
gprof_analysisd() {
if [ ! -n "$1" ]; then
echo "Provide a file where the output should be stored!"
else
sudo gprof /var/ossec/bin/ossec-analysisd >> $1
less $1
fi
}
# grep in files of specified folder
grepcontent() {
if [ ! -n "$1" ]; then
echo "Provide a folder!"
elif [ ! -d $1 ]; then
echo "Provided folder does not exist!"
elif [ ! -n "$2" ]; then
echo "Provide a pattern!"
else
grep -rnw $1 -e $2
fi
}
alias grepinfiles="grepcontent"
####
sudo apt-get install -y git zsh
chsh -s $(which zsh)
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
# Automatically load the linux .zshrc from above
curl https://gist.github.com/Gram21/35dc66c4673bb63fa8c1/raw/.zshrc_lin > ~/.zshrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment