Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This file was made to clean up .CBBash
- # [Functions]
- # [ About ]
- function about()
- {
- clear
- echo -ne " [*] OrangeKush(OK) Bash Script v.1.0"
- echo -e ""
- echo -ne " [*] Author : Pwnsauce"
- echo -e ""
- echo -ne " [*] EMail : sys_admin@emailengine.org"
- echo -e ""
- echo -e ""
- }
- # [ Encryption/Decryption ]
- function encrypt()
- {
- gpg -ac -no-options "$1"
- }
- function decrypt()
- {
- gpg -no-options "$1"
- }
- # [ Extraction ]
- function extract()
- {
- if [ -f $1 ] ; then
- case $1 in
- *tar.bz2) tar xvjf $1 ;;
- *.tar.gz) tar xvzf $1 ;;
- *.bz2) bunzip2 $1 ;;
- *.rar) unrar x $1 ;;
- *.gz) gunzip $1 ;;
- *.tar) tar xvf $1 ;;
- *.tbz2) tar xvjf $1 ;;
- *.tgz) tar xvzf $1 ;;
- *.zip) unzip $1 ;;
- *.Z) uncompress $1 ;;
- *.7z) 7z x $1 ;;
- *) echo "'$1' cannot be extracted via >extract<" ;;
- esac
- else
- echo "'$1' is not a valid file!"
- fi
- }
- # Creates an archive (*.tar.gz) from given directory.
- function maketar() { tar cvzf "${1%%/}.tar.gz" "${1%%/}/"; }
- # Create a ZIP archive of a file or folder.
- function makezip() { zip -r "${1%%/}.zip" "$1" ; }
- # Make your directories and files access rights sane.
- function sanitize() { chmod -R u=rwX,g=rX,o= "$@" ;}
- function mydf() # Pretty-print of 'df' output.
- { # Inspired by 'dfc' utility.
- for fs ; do
- if [ ! -d $fs ]
- then
- echo -e $fs" :No such file or directory" ; continue
- fi
- local info=( $(command df -P $fs | awk 'END{ print $2,$3,$5 }') )
- local free=( $(command df -Pkh $fs | awk 'END{ print $4 }') )
- local nbstars=$(( 20 * ${info[1]} / ${info[0]} ))
- local out="["
- for ((j=0;j<20;j++)); do
- if [ ${j} -lt ${nbstars} ]; then
- out=$out"*"
- else
- out=$out"-"
- fi
- done
- out=${info[2]}" "$out"] ("$free" free on "$fs")"
- echo -e $out
- done
- }
- function my_ip() # Get IP adress on ethernet.
- {
- MY_IP=$(/sbin/ifconfig wlan0 | awk '/inet/ { print $2 } ' |
- sed -e s/addr://)
- echo ${MY_IP:-"Not connected"}
- }
- function ii() # Get current host related info.
- {
- echo -e "\nYou are logged on ${BRed}$HOST"
- echo -e "\n${BRed}Additionnal information:$NC " ; uname -a
- echo -e "\n${BRed}Users logged on:$NC " ; w -hs | cut -d " " -f1 | sort | uniq
- echo -e "\n${BRed}Current date :$NC " ; date
- echo -e "\n${BRed}Machine stats :$NC " ; uptime
- echo -e "\n${BRed}Memory stats :$NC " ; free
- echo -e "\n${BRed}Diskspace :$NC " ; mydf / $HOME
- echo -e "\n${BRed}Local IP Address :$NC" ; my_ip
- echo -e "\n${BRed}Open connections :$NC "; netstat -pan --inet;
- echo
- }
- export MARKPATH=$HOME/.marks
- function jump()
- {
- cd -P "$MARKPATH/$1" 2>/dev/null || echo "No such mark: $1"
- }
- function mark()
- {
- mkdir -p "$MARKPATH"; ln -s "$(pwd)" "$MARKPATH/$1"
- }
- function unmark()
- {
- rm -i "$MARKPATH/$1"
- }
- function marks()
- {
- ls -l "$MARKPATH" | sed 's/ / /g' | cut -d' ' -f9- | sed 's/ -/\t-/g' && echo
- }
- function completemarks()
- {
- local curw=${COMP_WORDS[COMP_CWORD]}
- local wordlist=$(find $MARKPATH -type l -printf "%f\n")
- COMPREPLY=($(compgen -W '${wordlist[@]}' -- "$curw"))
- return 0
- }
- complete -F _completemarks jump unmark
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement