#!/bin/bash

# Made by MalHyuk 
# recycling by Jastes

echo "================================="
echo "|Installation script for Hacking|"
echo "================================="
echo "[K]orea Setting"
echo "[D]efault"

read -p "Enter to install : " install_for_hacking

# Install basic linux tools
sudo apt update

# apm_install(){
# 	# Install Apache2
# 	sudo apt install -y apache2

# 	# Install MySQL
# 	sudo apt install -y mysql-server

# 	# Install PHP 7.4
# 	sudo apt install -y php libapache2-mod-php php-mysql

# 	# Install PHP Extension
# 	sudo apt install -y php-{bz2,imagick,imap,intl,gd,mbstring,pspell,curl,readline,xml,xmlrpc,zip}

# 	# Change owner basic Web root directory
# 	sudo chown -R $USER:$USER /var/www

# 	# Link python3 -> python // python command
# 	sudo ln -sf /usr/bin/python3 /usr/bin/python

# 	# Update pip
# 	sudo python3 -m pip install --upgrade pip

# 	# SSH server start
# 	sudo systemctl enable ssh
# 	sudo systemctl start ssh

# 	# Web server start (Apache2)
# 	sudo systemctl enable apache2
# 	sudo systemctl start apache2

# 	# Set password for MySQL Root user
# 	sudo mysql -u root -p
# 	# mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password by '$MYSQLPASSWD';
# 	# mysql> exit

# 	# MySQL Secure Installation
# 	sudo mysql_secure_installation

# 	# Input MySQL root $MYSQLPASSWD
# 	# Q1. Change the password for root? 	== n
# 	# Q2. Remove anonymous users? 		== y
# 	# Q3. Disallow root login remotely? 	== y
# 	# Q4. Remove test database?		== y
# 	# Q5. Reload privilege tables now?	== y


# 	# Lock normal user MySQL using root
# 	mysql -u root -p
# 	# mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH auth_socket;

# 	# if CMD = [$ mysql -u root -p ] can't login SUCCESS
# 	# if login user root by mysql
# 	#   - sudo mysql -u root -p
# 	#   - Input MySQL root password
# }

# pwn_install(){
# 	# Add architecture 32bit
# 	sudo dpkg --add-architecture i386
# 	sudo apt update
# 	sudo apt install -y libseccomp-dev:i386 libc6:i386 libstdc++6:i386 ruby qemu curl apt-transport-https ca-certificates software-properties-common
# 	curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add
	
# 	# Install docker
# 	sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
# 	sudo apt update
# 	sudo apt install -y docker-ce

# 	# Upgrade pip
# 	sudo python3 -m pip install --upgrade pip

# 	# Install pwntools python library
# 	sudo python3 -m pip install --upgrade pwntools
	
# 	# Install ropgadget python library
# 	sudo python3 -m pip install --upgrade ropgadget

# 	# Install one shot gadget
# 	sudo gem install one_gadget

# 	# Install gef, pwndbg gdb plugin
# 	wget -q -O- https://raw.githubusercontent.com/hugsy/gef/dev/scripts/gef.sh | sh
# 	git clone https://github.com/scwuaptx/Pwngdb.git ~/Pwngdb
# 	echo "export LC_ALL=C.UTF-8" >> ~/.bashrc
# 	cat ~/Pwngdb/.gdbinit >> ~/.gdbinit

# 	# Install libc-database
# 	git clone https://github.com/niklasb/libc-database ~/libc-database
# }

Korean_install(){
    # default setup start
    sudo apt -y update
    sudo apt -y upgrade

    # korean packages install
    sudo apt-get install fcitx-hangul
    sudo apt-get install fcitx-lib*
    sudo apt-get install fonts-nanum*
    
    #do work!
    reboot
}

default_install(){
    # bat(cat) install (batcat using!)
    sudo apt install -y bat
    mkdir -p $HOME/.local/bin
    ln -s ${which batcat} ~/.local/bin/bat 
    echo "alias bat = 'batcat'" >> $HOME/.bash_aliases

    # fd(find) install (fd using!)
    sudo apt install -y fd-find
    ln -s $(which fdfind) ~/.local/bin/fd
    echo "$HOME/.local/bin/fd" >> $HOME/.bash_aliases

    #tldr(man) install (tldr using!)
    sudo npm install -g tldr

    #duf(df) install (duf using!)
    sudo apt install -y duf

    #nnn(mv, mkdir, cp) install (nnn using!)
    sudo apt install -y nnn

    source $HOME/.bash_aliases
}

case $install_for_hacking in
    K)
        Korean_install
        ;;
    D)
        default_install
        ;;
	*)
		echo "Input [A]ll [W]eb [P]wn"
		;;
esac
