diff --git a/HackTool2.sh b/HackTool2.sh deleted file mode 100755 index c357ec9..0000000 --- a/HackTool2.sh +++ /dev/null @@ -1,772 +0,0 @@ -#!/bin/bash -# -# HackTool2: A totally reworked command line utility which shows the user their system info. -# Built using Bash version 3.2.57(1)-release -# -# The MIT License (MIT) -# -# Copyright (c) 2019 Ryan Wong -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -LGREEN='\033[1;32m' -GREEN='\033[0;32m' -BLUE='\033[0;34m' -YELLOW='\033[0;33m' -CYAN='\033[0;36m' -RED='\033[0;31m' -NC='\033[0m' -LYELLOW='\033[1;33m' -bold=$(tput bold) -normal=$(tput sgr0) - -# All of the functions -refresh(){ - /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' - - printf "${GREEN}${bold}[INFO] ${NC}${normal}This script is running as root\n" - printf "${GREEN}${bold}[INFO] ${NC}${normal}Getting Model info\n" - if [[ "$(kextstat | grep -F -e "FakeSMC" -e "VirtualSMC")" != "" ]]; then - model="Hackintosh ($(sysctl -n hw.model))" - printf "${GREEN}${bold}[INFO] ${NC}${normal}System is a Hackintosh\n" - else - model="$(sysctl -n hw.model)" - printf "${GREEN}${bold}[INFO] ${NC}${normal}System is a real Mac\n" - fi - printf "${GREEN}${bold}[INFO] ${NC}${normal}Getting CPU info\n" - cpu=$(sysctl -n machdep.cpu.brand_string) - printf "${GREEN}${bold}[INFO] ${NC}${normal}Getting GPU info\n" - gpu="$(system_profiler SPDisplaysDataType |\ - awk -F': ' '/^\ *Chipset Model:/ {printf $2 ", "}')" - gpu="${gpu//\/ \$}" - gpu="${gpu%,*}" - printf "${GREEN}${bold}[INFO] ${NC}${normal}Getting RAM info\n" - ram="$(system_profiler SPHardwareDataType |\ - awk -F': ' '/^\ *Memory:/ {printf $2 ", "}')" - ram="${ram//\/ \$}" - ram="${ram%,*}" - printf "${GREEN}${bold}[INFO] ${NC}${normal}Getting Kernel info\n" - kernel=$(uname -r) - printf "${GREEN}${bold}[INFO] ${NC}${normal}Getting Battery info\n" - batt=$(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1) - if [ "$batt" -le "20" ]; then - low="Low Battery" - elif [ "$batt" -ge "100" ]; then - full="Fully Charged" - else - printf "" - fi - battcon=$(system_profiler SPPowerDataType | grep "Condition" | awk '{print $2}') - printf "${GREEN}${bold}[INFO] ${NC}${normal}Getting Disk info\n" - dtype="$(diskutil info / |\ - awk -F': ' '/^\ *Partition Type:/ {printf $2 ", "}')" - dtype="${dtype//\/ \$}" - dtype="${dtype%,*}" - nvme="$(system_profiler SPNVMeDataType |\ - awk -F': ' '/^\ *Model:/ {printf $2 ", "}')" - nvme="${nvme//\/ \$}" - nvme="${nvme%,*}" - sata="$(system_profiler SPSerialATADataType |\ - awk -F': ' '/^\ *Model:/ {printf $2 ", "}')" - sata="${sata//\/ \$}" - sata="${sata%,*}" - printf "${GREEN}${bold}[INFO] ${NC}${normal}Getting MacOS version\n" - OS=$(sw_vers -productVersion) - if [ $OS == "10.14.0" ] || [ $OS == "10.14.1" ] || [ $OS == "10.14.2" ] || [ $OS == "10.14.3" ] || [ $OS == "10.14.4" ]; then - name="(Mojave)" - else - name="" - fi - - /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' - - printf "${YELLOW}${bold}" - echo " v$version" - echo "" - echo " __ __ __ ______ __ " - echo " / / / /___ ______/ /_/_ __/___ ____ / / " - echo " / /_/ / __ \/ ___/ //_// / / __ \/ __ \/ / " - echo " / __ / /_/ / /__/ ,< / / / /_/ / /_/ / / " - echo " /_/ /_/\__,_/\___/_/|_|/_/ \____/\____/_/ " - echo "" - echo "" - printf "${NC}${normal}" - printf "${CYAN}${bold}CPU Info: ${NC}${normal}" - echo "$cpu" - printf "${CYAN}${bold}GPU Info: ${NC}${normal}" - echo "$gpu" - printf "${CYAN}${bold}RAM Info: ${NC}${normal}" - echo "$ram" - printf "${CYAN}${bold}Model Info: ${NC}${normal}" - echo "$model" - printf "${CYAN}${bold}Kernel Info: ${NC}${normal}" - echo "Darwin $kernel" - printf "${CYAN}${bold}MacOS Info: ${NC}${normal}" - echo "MacOS $OS $name" - printf "${CYAN}${bold}Disk Info: ${NC}${normal}" - printf "${LGREEN}${bold}NVME:${NC}${normal} $nvme\n" - printf " ${LGREEN}${bold}SATA:${NC}${normal} $sata\n" - echo "$dtype on / partition" - printf "${CYAN}${bold}Battery Info: ${NC}${normal}" - echo "Percentage: $batt%" - printf "${RED}${bold} $low ${NC}${normal}\n" - printf "${GREEN}${bold} $full ${NC}${normal}\n" - printf " Condition : $battcon\n" - echo "" - read -p "> " input2 -} - -help(){ - /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' - printf "${YELLOW}${bold}" - echo " v$version" - echo "" - echo " __ __ __ ______ __ " - echo " / / / /___ ______/ /_/_ __/___ ____ / / " - echo " / /_/ / __ \/ ___/ //_// / / __ \/ __ \/ / " - echo " / __ / /_/ / /__/ ,< / / / /_/ / /_/ / / " - echo " /_/ /_/\__,_/\___/_/|_|/_/ \____/\____/_/ " - echo "" - echo "" - printf "${NC}${normal}" - echo "" - echo " HackTool Usage" - echo " --------------" - echo " refresh | Refresh System Info" - echo " exit | Exit program" - echo " help | Help page (this page)" - echo " options | Options page" - echo " tweaks | Tweaks page" - echo " info | Info page" - echo "" - echo "" - echo "" - echo "press q to go back" - echo "" - read -p "> " input3 -} - -info(){ - /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' - printf "${YELLOW}${bold}" - echo " v$version" - echo "" - echo " __ __ __ ______ __ " - echo " / / / /___ ______/ /_/_ __/___ ____ / / " - echo " / /_/ / __ \/ ___/ //_// / / __ \/ __ \/ / " - echo " / __ / /_/ / /__/ ,< / / / /_/ / /_/ / / " - echo " /_/ /_/\__,_/\___/_/|_|/_/ \____/\____/_/ " - echo "" - echo "" - printf "${NC}${normal}" - echo " Information" - echo " -----------" - echo " HackTool is a command line utility" - echo " that shows system information," - echo " and has many options and tweaks" - echo " to make your macOS experience" - echo " even better." - echo "" - echo " Built in Bash 3.2" - echo "" - echo " Created by Ryan Wong" - echo "" - echo "press q to go back" - echo "" - read -p "> " input4 -} - -options(){ - /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' - printf "${YELLOW}${bold}" - echo " v$version" - echo "" - echo " __ __ __ ______ __ " - echo " / / / /___ ______/ /_/_ __/___ ____ / / " - echo " / /_/ / __ \/ ___/ //_// / / __ \/ __ \/ / " - echo " / __ / /_/ / /__/ ,< / / / /_/ / /_/ / / " - echo " /_/ /_/\__,_/\___/_/|_|/_/ \____/\____/_/ " - echo "" - echo "" - printf "${NC}${normal}" - echo "" - echo "" - echo " Options" - echo " -------" - echo " 1) Mount / Unmount EFI" - echo " 2) Enable / Disable Gatekeeper" - echo " 3) Disable Hibernation" - echo " 4) Force Reboot" - echo " 5) Force Shutdown" - echo "" - echo "" - echo "" - echo "press q to go back" - echo "" - read -p "> " input5 -} - -option1(){ - /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' - printf "${YELLOW}${bold}" - echo " v$version" - echo "" - echo " __ __ __ ______ __ " - echo " / / / /___ ______/ /_/_ __/___ ____ / / " - echo " / /_/ / __ \/ ___/ //_// / / __ \/ __ \/ / " - echo " / __ / /_/ / /__/ ,< / / / /_/ / /_/ / / " - echo " /_/ /_/\__,_/\___/_/|_|/_/ \____/\____/_/ " - echo "" - echo "" - printf "${NC}${normal}" - echo "" - echo "" - echo "" - echo " Mount / Unmount EFI" - echo " -------------------" - echo "" - echo " 1) Mount EFI" - echo " 2) Unmount EFI" - echo "" - echo "" - echo "" - echo "" - echo "press q to go back" - echo "" - read -p "> " inputo1 -} - -option1a(){ - /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' - printf "${YELLOW}${bold}" - echo " v$version" - echo "" - echo " __ __ __ ______ __ " - echo " / / / /___ ______/ /_/_ __/___ ____ / / " - echo " / /_/ / __ \/ ___/ //_// / / __ \/ __ \/ / " - echo " / __ / /_/ / /__/ ,< / / / /_/ / /_/ / / " - echo " /_/ /_/\__,_/\___/_/|_|/_/ \____/\____/_/ " - echo "" - echo "" - printf "${NC}${normal}" - echo " Mount EFI" - echo " ---------------------------------------" - diskutil list | grep EFI - echo " ---------------------------------------" - echo "" - echo " disk0s1 is from internal disk" - echo " disk1s1 is from external disk" - echo "" - echo " Type the disk identifier you want to mount." - echo "" - echo "" - echo "" - echo "press q to go back" - echo "" - read -p "> " inputo1a -} - -option1aa(){ - /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' - printf "${YELLOW}${bold}" - echo " v$version" - echo "" - echo " __ __ __ ______ __ " - echo " / / / /___ ______/ /_/_ __/___ ____ / / " - echo " / /_/ / __ \/ ___/ //_// / / __ \/ __ \/ / " - echo " / __ / /_/ / /__/ ,< / / / /_/ / /_/ / / " - echo " /_/ /_/\__,_/\___/_/|_|/_/ \____/\____/_/ " - echo "" - echo "" - printf "${NC}${normal}" - echo " Mounting EFI on disk0s1" - echo " -----------------------" - echo "" - echo "" - echo "" - mkdir "/Volumes/efi(internal)" - sudo mount -t msdos /dev/disk0s1 "/Volumes/efi(internal)" - open "/Volumes/efi(internal)" - echo "" - echo "" - echo "" - echo "" - echo "" - echo "" - echo "press q to go back" - echo "" - read -p "> " inputo1aa -} - -option1ab(){ - /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' - printf "${YELLOW}${bold}" - echo " v$version" - echo "" - echo " __ __ __ ______ __ " - echo " / / / /___ ______/ /_/_ __/___ ____ / / " - echo " / /_/ / __ \/ ___/ //_// / / __ \/ __ \/ / " - echo " / __ / /_/ / /__/ ,< / / / /_/ / /_/ / / " - echo " /_/ /_/\__,_/\___/_/|_|/_/ \____/\____/_/ " - echo "" - echo "" - printf "${NC}${normal}" - echo " Mounting EFI on disk1s1" - echo " -----------------------" - echo "" - echo "" - echo "" - mkdir "/Volumes/efi(internal)" - sudo mount -t msdos /dev/disk1s1 "/Volumes/efi(internal)" - open "/Volumes/efi(internal)" - echo "" - echo "" - echo "" - echo "" - echo "" - echo "" - echo "press q to go back" - echo "" - read -p "> " inputo1ab -} - -option1b(){ - /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' - printf "${YELLOW}${bold}" - echo " v$version" - echo "" - echo " __ __ __ ______ __ " - echo " / / / /___ ______/ /_/_ __/___ ____ / / " - echo " / /_/ / __ \/ ___/ //_// / / __ \/ __ \/ / " - echo " / __ / /_/ / /__/ ,< / / / /_/ / /_/ / / " - echo " /_/ /_/\__,_/\___/_/|_|/_/ \____/\____/_/ " - echo "" - echo "" - printf "${NC}${normal}" - echo " Unmount EFI" - echo " ---------------------------------------" - diskutil list | grep EFI - echo " ---------------------------------------" - echo "" - echo " disk0s1 is from internal disk" - echo " disk1s1 is from external disk" - echo "" - echo " Type the disk identifier you want to unmount." - echo "" - echo "" - echo "" - echo "press q to go back" - echo "" - read -p "> " inputo1b -} - -option1ba(){ - /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' - printf "${YELLOW}${bold}" - echo " v$version" - echo "" - echo " __ __ __ ______ __ " - echo " / / / /___ ______/ /_/_ __/___ ____ / / " - echo " / /_/ / __ \/ ___/ //_// / / __ \/ __ \/ / " - echo " / __ / /_/ / /__/ ,< / / / /_/ / /_/ / / " - echo " /_/ /_/\__,_/\___/_/|_|/_/ \____/\____/_/ " - echo "" - echo "" - printf "${NC}${normal}" - echo " Unmounting EFI on disk0s1" - echo " -----------------------" - echo "" - echo "" - echo "" - diskutil unmount /dev/disk0s1 - echo "" - echo "" - echo "" - echo "" - echo "" - echo "" - echo "press q to go back" - echo "" - read -p "> " inputo1ba -} - -option1bb(){ - /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' - printf "${YELLOW}${bold}" - echo " v$version" - echo "" - echo " __ __ __ ______ __ " - echo " / / / /___ ______/ /_/_ __/___ ____ / / " - echo " / /_/ / __ \/ ___/ //_// / / __ \/ __ \/ / " - echo " / __ / /_/ / /__/ ,< / / / /_/ / /_/ / / " - echo " /_/ /_/\__,_/\___/_/|_|/_/ \____/\____/_/ " - echo "" - echo "" - printf "${NC}${normal}" - echo " Unmounting EFI on disk1s1" - echo " -----------------------" - echo "" - echo "" - echo "" - diskutil unmount /dev/disk1s1 - echo "" - echo "" - echo "" - echo "" - echo "" - echo "" - echo "press q to go back" - echo "" - read -p "> " inputo1bb -} - -option2(){ - /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' - printf "${YELLOW}${bold}" - echo " v$version" - echo "" - echo " __ __ __ ______ __ " - echo " / / / /___ ______/ /_/_ __/___ ____ / / " - echo " / /_/ / __ \/ ___/ //_// / / __ \/ __ \/ / " - echo " / __ / /_/ / /__/ ,< / / / /_/ / /_/ / / " - echo " /_/ /_/\__,_/\___/_/|_|/_/ \____/\____/_/ " - echo "" - echo "" - printf "${NC}${normal}" - echo "" - echo "" - echo "" - echo " Enable / Disable GateKeeper" - echo " ---------------------------" - echo "" - echo " 1) Enable GateKeeper" - echo " 2) Disable GateKeeper" - echo "" - echo "" - echo "" - echo "" - echo "press q to go back" - echo "" - read -p "> " inputo2 -} - -option2a(){ - /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' - printf "${YELLOW}${bold}" - echo " v$version" - echo "" - echo " __ __ __ ______ __ " - echo " / / / /___ ______/ /_/_ __/___ ____ / / " - echo " / /_/ / __ \/ ___/ //_// / / __ \/ __ \/ / " - echo " / __ / /_/ / /__/ ,< / / / /_/ / /_/ / / " - echo " /_/ /_/\__,_/\___/_/|_|/_/ \____/\____/_/ " - echo "" - echo "" - printf "${NC}${normal}" - echo "" - echo "" - echo "" - echo " Enabling GateKeeper" - echo " -------------------" - echo "" - sudo spctl --master-enable - echo " GateKeeper enabled" - echo "" - echo "" - echo "" - echo "" - echo "" - echo "press q to go back" - echo "" - read -p "> " inputo2a -} - -option2b(){ - /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' - printf "${YELLOW}${bold}" - echo " v$version" - echo "" - echo " __ __ __ ______ __ " - echo " / / / /___ ______/ /_/_ __/___ ____ / / " - echo " / /_/ / __ \/ ___/ //_// / / __ \/ __ \/ / " - echo " / __ / /_/ / /__/ ,< / / / /_/ / /_/ / / " - echo " /_/ /_/\__,_/\___/_/|_|/_/ \____/\____/_/ " - echo "" - echo "" - printf "${NC}${normal}" - echo "" - echo "" - echo "" - echo " Disable GateKeeper" - echo " ------------------" - echo "" - sudo spctl --master-disable - echo " GateKeeper disabled" - echo "" - echo "" - echo "" - echo "" - echo "" - echo "press q to go back" - echo "" - read -p "> " inputo2b -} - - -option3(){ - echo "" -} - -option4(){ - echo "" -} - -option5(){ - echo "" -} - -# Checks if script is ran in root -if [[ $EUID -ne 0 ]]; then - printf "${RED}${bold}[ERROR] ${NC}${normal}This script must be run as root\n" - exit 1 -elif [[ $EUID -ne 1 ]]; then - echo "" -fi - -# Clears consoles -/usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' - -printf "${GREEN}${bold}[INFO] ${NC}${normal}This script is running as root\n" -printf "${GREEN}${bold}[INFO] ${NC}${normal}Getting Model info\n" -if [[ "$(kextstat | grep -F -e "FakeSMC" -e "VirtualSMC")" != "" ]]; then - model="Hackintosh ($(sysctl -n hw.model))" - printf "${GREEN}${bold}[INFO] ${NC}${normal}System is a Hackintosh\n" - else - model="$(sysctl -n hw.model)" - printf "${GREEN}${bold}[INFO] ${NC}${normal}System is a real Mac\n" - fi -printf "${GREEN}${bold}[INFO] ${NC}${normal}Getting CPU info\n" -cpu=$(sysctl -n machdep.cpu.brand_string) -printf "${GREEN}${bold}[INFO] ${NC}${normal}Getting GPU info\n" -gpu="$(system_profiler SPDisplaysDataType |\ - awk -F': ' '/^\ *Chipset Model:/ {printf $2 ", "}')" -gpu="${gpu//\/ \$}" -gpu="${gpu%,*}" -printf "${GREEN}${bold}[INFO] ${NC}${normal}Getting RAM info\n" -ram="$(system_profiler SPHardwareDataType |\ - awk -F': ' '/^\ *Memory:/ {printf $2 ", "}')" -ram="${ram//\/ \$}" -ram="${ram%,*}" -printf "${GREEN}${bold}[INFO] ${NC}${normal}Getting Kernel info\n" -kernel=$(uname -r) -printf "${GREEN}${bold}[INFO] ${NC}${normal}Getting Battery info\n" -batt=$(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1) -if [ "$batt" -le "20" ]; then - low="Low Battery" -elif [ "$batt" -ge "100" ]; then - full="Fully Charged" -else - printf "" -fi -battcon=$(system_profiler SPPowerDataType | grep "Condition" | awk '{print $2}') -printf "${GREEN}${bold}[INFO] ${NC}${normal}Getting Disk info\n" -dtype="$(diskutil info / |\ - awk -F': ' '/^\ *Partition Type:/ {printf $2 ", "}')" -dtype="${dtype//\/ \$}" -dtype="${dtype%,*}" -nvme="$(system_profiler SPNVMeDataType |\ - awk -F': ' '/^\ *Model:/ {printf $2 ", "}')" -nvme="${nvme//\/ \$}" -nvme="${nvme%,*}" -sata="$(system_profiler SPSerialATADataType |\ - awk -F': ' '/^\ *Model:/ {printf $2 ", "}')" -sata="${sata//\/ \$}" -sata="${sata%,*}" -printf "${GREEN}${bold}[INFO] ${NC}${normal}Getting MacOS version\n" -OS=$(sw_vers -productVersion) -if [ $OS == "10.14.0" ] || [ $OS == "10.14.1" ] || [ $OS == "10.14.2" ] || [ $OS == "10.14.3" ] || [ $OS == "10.14.4" ]; then - name="(Mojave)" -else - name="" -fi - -/usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' - -printf '\033[8;24;80t' - -version="2.0alpha" -printf "${YELLOW}${bold}" -echo " v$version" -echo "" -echo "" -echo "" -echo "" -echo "" -echo "" -echo " __ __ __ ______ __ " -echo " / / / /___ ______/ /_/_ __/___ ____ / / " -echo " / /_/ / __ \/ ___/ //_// / / __ \/ __ \/ / " -echo " / __ / /_/ / /__/ ,< / / / /_/ / /_/ / / " -echo " /_/ /_/\__,_/\___/_/|_|/_/ \____/\____/_/ " -echo "" -echo "" -echo " Ryan Wong 2019" -echo "" -echo "" -echo "" -echo "" -printf "${NC}${bold} 1) Start Q) Exit" -echo "" -echo "" -echo "" -echo "" -read -p "> " input - -if [ $input = 1 ]; then - /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' - printf "${YELLOW}${bold}" - echo " v$version" - echo "" - echo " __ __ __ ______ __ " - echo " / / / /___ ______/ /_/_ __/___ ____ / / " - echo " / /_/ / __ \/ ___/ //_// / / __ \/ __ \/ / " - echo " / __ / /_/ / /__/ ,< / / / /_/ / /_/ / / " - echo " /_/ /_/\__,_/\___/_/|_|/_/ \____/\____/_/ " - echo "" - echo "" - printf "${NC}${normal}" - printf "${CYAN}${bold}CPU Info: ${NC}${normal}" - echo "$cpu" - printf "${CYAN}${bold}GPU Info: ${NC}${normal}" - echo "$gpu" - printf "${CYAN}${bold}RAM Info: ${NC}${normal}" - echo "$ram" - printf "${CYAN}${bold}Model Info: ${NC}${normal}" - echo "$model" - printf "${CYAN}${bold}Kernel Info: ${NC}${normal}" - echo "Darwin $kernel" - printf "${CYAN}${bold}MacOS Info: ${NC}${normal}" - echo "MacOS $OS $name" - printf "${CYAN}${bold}Disk Info: ${NC}${normal}" - printf "${LGREEN}${bold}NVME:${NC}${normal} $nvme\n" - printf " ${LGREEN}${bold}SATA:${NC}${normal} $sata\n" - echo "$dtype on / partition" - printf "${CYAN}${bold}Battery Info: ${NC}${normal}" - echo "Percentage: $batt%" - printf "${RED}${bold} $low ${NC}${normal}\n" - printf "${GREEN}${bold} $full ${NC}${normal}\n" - printf " Condition : $battcon\n" - echo "" - read -p "> " input2 -fi - - if [ $input2 = "help" ]; then - help - - if [ $input3 = "q" ]; then - refresh - fi - fi - - if [ $input2 = "info" ]; then - info - - if [ $input4 = "q" ]; then - refresh - fi - fi - - if [ $input2 = "options" ]; then - options - - if [ $input5 = "q" ]; then - refresh - - elif [ $input5 = 1 ]; then - option1 - if [ $inputo1 = 1 ]; then - option1a - if [ $inputo1a = "disk0s1" ]; then - option1aa - if [ $inputo1aa = "q" ]; then - option1a - fi - elif [ $inputo1a = "disk1s1" ]; then - option1ab - if [ $inputo1ab = "q" ]; then - option1a - fi - elif [ $inputo1a = "q" ]; then - option1a - fi - elif [ $inputo1 = 2 ]; then - option1b - if [ $inputo1b = "disk0s1" ]; then - option1ba - if [ $inputo1ba = "q" ]; then - option1b - fi - elif [ $inputo1b = "disk1s1" ]; then - option1bb - if [ $inputo1bb = "q" ]; then - option1b - fi - elif [ $inputo1b = "q" ]; then - option1b - fi - elif [ $inputo1 = "q" ]; then - options - fi - - elif [ $input5 = 2 ]; then - option2 - - if [ $inputo2 = 1 ]; then - option2a - if [ $inputo2a = "q" ]; then - options - fi - elif [ $inputo2 = 2 ]; then - option2b - if [ $inputo2b = "q" ]; then - options - fi - elif [ $inputo2 = "q" ]; then - options - fi - - elif [ $input5 = 3 ]; then - option3 - elif [ $input5 = 4 ]; then - option4 - elif [ $input5 = 5 ]; then - option5 - fi - fi - - if [ $input2 = "tweaks" ]; then - tweaks - if [ $input6 = "q" ]; then - refresh - fi - fi - -if [ $input = "q" ] || [ $input = "Q" ]; then - exit 0 -fi diff --git a/Hakku2.sh b/Hakku2.sh new file mode 100755 index 0000000..88bc9ba --- /dev/null +++ b/Hakku2.sh @@ -0,0 +1,48 @@ +#!/bin/bash +# +# Hakku2: A totally reworked command line utility which shows the user +# their system info and a bunch of useful tools and tweaks. +# Built using Bash version 3.2.57(1)-release +# +# The MIT License (MIT) +# +# Copyright (c) 2019 Ryan Wong +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +LGREEN='\033[1;32m' +GREEN='\033[0;32m' +BLUE='\033[0;34m' +YELLOW='\033[0;33m' +CYAN='\033[0;36m' +RED='\033[0;31m' +NC='\033[0m' +LYELLOW='\033[1;33m' +bold=$(tput bold) +normal=$(tput sgr0) + +version="v2.0-alpha" +updating="Please check for updates." + +. ./functions.sh +# . ./tweaks_f.sh +. ./settings_f.sh +. ./update_f.sh +refresh +mainmenu diff --git a/functions.sh b/functions.sh new file mode 100755 index 0000000..99957d7 --- /dev/null +++ b/functions.sh @@ -0,0 +1,896 @@ +#!/bin/bash +# +# Hakku2 Functions: A totally reworked command line utility which shows the user +# their system info and a bunch of useful tools and tweaks. +# Built using Bash version 3.2.57(1)-release +# +# The MIT License (MIT) +# +# Copyright (c) 2019 Ryan Wong +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +# Refresh +refresh(){ + if [[ $EUID -ne 0 ]]; then + printf "${RED}${bold}[ERROR] ${NC}${normal}This script must be run as root\n" + exit 1 + elif [[ $EUID -ne 1 ]]; then + echo "" + fi + + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + + printf "${GREEN}${bold}[INFO] ${NC}${normal}Checking if script is running as root\n" + printf "${GREEN}${bold}[INFO] ${NC}${normal}This script is running as root\n" + printf "${GREEN}${bold}[INFO] ${NC}${normal}Checking system if it meets requirements\n" + + if + command -v brew > /dev/null ; then + printf "${GREEN}${bold}[INFO] ${NC}${normal}HomeBrew package is installed\n" + else + printf "${RED}${bold}[ERROR] ${NC}${normal}HomeBrew package is not installed\n" + exit 0 + fi + + if command -v jq > /dev/null ; then + printf "${GREEN}${bold}[INFO] ${NC}${normal}jq package is installed\n" + else + printf "${RED}${bold}[ERROR] ${NC}${normal}jq package is not installed\n" + echo "Install jq with 'brew install jq'" + exit 0 + fi + + if command -v wget > /dev/null ; then + printf "${GREEN}${bold}[INFO] ${NC}${normal}wget package is installed\n" + else + printf "${RED}${bold}[ERROR] ${NC}${normal}wget package is not installed\n" + echo "Install wget with 'brew install wget'" + exit 0 + fi + + if command -v curl > /dev/null ; then + printf "${GREEN}${bold}[INFO] ${NC}${normal}curl package is installed\n" + else + printf "${RED}${bold}[ERROR] ${NC}${normal}curl package is not installed\n" + echo "Curl should be installed with macOS" + exit 0 + fi + + printf "${GREEN}${bold}[INFO] ${NC}${normal}Getting Model info\n" + if [[ "$(kextstat | grep -F -e "FakeSMC" -e "VirtualSMC")" != "" ]]; then + model="Hackintosh ($(sysctl -n hw.model))" + printf "${GREEN}${bold}[INFO] ${NC}${normal}System is a Hackintosh\n" + else + model="$(sysctl -n hw.model)" + printf "${GREEN}${bold}[INFO] ${NC}${normal}System is a real Mac\n" + fi + printf "${GREEN}${bold}[INFO] ${NC}${normal}Getting CPU info\n" + cpu=$(sysctl -n machdep.cpu.brand_string) + printf "${GREEN}${bold}[INFO] ${NC}${normal}Getting GPU info\n" + gpu="$(system_profiler SPDisplaysDataType |\ + awk -F': ' '/^\ *Chipset Model:/ {printf $2 ", "}')" + gpu="${gpu//\/ \$}" + gpu="${gpu%,*}" + printf "${GREEN}${bold}[INFO] ${NC}${normal}Getting RAM info\n" + ram="$(system_profiler SPHardwareDataType |\ + awk -F': ' '/^\ *Memory:/ {printf $2 ", "}')" + ram="${ram//\/ \$}" + ram="${ram%,*}" + printf "${GREEN}${bold}[INFO] ${NC}${normal}Getting Kernel info\n" + kernel=$(uname -r) + printf "${GREEN}${bold}[INFO] ${NC}${normal}Getting Battery info\n" + batt=$(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1) + if [ "$batt" -le "20" ]; then + low="Low Battery" + elif [ "$batt" -ge "100" ]; then + full="Fully Charged" + else + printf "" + fi + battcon=$(system_profiler SPPowerDataType | grep "Condition" | awk '{print $2}') + printf "${GREEN}${bold}[INFO] ${NC}${normal}Getting Disk info\n" + dtype="$(diskutil info / |\ + awk -F': ' '/^\ *File System Personality:/ {printf $2 ", "}')" + dtype="${dtype//\/ \$}" + dtype="${dtype%,*}" + nvme="$(system_profiler SPNVMeDataType |\ + awk -F': ' '/^\ *Model:/ {printf $2 ", "}')" + nvme="${nvme//\/ \$}" + nvme="${nvme%,*}" + sata="$(system_profiler SPSerialATADataType |\ + awk -F': ' '/^\ *Model:/ {printf $2 ", "}')" + sata="${sata//\/ \$}" + sata="${sata%,*}" + printf "${GREEN}${bold}[INFO] ${NC}${normal}Getting MacOS version\n" + OS=$(sw_vers -productVersion) + if [ $OS == "10.14.0" ] || [ $OS == "10.14.1" ] || [ $OS == "10.14.2" ] || [ $OS == "10.14.3" ] || [ $OS == "10.14.4" ]; then + name="(Mojave)" + elif [ $OS == "10.13.0" ] || [ $OS == "10.13.1" ] || [ $OS == "10.13.2" ] || [ $OS == "10.13.3" ] || [ $OS == "10.13.4" ] || [ $OS == "10.13.5" ] || [ $OS == "10.13.6" ]; then + name="(High Sierra)" + elif [ $OS == "10.12.0" ] || [ $OS == "10.12.1" ] || [ $OS == "10.12.2" ] || [ $OS == "10.12.3" ] || [ $OS == "10.12.4" ] || [ $OS == "10.12.5" ] || [ $OS == "10.12.6" ]; then + name="(Sierra)" + else + name="" + fi + + check=0 + check1=0 + + printf "${GREEN}${bold}[INFO] ${NC}${normal}Checking for Settings Extension\n" + if [ -e settings_f.sh ]; then + printf "${GREEN}${bold}[INFO] ${NC}${normal}Found Settings Extension\n" + else + check=1 + printf "${RED}${bold}[ERROR] ${NC}${normal}Failed to find Settings Extension\n" + fi + + printf "${GREEN}${bold}[INFO] ${NC}${normal}Checking for Tweaks Extension\n" + if [ -e tweaks_f.sh ]; then + printf "${GREEN}${bold}[INFO] ${NC}${normal}Found Tweaks Extension\n" + else + check1=1 + printf "${RED}${bold}[ERROR] ${NC}${normal}Failed to find Tweaks Extension\n" + fi + + printf "${GREEN}${bold}[INFO] ${NC}${normal}Checking for Update Extension\n" + if [ -e update_f.sh ]; then + printf "${GREEN}${bold}[INFO] ${NC}${normal}Found Update Extension\n" + else + check1=1 + printf "${RED}${bold}[ERROR] ${NC}${normal}Failed to find Update Extension\n" + fi +} + +# mainmenu +mainmenu(){ + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + printf "${YELLOW}${bold}" + echo "? for help $version" + echo "" + echo "" + echo "" + echo "" + echo "" + echo "" + echo " ██╗ ██╗ █████╗ ██╗ ██╗██╗ ██╗██╗ ██╗"; + echo " ██║ ██║██╔══██╗██║ ██╔╝██║ ██╔╝██║ ██║"; + echo " ███████║███████║█████╔╝ █████╔╝ ██║ ██║"; + echo " ██╔══██║██╔══██║██╔═██╗ ██╔═██╗ ██║ ██║"; + echo " ██║ ██║██║ ██║██║ ██╗██║ ██╗╚██████╔╝"; + echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ "; + echo "" + echo " Ryan Wong 2019" + echo "" + echo "" + echo "" + echo "" + printf "${NC}${bold} 1) Start Q) Exit" + echo "" + echo "" + echo "" + echo "" + read -p "> " input + + if [ $input = 1 ]; then + systeminfo + elif [ $input = "Q" ] || [ $input = "q" ]; then + goodbye + elif [ $input = "?" ]; then + help + fi +} + +# systeminfo +systeminfo(){ + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + printf "${YELLOW}${bold}" + echo " $version" + echo "" + echo " ██╗ ██╗ █████╗ ██╗ ██╗██╗ ██╗██╗ ██╗"; + echo " ██║ ██║██╔══██╗██║ ██╔╝██║ ██╔╝██║ ██║"; + echo " ███████║███████║█████╔╝ █████╔╝ ██║ ██║"; + echo " ██╔══██║██╔══██║██╔═██╗ ██╔═██╗ ██║ ██║"; + echo " ██║ ██║██║ ██║██║ ██╗██║ ██╗╚██████╔╝"; + echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ "; + echo "" + printf "${NC}${normal}" + printf "${CYAN}${bold}CPU Info: ${NC}${normal}" + echo "$cpu" + printf "${CYAN}${bold}GPU Info: ${NC}${normal}" + echo "$gpu" + printf "${CYAN}${bold}RAM Info: ${NC}${normal}" + echo "$ram" + printf "${CYAN}${bold}Model Info: ${NC}${normal}" + echo "$model" + printf "${CYAN}${bold}Kernel Info: ${NC}${normal}" + echo "Darwin $kernel" + printf "${CYAN}${bold}MacOS Info: ${NC}${normal}" + echo "MacOS $OS $name" + printf "${CYAN}${bold}Disk Info: ${NC}${normal}" + printf "${LGREEN}${bold}NVME:${NC}${normal} $nvme\n" + printf " ${LGREEN}${bold}SATA:${NC}${normal} $sata\n" + echo "$dtype on / partition" + printf "${CYAN}${bold}Battery Info: ${NC}${normal}" + echo "Percentage: $batt%" + printf "${RED}${bold} $low ${NC}${normal}\n" + printf "${GREEN}${bold} $full ${NC}${normal}\n" + printf " Condition : $battcon\n" + echo "" + read -p "> " in2 + + if [ $in2 = "options" ]; then + options +elif [ $in2 = "?" ]; then + help + elif [ $in2 = "info" ]; then + info + elif [ $in2 = "tweaks" ]; then + . ./tweaks_f.sh + risk + elif [ $in2 = "exit" ]; then + goodbye + elif [ $in2 = "update" ]; then + . ./update_f.sh + update + elif [ $in2 = "refresh" ]; then + refresh + systeminfo + elif [ $in2 = "settings" ]; then + . ./settings_f.sh + settings + fi +} + +# exits program +goodbye(){ + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + printf "${YELLOW}${bold}" + echo " $version" + + echo "" + echo "" + echo "" + echo "" + echo "" + echo " ██╗ ██╗ █████╗ ██╗ ██╗██╗ ██╗██╗ ██╗"; + echo " ██║ ██║██╔══██╗██║ ██╔╝██║ ██╔╝██║ ██║"; + echo " ███████║███████║█████╔╝ █████╔╝ ██║ ██║"; + echo " ██╔══██║██╔══██║██╔═██╗ ██╔═██╗ ██║ ██║"; + echo " ██║ ██║██║ ██║██║ ██╗██║ ██╗╚██████╔╝"; + echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ "; + echo "" + echo "" + echo "" + echo "" + echo "" + echo "" + printf "${NC}${bold} Are you sure?\n" + echo " (Y/N) " + echo "" + echo "" + echo "" + read -p "> " in + + if [ $in = "y" ] || [ $in = "Y" ]; then + exit 0 + elif [ $in = "n" ] || [ $in = "N" ]; then + mainmenu + fi +} + +# help page +help(){ + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + printf "${YELLOW}${bold}" + echo " $version" + echo "" + echo " ██╗ ██╗ █████╗ ██╗ ██╗██╗ ██╗██╗ ██╗"; + echo " ██║ ██║██╔══██╗██║ ██╔╝██║ ██╔╝██║ ██║"; + echo " ███████║███████║█████╔╝ █████╔╝ ██║ ██║"; + echo " ██╔══██║██╔══██║██╔═██╗ ██╔═██╗ ██║ ██║"; + echo " ██║ ██║██║ ██║██║ ██╗██║ ██╗╚██████╔╝"; + echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ "; + echo "" + printf "${NC}${normal}" + echo "" + echo " Hakku Usage" + echo " -----------" + echo " refresh | Refresh System Info" + echo " exit | Exit Program" + echo " ? | Help Page (This Page)" + echo " options | Options Page" + echo " tweaks | Tweaks Page" + echo " info | Info Page" + echo " settings| Settings Page" + echo " update | Check and Update Hakku" + echo "" + echo "press q to go back" + echo "" + read -p "> " input3 + + if [ $input3 = "options" ]; then + options + elif [ $input3 = "?" ]; then + help + elif [ $input3 = "info" ]; then + info + elif [ $input3 = "tweaks" ]; then + . ./tweaks_f.sh + risk + elif [ $input3 = "exit" ]; then + goodbye + elif [ $input3 = "refresh" ]; then + refresh + systeminfo + elif [ $input3 = "settings" ]; then + . ./settings_f.sh + settings + elif [ $input3 = "update" ]; then + . ./update_f.sh + update + elif [ $input3 = "q" ]; then + mainmenu + fi +} + +# info page +info(){ + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + printf "${YELLOW}${bold}" + echo " $version" + echo "" + echo " ██╗ ██╗ █████╗ ██╗ ██╗██╗ ██╗██╗ ██╗"; + echo " ██║ ██║██╔══██╗██║ ██╔╝██║ ██╔╝██║ ██║"; + echo " ███████║███████║█████╔╝ █████╔╝ ██║ ██║"; + echo " ██╔══██║██╔══██║██╔═██╗ ██╔═██╗ ██║ ██║"; + echo " ██║ ██║██║ ██║██║ ██╗██║ ██╗╚██████╔╝"; + echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ "; + echo "" + printf "${NC}${normal}" + echo " Information" + echo " -----------" + echo " Hakku is a command line utility" + echo " that shows system information," + echo " and has many options and tweaks" + echo " to make your macOS experience" + echo " even better." + echo "" + echo " Built in Bash 3.2.57" + echo "" + echo " Created by Ryan Wong" + echo "" + echo "press q to go back" + echo "" + read -p "> " input4 + + if [ $input4 = "q" ]; then + mainmenu + fi +} + +# options +options(){ + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + printf "${YELLOW}${bold}" + echo " $version" + echo "" + echo " ██╗ ██╗ █████╗ ██╗ ██╗██╗ ██╗██╗ ██╗"; + echo " ██║ ██║██╔══██╗██║ ██╔╝██║ ██╔╝██║ ██║"; + echo " ███████║███████║█████╔╝ █████╔╝ ██║ ██║"; + echo " ██╔══██║██╔══██║██╔═██╗ ██╔═██╗ ██║ ██║"; + echo " ██║ ██║██║ ██║██║ ██╗██║ ██╗╚██████╔╝"; + echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ "; + echo "" + printf "${NC}${normal}" + echo "" + echo "" + echo " Options" + echo " -------" + echo " 1) Mount / Unmount EFI" + echo " 2) Enable / Disable Gatekeeper" + echo " 3) Disable Hibernation" + echo " 4) Force Reboot" + echo " 5) Force Shutdown" + echo " 6) Delete iMessage related files/folders" + echo "" + echo "" + echo "press q to go back" + echo "" + read -p "> " input5 + + if [ $input5 = "q" ]; then + mainmenu + elif [ $input5 = 1 ]; then + efi + elif [ $input5 = 2 ]; then + gatekeeper + elif [ $input5 = 3 ]; then + hibernation + elif [ $input5 = 4 ]; then + reboot1 + elif [ $input5 = 5 ]; then + shutdown1 + elif [ $input5 = 6 ]; then + imessage + fi + +} + +efi(){ + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + printf "${YELLOW}${bold}" + echo " $version" + echo "" + echo " ██╗ ██╗ █████╗ ██╗ ██╗██╗ ██╗██╗ ██╗"; + echo " ██║ ██║██╔══██╗██║ ██╔╝██║ ██╔╝██║ ██║"; + echo " ███████║███████║█████╔╝ █████╔╝ ██║ ██║"; + echo " ██╔══██║██╔══██║██╔═██╗ ██╔═██╗ ██║ ██║"; + echo " ██║ ██║██║ ██║██║ ██╗██║ ██╗╚██████╔╝"; + echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ "; + echo "" + printf "${NC}${normal}" + echo "" + echo "" + echo " Mount / Unmount EFI" + echo " -------------------" + echo "" + echo "" + echo " 1) Mount EFI" + echo " 2) Unmount EFI" + echo "" + echo "" + echo "" + echo "" + echo "" + echo "press q to go back" + echo "" + read -p "> " in3 + + if [ $in3 = 1 ]; then + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + printf "${YELLOW}${bold}" + echo " $version" + echo "" + echo " ██╗ ██╗ █████╗ ██╗ ██╗██╗ ██╗██╗ ██╗"; + echo " ██║ ██║██╔══██╗██║ ██╔╝██║ ██╔╝██║ ██║"; + echo " ███████║███████║█████╔╝ █████╔╝ ██║ ██║"; + echo " ██╔══██║██╔══██║██╔═██╗ ██╔═██╗ ██║ ██║"; + echo " ██║ ██║██║ ██║██║ ██╗██║ ██╗╚██████╔╝"; + echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ "; + echo "" + printf "${NC}${normal}" + echo "" + echo "" + echo " Mount EFI" + echo " ---------" + diskutil list | grep EFI + echo "" + echo " disk0s1 is from internal disk" + echo " disk1s1 is from external disk" + echo "" + echo " Type the disk identifier you want to mount." + echo "" + echo "" + echo "" + echo "press q to go back" + echo "" + read -p "> " in4 + if [ $in4 = "q" ]; then + efi + elif [ $in4 = "disk0s1" ]; then + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + printf "${YELLOW}${bold}" + echo " $version" + echo "" + echo " ██╗ ██╗ █████╗ ██╗ ██╗██╗ ██╗██╗ ██╗"; + echo " ██║ ██║██╔══██╗██║ ██╔╝██║ ██╔╝██║ ██║"; + echo " ███████║███████║█████╔╝ █████╔╝ ██║ ██║"; + echo " ██╔══██║██╔══██║██╔═██╗ ██╔═██╗ ██║ ██║"; + echo " ██║ ██║██║ ██║██║ ██╗██║ ██╗╚██████╔╝"; + echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ "; + echo "" + printf "${NC}${normal}" + echo "" + echo "" + echo " Mounting EFI" + echo " ------------" + echo "" + echo "" + mkdir "/Volumes/EFI" + sudo mount -t msdos /dev/disk0s1 "/Volumes/EFI" + open "/Volumes/EFI" + echo "" + echo "" + echo "" + echo "press q to go back" + echo "" + read -p "> " in5 + if [ $in5 = "q" ]; then + efi + fi + + elif [ $in4 = "disk1s1" ]; then + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + printf "${YELLOW}${bold}" + echo " $version" + echo "" + echo " ██╗ ██╗ █████╗ ██╗ ██╗██╗ ██╗██╗ ██╗"; + echo " ██║ ██║██╔══██╗██║ ██╔╝██║ ██╔╝██║ ██║"; + echo " ███████║███████║█████╔╝ █████╔╝ ██║ ██║"; + echo " ██╔══██║██╔══██║██╔═██╗ ██╔═██╗ ██║ ██║"; + echo " ██║ ██║██║ ██║██║ ██╗██║ ██╗╚██████╔╝"; + echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ "; + echo "" + printf "${NC}${normal}" + echo "" + echo "" + echo " Mounting EFI" + echo " ------------" + echo "" + echo "" + mkdir "/Volumes/EFI2" + sudo mount -t msdos /dev/disk1s1 "/Volumes/EFI2" + open "/Volumes/EFI2" + echo "" + echo "" + echo "" + echo "press q to go back" + echo "" + read -p "> " in6 + if [ $in6 = "q" ]; then + efi + fi + fi + + elif [ $in3 = 2 ]; then + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + printf "${YELLOW}${bold}" + echo " $version" + echo "" + echo " ██╗ ██╗ █████╗ ██╗ ██╗██╗ ██╗██╗ ██╗"; + echo " ██║ ██║██╔══██╗██║ ██╔╝██║ ██╔╝██║ ██║"; + echo " ███████║███████║█████╔╝ █████╔╝ ██║ ██║"; + echo " ██╔══██║██╔══██║██╔═██╗ ██╔═██╗ ██║ ██║"; + echo " ██║ ██║██║ ██║██║ ██╗██║ ██╗╚██████╔╝"; + echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ "; + echo "" + printf "${NC}${normal}" + echo "" + echo "" + echo " Unmount EFI" + echo " -----------" + diskutil list | grep EFI + echo "" + echo " disk0s1 is from internal disk" + echo " disk1s1 is from external disk" + echo "" + echo " Type the disk identifier you want to unmount." + echo "" + echo "" + echo "" + echo "" + echo "press q to go back" + echo "" + read -p "> " in7 + if [ $in7 = "q" ]; then + efi + elif [ $in7 = "disk0s1" ]; then + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + printf "${YELLOW}${bold}" + echo " $version" + echo "" + echo " ██╗ ██╗ █████╗ ██╗ ██╗██╗ ██╗██╗ ██╗"; + echo " ██║ ██║██╔══██╗██║ ██╔╝██║ ██╔╝██║ ██║"; + echo " ███████║███████║█████╔╝ █████╔╝ ██║ ██║"; + echo " ██╔══██║██╔══██║██╔═██╗ ██╔═██╗ ██║ ██║"; + echo " ██║ ██║██║ ██║██║ ██╗██║ ██╗╚██████╔╝"; + echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ "; + echo "" + printf "${NC}${normal}" + echo "" + echo "" + echo " Unmounting EFI" + echo " --------------" + echo "" + echo "" + echo "" + diskutil unmount /dev/disk0s1 + echo "" + echo "" + echo "" + echo "" + echo "press q to go back" + echo "" + read -p "> " in8 + if [ $in8 = "q" ]; then + efi + fi + + elif [ $in7 = "disk1s1" ]; then + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + printf "${YELLOW}${bold}" + echo " $version" + echo "" + echo " ██╗ ██╗ █████╗ ██╗ ██╗██╗ ██╗██╗ ██╗"; + echo " ██║ ██║██╔══██╗██║ ██╔╝██║ ██╔╝██║ ██║"; + echo " ███████║███████║█████╔╝ █████╔╝ ██║ ██║"; + echo " ██╔══██║██╔══██║██╔═██╗ ██╔═██╗ ██║ ██║"; + echo " ██║ ██║██║ ██║██║ ██╗██║ ██╗╚██████╔╝"; + echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ "; + echo "" + printf "${NC}${normal}" + echo "" + echo "" + echo " Unmounting EFI" + echo " --------------" + echo "" + echo "" + echo "" + diskutil unmount /dev/disk1s1 + echo "" + echo "" + echo "" + echo "" + echo "press q to go back" + echo "" + read -p "> " in9 + if [ $in9 = "q" ]; then + efi + fi + fi + + elif [ $in3 = "q" ]; then + options + fi +} + +gatekeeper(){ + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + printf "${YELLOW}${bold}" + echo " $version" + echo "" + echo " ██╗ ██╗ █████╗ ██╗ ██╗██╗ ██╗██╗ ██╗"; + echo " ██║ ██║██╔══██╗██║ ██╔╝██║ ██╔╝██║ ██║"; + echo " ███████║███████║█████╔╝ █████╔╝ ██║ ██║"; + echo " ██╔══██║██╔══██║██╔═██╗ ██╔═██╗ ██║ ██║"; + echo " ██║ ██║██║ ██║██║ ██╗██║ ██╗╚██████╔╝"; + echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ "; + echo "" + printf "${NC}${normal}" + echo "" + echo "" + echo " Enable / Disable GateKeeper" + echo " ---------------------------" + echo "" + echo "" + echo " 1) Enable GateKeeper" + echo " 2) Disable GateKeeper" + echo "" + echo "" + echo "" + echo "" + echo "" + echo "press q to go back" + echo "" + read -p "> " i + if [ $i = 1 ]; then + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + printf "${YELLOW}${bold}" + echo " $version" + echo "" + echo " ██╗ ██╗ █████╗ ██╗ ██╗██╗ ██╗██╗ ██╗"; + echo " ██║ ██║██╔══██╗██║ ██╔╝██║ ██╔╝██║ ██║"; + echo " ███████║███████║█████╔╝ █████╔╝ ██║ ██║"; + echo " ██╔══██║██╔══██║██╔═██╗ ██╔═██╗ ██║ ██║"; + echo " ██║ ██║██║ ██║██║ ██╗██║ ██╗╚██████╔╝"; + echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ "; + echo "" + printf "${NC}${normal}" + + echo "" + echo " Enable GateKeeper" + echo " -----------------" + echo "" + echo "" + sudo spctl --master-enable + echo " GateKeeper enabled" + echo "" + echo "" + echo "" + echo "" + echo "" + echo "press q to go back" + echo "" + read -p "> " ii + if [ $ii = "q" ]; then + gatekeeper + fi + elif [ $i = 2 ]; then + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + printf "${YELLOW}${bold}" + echo " $version" + echo "" + echo " ██╗ ██╗ █████╗ ██╗ ██╗██╗ ██╗██╗ ██╗"; + echo " ██║ ██║██╔══██╗██║ ██╔╝██║ ██╔╝██║ ██║"; + echo " ███████║███████║█████╔╝ █████╔╝ ██║ ██║"; + echo " ██╔══██║██╔══██║██╔═██╗ ██╔═██╗ ██║ ██║"; + echo " ██║ ██║██║ ██║██║ ██╗██║ ██╗╚██████╔╝"; + echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ "; + echo "" + printf "${NC}${normal}" + echo "" + echo "" + echo " Disable GateKeeper" + echo " ------------------" + echo "" + echo "" + sudo spctl --master-disable + echo " GateKeeper disabled" + echo "" + echo "" + echo "" + echo "" + echo "" + echo "press q to go back" + echo "" + read -p "> " iii + if [ $iii = "q" ]; then + gatekeeper + fi + elif [ $i = "q" ]; then + options + fi +} + +hibernation(){ + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + printf "${YELLOW}${bold}" + echo " $version" + echo "" + echo " ██╗ ██╗ █████╗ ██╗ ██╗██╗ ██╗██╗ ██╗"; + echo " ██║ ██║██╔══██╗██║ ██╔╝██║ ██╔╝██║ ██║"; + echo " ███████║███████║█████╔╝ █████╔╝ ██║ ██║"; + echo " ██╔══██║██╔══██║██╔═██╗ ██╔═██╗ ██║ ██║"; + echo " ██║ ██║██║ ██║██║ ██╗██║ ██╗╚██████╔╝"; + echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ "; + printf "${NC}${normal}" + echo " Disabling Hibernation" + echo " ---------------------" + sudo pmset -a hibernatemode 0 + sudo rm /var/vm/sleepimage + sudo mkdir /var/vm/sleepimage + sudo pmset -a standby 0 + sudo pmset -a autopoweroff 0 + echo "" + echo " Hibernation disabled" + echo "" + echo "press q to go back" + echo "" + read -p "> " ii + if [ $ii = "q" ]; then + options + fi +} + +reboot1(){ + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + printf "${YELLOW}${bold}" + echo " $version" + echo "" + echo "" + echo "" + echo "" + echo "" + echo " ██╗ ██╗ █████╗ ██╗ ██╗██╗ ██╗██╗ ██╗"; + echo " ██║ ██║██╔══██╗██║ ██╔╝██║ ██╔╝██║ ██║"; + echo " ███████║███████║█████╔╝ █████╔╝ ██║ ██║"; + echo " ██╔══██║██╔══██║██╔═██╗ ██╔═██╗ ██║ ██║"; + echo " ██║ ██║██║ ██║██║ ██╗██║ ██╗╚██████╔╝"; + echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ "; + echo "" + echo "" + printf "${NC}${normal}\n" + echo " Force Reboot" + echo " (Any unsaved progress will be lost)" + echo "" + printf " Are you sure?\n" + echo " (Y/N) " + echo "" + echo "" + echo "" + read -p "> " in + + if [ $in = "y" ] || [ $in = "Y" ]; then + sudo shutdown -r now + elif [ $in = "n" ] || [ $in = "N" ]; then + options + fi +} + +shutdown1(){ + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + printf "${YELLOW}${bold}" + echo " $version" + echo "" + echo "" + echo "" + echo "" + echo "" + echo " ██╗ ██╗ █████╗ ██╗ ██╗██╗ ██╗██╗ ██╗"; + echo " ██║ ██║██╔══██╗██║ ██╔╝██║ ██╔╝██║ ██║"; + echo " ███████║███████║█████╔╝ █████╔╝ ██║ ██║"; + echo " ██╔══██║██╔══██║██╔═██╗ ██╔═██╗ ██║ ██║"; + echo " ██║ ██║██║ ██║██║ ██╗██║ ██╗╚██████╔╝"; + echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ "; + echo "" + echo "" + printf "${NC}${normal}\n + " + echo " Force Shutdown" + echo " (Any unsaved progress will be lost)" + echo "" + printf " Are you sure?\n" + echo " (Y/N) " + echo "" + echo "" + echo "" + read -p "> " in + + if [ $in = "y" ] || [ $in = "Y" ]; then + sudo shutdown now + elif [ $in = "n" ] || [ $in = "N" ]; then + options + fi +} + +imessage(){ + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + printf "${YELLOW}${bold}" + echo " $version" + echo "" + echo " ██╗ ██╗ █████╗ ██╗ ██╗██╗ ██╗██╗ ██╗"; + echo " ██║ ██║██╔══██╗██║ ██╔╝██║ ██╔╝██║ ██║"; + echo " ███████║███████║█████╔╝ █████╔╝ ██║ ██║"; + echo " ██╔══██║██╔══██║██╔═██╗ ██╔═██╗ ██║ ██║"; + echo " ██║ ██║██║ ██║██║ ██╗██║ ██╗╚██████╔╝"; + echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ "; + printf "${NC}${normal}" + echo "" + echo " Deleting iMessage related files and folders" + echo " -------------------------------------------s" + cd ~/Library/Caches/ + rm -R com.apple.Messages* + rm -R com.apple.imfoundation* + cd ~/Library/Preferences/ + rm com.apple.iChat* + rm com.apple.imagent* + rm com.apple.imessage* + rm com.apple.imservice* + rm -R ~/Library/Messages/ + echo " Done. Please Reboot" + echo "" + echo "" + echo "press q to go back" + echo "" + read -p "> " ii + if [ $ii = "q" ]; then + options + fi +} diff --git a/settings_f.sh b/settings_f.sh new file mode 100644 index 0000000..b23ab4e --- /dev/null +++ b/settings_f.sh @@ -0,0 +1,363 @@ +#!/bin/bash +# +# Hakku2 Settings Functions: A totally reworked command line utility which shows +# the user their system info and a bunch of useful +# tools and tweaks. +# Built using Bash version 3.2.57(1)-release +# +# The MIT License (MIT) +# +# Copyright (c) 2019 Ryan Wong +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +settings(){ + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + printf "${YELLOW}${bold}" + echo " $version" + echo "" + echo " ██╗ ██╗ █████╗ ██╗ ██╗██╗ ██╗██╗ ██╗"; + echo " ██║ ██║██╔══██╗██║ ██╔╝██║ ██╔╝██║ ██║"; + echo " ███████║███████║█████╔╝ █████╔╝ ██║ ██║"; + echo " ██╔══██║██╔══██║██╔═██╗ ██╔═██╗ ██║ ██║"; + echo " ██║ ██║██║ ██║██║ ██╗██║ ██╗╚██████╔╝"; + echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ "; + echo "" + printf "${NC}${normal}" + echo "" + echo " Settings " + echo " --------" + echo "" + echo "" + echo " 1) VoiceOver" + echo " 2) Change color of logo" + echo "" + echo "" + echo "" + echo "" + echo "" + echo "press q to go back" + echo "" + read -p "> " op + + if [ $op = 1 ]; then + voiceover + elif [ $op = 2 ]; then + colorlogo + elif [ $op = "q" ]; then + mainmenu + fi +} + +voiceover(){ + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + printf "${YELLOW}${bold}" + echo " $version" + echo "" + echo " ██╗ ██╗ █████╗ ██╗ ██╗██╗ ██╗██╗ ██╗"; + echo " ██║ ██║██╔══██╗██║ ██╔╝██║ ██╔╝██║ ██║"; + echo " ███████║███████║█████╔╝ █████╔╝ ██║ ██║"; + echo " ██╔══██║██╔══██║██╔═██╗ ██╔═██╗ ██║ ██║"; + echo " ██║ ██║██║ ██║██║ ██╗██║ ██╗╚██████╔╝"; + echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ "; + echo "" + printf "${NC}${normal}" + echo "" + echo " VoiceOver" + echo " ---------" + echo "" + echo "" + echo " 1) Enable" + echo " 2) Disable" + echo "" + echo "" + echo "" + echo "" + echo "" + echo "press q to go back" + echo "" + read -p "> " op1 + + if [ $op1 = 1 ]; then + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + printf "${YELLOW}${bold}" + echo " $version" + echo "" + echo " ██╗ ██╗ █████╗ ██╗ ██╗██╗ ██╗██╗ ██╗"; + echo " ██║ ██║██╔══██╗██║ ██╔╝██║ ██╔╝██║ ██║"; + echo " ███████║███████║█████╔╝ █████╔╝ ██║ ██║"; + echo " ██╔══██║██╔══██║██╔═██╗ ██╔═██╗ ██║ ██║"; + echo " ██║ ██║██║ ██║██║ ██╗██║ ██╗╚██████╔╝"; + echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ "; + echo "" + printf "${NC}${normal}" + echo "" + echo "" + echo " Enabling VoiceOver" + echo " ------------------" + echo "" + echo "" + vo="Warning! I am not responsible for any damage that may be caused by using these tweaks." + echo "" + echo " Enabled VoiceOver" + echo "" + echo "" + echo "" + echo "" + echo "press q to go back" + echo "" + read -p "> " op11 + if [ $op11 = "q" ]; then + voiceover + fi + + elif [ $op1 = 2 ]; then + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + printf "${YELLOW}${bold}" + echo " $version" + echo "" + echo " ██╗ ██╗ █████╗ ██╗ ██╗██╗ ██╗██╗ ██╗"; + echo " ██║ ██║██╔══██╗██║ ██╔╝██║ ██╔╝██║ ██║"; + echo " ███████║███████║█████╔╝ █████╔╝ ██║ ██║"; + echo " ██╔══██║██╔══██║██╔═██╗ ██╔═██╗ ██║ ██║"; + echo " ██║ ██║██║ ██║██║ ██╗██║ ██╗╚██████╔╝"; + echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ "; + echo "" + printf "${NC}${normal}" + echo "" + echo " Disabling VoiceOver" + echo " -------------------" + echo "" + echo "" + vo="" + echo "" + echo " Disabled VoiceOver" + echo "" + echo "" + echo "" + echo "" + echo "press q to go back" + echo "" + read -p "> " op12 + if [ $op12 = "q" ]; then + voiceover + fi + elif [ $op1 = "q" ]; then + settings + fi +} + +colorlogo(){ + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + printf "${YELLOW}${bold}" + echo " $version" + echo "" + echo " ██╗ ██╗ █████╗ ██╗ ██╗██╗ ██╗██╗ ██╗"; + echo " ██║ ██║██╔══██╗██║ ██╔╝██║ ██╔╝██║ ██║"; + echo " ███████║███████║█████╔╝ █████╔╝ ██║ ██║"; + echo " ██╔══██║██╔══██║██╔═██╗ ██╔═██╗ ██║ ██║"; + echo " ██║ ██║██║ ██║██║ ██╗██║ ██╗╚██████╔╝"; + echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ "; + echo "" + printf "${NC}${normal}" + echo "" + echo " Change color of Logo " + echo " ---------------------" + echo "" + echo "" + echo " 1) Original" + echo " 2) Red" + echo " 3) Blue" + echo " 4) Green" + echo " 5) White" + echo "" + echo "" + echo "press q to go back" + echo "" + read -p "> " op2 + + if [ $op2 = 1 ]; then + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + printf "${YELLOW}${bold}" + echo " $version" + echo "" + echo " ██╗ ██╗ █████╗ ██╗ ██╗██╗ ██╗██╗ ██╗"; + echo " ██║ ██║██╔══██╗██║ ██╔╝██║ ██╔╝██║ ██║"; + echo " ███████║███████║█████╔╝ █████╔╝ ██║ ██║"; + echo " ██╔══██║██╔══██║██╔═██╗ ██╔═██╗ ██║ ██║"; + echo " ██║ ██║██║ ██║██║ ██╗██║ ██╗╚██████╔╝"; + echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ "; + echo "" + printf "${NC}${normal}" + echo "" + echo "" + echo " Changing Logo Color" + echo " -------------------" + echo "" + echo "" + color="${YELLOW}${bold}" + echo "" + echo " Changed Logo Color to Yellow" + echo "" + echo "" + echo "" + echo "" + echo "press q to go back" + echo "" + read -p "> " op2a + if [ $op2a = "q" ]; then + colorlogo + fi + + elif [ $op2 = 2 ]; then + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + printf "${YELLOW}${bold}" + echo " $version" + echo "" + echo " ██╗ ██╗ █████╗ ██╗ ██╗██╗ ██╗██╗ ██╗"; + echo " ██║ ██║██╔══██╗██║ ██╔╝██║ ██╔╝██║ ██║"; + echo " ███████║███████║█████╔╝ █████╔╝ ██║ ██║"; + echo " ██╔══██║██╔══██║██╔═██╗ ██╔═██╗ ██║ ██║"; + echo " ██║ ██║██║ ██║██║ ██╗██║ ██╗╚██████╔╝"; + echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ "; + echo "" + printf "${NC}${normal}" + echo "" + echo "" + echo " Changing Logo Color" + echo " -------------------" + echo "" + echo "" + color="${RED}${bold}" + echo "" + echo " Changed Logo Color to Red" + echo "" + echo "" + echo "" + echo "" + echo "press q to go back" + echo "" + read -p "> " op2b + if [ $op2b = "q" ]; then + colorlogo + fi + + elif [ $op2 = 3 ]; then + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + printf "${YELLOW}${bold}" + echo " $version" + echo "" + echo " ██╗ ██╗ █████╗ ██╗ ██╗██╗ ██╗██╗ ██╗"; + echo " ██║ ██║██╔══██╗██║ ██╔╝██║ ██╔╝██║ ██║"; + echo " ███████║███████║█████╔╝ █████╔╝ ██║ ██║"; + echo " ██╔══██║██╔══██║██╔═██╗ ██╔═██╗ ██║ ██║"; + echo " ██║ ██║██║ ██║██║ ██╗██║ ██╗╚██████╔╝"; + echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ "; + echo "" + printf "${NC}${normal}" + echo "" + echo "" + echo " Changing Logo Color" + echo " -------------------" + echo "" + echo "" + color="${BLUE}${bold}" + echo "" + echo " Changed Logo Color to Blue" + echo "" + echo "" + echo "" + echo "" + echo "press q to go back" + echo "" + read -p "> " op2c + if [ $op2c = "q" ]; then + colorlogo + fi + + elif [ $op2 = 4 ]; then + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + printf "${YELLOW}${bold}" + echo " $version" + echo "" + echo " ██╗ ██╗ █████╗ ██╗ ██╗██╗ ██╗██╗ ██╗"; + echo " ██║ ██║██╔══██╗██║ ██╔╝██║ ██╔╝██║ ██║"; + echo " ███████║███████║█████╔╝ █████╔╝ ██║ ██║"; + echo " ██╔══██║██╔══██║██╔═██╗ ██╔═██╗ ██║ ██║"; + echo " ██║ ██║██║ ██║██║ ██╗██║ ██╗╚██████╔╝"; + echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ "; + echo "" + printf "${NC}${normal}" + echo "" + echo "" + echo " Changing Logo Color" + echo " -------------------" + echo "" + echo "" + color="${GREEN}${bold}" + echo "" + echo " Changed Logo Color to Green" + echo "" + echo "" + echo "" + echo "" + echo "press q to go back" + echo "" + read -p "> " op2d + if [ $op2d = "q" ]; then + colorlogo + fi + + elif [ $op2 = 5 ]; then + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + printf "${YELLOW}${bold}" + echo " $version" + echo "" + echo " ██╗ ██╗ █████╗ ██╗ ██╗██╗ ██╗██╗ ██╗"; + echo " ██║ ██║██╔══██╗██║ ██╔╝██║ ██╔╝██║ ██║"; + echo " ███████║███████║█████╔╝ █████╔╝ ██║ ██║"; + echo " ██╔══██║██╔══██║██╔═██╗ ██╔═██╗ ██║ ██║"; + echo " ██║ ██║██║ ██║██║ ██╗██║ ██╗╚██████╔╝"; + echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ "; + echo "" + printf "${NC}${normal}" + echo "" + echo "" + echo " Changing Logo Color" + echo " -------------------" + echo "" + echo "" + color="${NC}${bold}" + echo "" + echo " Changed Logo Color to White" + echo "" + echo "" + echo "" + echo "" + echo "press q to go back" + echo "" + read -p "> " op2e + if [ $op2e = "q" ]; then + colorlogo + fi + + elif [ $op2 = "q" ]; then + settings + fi +} diff --git a/tweaks_f.sh b/tweaks_f.sh new file mode 100644 index 0000000..709131c --- /dev/null +++ b/tweaks_f.sh @@ -0,0 +1,117 @@ +#!/bin/bash +# +# Hakku2 TWeaks Functions: A totally reworked command line utility which shows +# the user their system info and a bunch of useful +# tools and tweaks. +# Built using Bash version 3.2.57(1)-release +# +# The MIT License (MIT) +# +# Copyright (c) 2019 Ryan Wong +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +risk(){ + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + printf "$color" + echo " $version" + echo " ████████╗██╗ ██╗███████╗ █████╗ ██╗ ██╗███████╗"; + echo " ╚══██╔══╝██║ ██║██╔════╝██╔══██╗██║ ██╔╝██╔════╝"; + echo " ██║ ██║ █╗ ██║█████╗ ███████║█████╔╝ ███████╗"; + echo " ██║ ██║███╗██║██╔══╝ ██╔══██║██╔═██╗ ╚════██║"; + echo " ██║ ╚███╔███╔╝███████╗██║ ██║██║ ██╗███████║"; + echo " ╚═╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝"; + echo "" + echo " Ryan Wong 2019" + echo "" + printf "${RED}${bold} --------------------------------------------\n" + printf "${RED}${bold} WARNING:\n" + printf "${RED}${normal} I am not responsible for any damage that\n" + printf "${RED}${normal} may be caused by using these tweaks\n" + printf "${RED}${bold} --------------------------------------------\n" + printf "${NC}${normal} 1) I agree 2) Exit\n" + say "$vo" + echo "" + echo "" + echo "" + echo "" + echo "" + echo "" + echo "" + read -p "> " w + if [ $w = 1 ]; then + tweaks + elif [ $w = 2 ]; then + mainmenu + fi +} + +tweaks(){ + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + printf "${YELLOW}${bold}" + echo " $version" + echo " ████████╗██╗ ██╗███████╗ █████╗ ██╗ ██╗███████╗"; + echo " ╚══██╔══╝██║ ██║██╔════╝██╔══██╗██║ ██╔╝██╔════╝"; + echo " ██║ ██║ █╗ ██║█████╗ ███████║█████╔╝ ███████╗"; + echo " ██║ ██║███╗██║██╔══╝ ██╔══██║██╔═██╗ ╚════██║"; + echo " ██║ ╚███╔███╔╝███████╗██║ ██║██║ ██╗███████║"; + echo " ╚═╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝"; + echo "" + printf "${NC}${normal}" + echo "" + echo " 1) Chime When Charging" + echo " 2) Auto Restart on System Freeze" + echo " 3) Force Enable Trim (On non-Apple SSDs)" + echo " 4) Scrollbar Visibility" + echo " 5) Show Hidden Files" + echo " 6) Clear DNS Cache" + echo " 7) Purge Memory Cache" + echo " 8) Enable / Disable Root User" + echo " 9) Erase Spotlight Index and Rebuild" + echo " 10) Rebuild KextCache" + echo "" + echo "" + echo "press q to go back" + echo "" + read -p "> " www + if [ $www = "q" ]; then + mainmenu + elif [ $www = 1 ]; then + chime + elif [ $www = 2 ]; then + rsf + elif [ $www = 3 ]; then + trim + elif [ $www = 4 ]; then + scrollbar + elif [ $www = 5 ]; then + hiddenfiles + elif [ $www = 6 ]; then + dnscache + elif [ $www = 7 ]; then + memcache + elif [ $www = 8 ]; then + rootusr + elif [ $www = 9 ]; then + spotlight + elif [ $www = 10 ]; then + kextcache + fi + +} diff --git a/update_f.sh b/update_f.sh new file mode 100644 index 0000000..39667e2 --- /dev/null +++ b/update_f.sh @@ -0,0 +1,143 @@ +#!/bin/bash +# +# Hakku2 Update Functions: A totally reworked command line utility which shows +# the user their system info and a bunch of useful +# tools and tweaks. +# Built using Bash version 3.2.57(1)-release +# +# The MIT License (MIT) +# +# Copyright (c) 2019 Ryan Wong +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +update(){ + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + printf "${YELLOW}${bold}" + echo " $version" + echo "" + echo " ██╗ ██╗ █████╗ ██╗ ██╗██╗ ██╗██╗ ██╗"; + echo " ██║ ██║██╔══██╗██║ ██╔╝██║ ██╔╝██║ ██║"; + echo " ███████║███████║█████╔╝ █████╔╝ ██║ ██║"; + echo " ██╔══██║██╔══██║██╔═██╗ ██╔═██╗ ██║ ██║"; + echo " ██║ ██║██║ ██║██║ ██╗██║ ██╗╚██████╔╝"; + echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ "; + echo "" + printf "${NC}${normal}" + echo "" + echo " Updates" + echo " -------" + echo "" + echo "" + echo " $updating" + echo "" + echo "" + echo "" + echo "" + echo "$dl" + echo "press c to check for updates" + echo "press q to go back" + echo "" + read -p "> " p + if [ $p = "q" ]; then + mainmenu + elif [ $p = "c" ]; then + check + fi +} + +download(){ + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + printf "${YELLOW}${bold}" + echo " $version" + echo "" + echo " ██╗ ██╗ █████╗ ██╗ ██╗██╗ ██╗██╗ ██╗"; + echo " ██║ ██║██╔══██╗██║ ██╔╝██║ ██╔╝██║ ██║"; + echo " ███████║███████║█████╔╝ █████╔╝ ██║ ██║"; + echo " ██╔══██║██╔══██║██╔═██╗ ██╔═██╗ ██║ ██║"; + echo " ██║ ██║██║ ██║██║ ██╗██║ ██╗╚██████╔╝"; + echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ "; + echo "" + printf "${NC}${normal}" + echo "" + echo " Downloading Hakku ${update}" + echo " ---------------------------" + echo "" + echo "" + wget --no-check-certificate --content-disposition https://github.com/Rybo713/Hakku/tarball/$update + curl -LJO https://github.com/Rybo713/Hakku/tarball/$update + echo "" + echo " Extracting files" + echo "" + tar xvzf *.tar.gz && rm *.tar.gz + echo "" + echo " To install move contents from the new folder to the old folder." + echo "" + echo "press q to go back" + echo "" + read -p "> " pp + if [ $pp = "q" ]; then + mainmenu + fi + +} + +check(){ + /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' + printf "${YELLOW}${bold}" + echo " $version" + echo "" + echo " ██╗ ██╗ █████╗ ██╗ ██╗██╗ ██╗██╗ ██╗"; + echo " ██║ ██║██╔══██╗██║ ██╔╝██║ ██╔╝██║ ██║"; + echo " ███████║███████║█████╔╝ █████╔╝ ██║ ██║"; + echo " ██╔══██║██╔══██║██╔═██╗ ██╔═██╗ ██║ ██║"; + echo " ██║ ██║██║ ██║██║ ██╗██║ ██╗╚██████╔╝"; + echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ "; + echo "" + printf "${NC}${normal}" + echo "" + echo " Checking for new updates" + echo " ------------------------" + echo "" + echo "" + update="$(curl --silent "https://api.github.com/repos/Rybo713/Hakku/tags" | jq -r '.[0].name')" + echo "" + if [ $update = "v2.0-alpha" ]; then + updating="No new updates" + echo " No new updates" + else + updating="New updates found: ${update}" + dl="press d to download Hakku ${update}" + echo " New updates found: ${update}" + noti="${RED}${bold}1${NC}${normal}" + fi + echo "" + echo "" + echo "" + echo "" + echo "press d to download Hakku ${update}" + echo "press q to go back" + echo "" + read -p "> " ppp + if [ $ppp = "q" ]; then + update + elif [ $ppp = "d" ]; then + download + fi +}