#!/bin/bash
function print_centered {
     [[ $# == 0 ]] && return 1

     declare -i TERM_COLS="$(tput cols)"
     declare -i str_len="${#1}"
     [[ $str_len -ge $TERM_COLS ]] && {
          echo "$1";
          return 0;
     }

     declare -i filler_len="$(( (TERM_COLS - str_len) / 2 ))"
     [[ $# -ge 2 ]] && ch="${2:0:1}" || ch=" "
     filler=""
     for (( i = 0; i < filler_len; i++ )); do
          filler="${filler}${ch}"
     done

     printf "%s%s%s" "$filler" "$1" "$filler"
     [[ $(( (TERM_COLS - str_len) % 2 )) -ne 0 ]] && printf "%s" "${ch}"
     printf "\n"

     return 0
}

print_centered "$(tput setaf 1)"
print_centered ".________ ._______  .___.__  .______ "
print_centered ":____.   \: .___  \ :   |  \ :      \ "
print_centered " __|  :/ || :   |  ||   :   ||       |"
print_centered "|     :  ||     :  ||   .   ||   |   |"
print_centered " \__. __/  \_. ___/ |___|   ||___|   |"
print_centered "    :/       :/         |___|    |___|"
print_centered "    :        :                        "
print_centered "                 "
print_centered "$(tput setaf 7)"


sudo apt-get install libbz2-dev libpcap-dev -y
sudo apt-get -y install ocl-icd-opencl-dev opencl-headers pocl-opencl-icd
cd /home/wareck/
git clone https://github.com/openwall/john.git
cd /home/wareck/john/src
./configure
make -j4
