119 lines
3.5 KiB
Bash
119 lines
3.5 KiB
Bash
#!/bin/bash
|
|
|
|
# ASCII Art
|
|
echo "
|
|
###### ######
|
|
# # # # # ###### # # # # ##### #### ######
|
|
# # # # # # # # # # # # # # #
|
|
###### # ## ##### # ###### # # # # #####
|
|
# # ## # # # # # # # # ### #
|
|
# # # # # # # # # # # # # #
|
|
# # # # ###### ###### # # # ##### #### ######
|
|
"
|
|
|
|
echo "Vetheon is coming to help!"
|
|
|
|
# Function to install packages
|
|
install_packages() {
|
|
local packages=("$@")
|
|
for package in "${packages[@]}"; do
|
|
if ! command -v "$package" >/dev/null 2>&1; then
|
|
echo "Installing $package..."
|
|
if command -v apt-get >/dev/null; then
|
|
apt-get install -y "$package"
|
|
elif command -v dnf >/dev/null; then
|
|
dnf install -y "$package"
|
|
elif command -v yum >/dev/null; then
|
|
yum install -y "$package"
|
|
elif command -v pacman >/dev/null; then
|
|
if ! pacman -Q "$package" >/dev/null 2>&1; then
|
|
pacman -Sy --noconfirm "$package"
|
|
fi
|
|
elif command -v apk >/dev/null; then
|
|
apk add "$package"
|
|
else
|
|
echo "Unsupported package manager. Please install $package manually."
|
|
fi
|
|
else
|
|
echo "$package is already installed."
|
|
fi
|
|
done
|
|
}
|
|
|
|
# Detect package manager and install required packages
|
|
if command -v apt-get >/dev/null; then
|
|
apt-get update
|
|
install_packages kitty sudo wget
|
|
elif command -v dnf >/dev/null; then
|
|
install_packages kitty sudo wget
|
|
elif command -v yum >/dev/null; then
|
|
install_packages kitty sudo wget
|
|
elif command -v pacman >/dev/null; then
|
|
install_packages kitty sudo wget
|
|
if ! command -v yay >/dev/null; then
|
|
echo "Installing yay..."
|
|
cd /opt || exit
|
|
sudo git clone https://aur.archlinux.org/yay.git
|
|
sudo chown -R "$(whoami)" ./yay
|
|
cd yay || exit
|
|
makepkg -si --noconfirm
|
|
fi
|
|
elif command -v apk >/dev/null; then
|
|
apk update
|
|
install_packages kitty sudo wget
|
|
else
|
|
echo "Unsupported package manager. Please install kiTTY, sudo, and wget manually."
|
|
exit 1
|
|
fi
|
|
|
|
# Create user 'vetheon' and set password
|
|
if ! id -u vetheon >/dev/null 2>&1; then
|
|
useradd -m -s /bin/bash vetheon
|
|
echo "vetheon:Changeme123" | chpasswd
|
|
usermod -aG sudo vetheon
|
|
mkdir -p /home/vetheon/.ssh
|
|
wget -O /home/vetheon/.ssh/authorized_keys https://keys.pixelridgesoftworks.com/vetheon_ssh_key.pub
|
|
chown -R vetheon:vetheon /home/vetheon/.ssh
|
|
chmod 600 /home/vetheon/.ssh/authorized_keys
|
|
echo "User 'vetheon' created and SSH key added."
|
|
else
|
|
echo "User 'vetheon' already exists."
|
|
fi
|
|
|
|
# Restart sshd
|
|
if systemctl is-active --quiet sshd; then
|
|
systemctl restart sshd
|
|
elif systemctl is-active --quiet ssh; then
|
|
systemctl restart ssh
|
|
else
|
|
service ssh restart
|
|
fi
|
|
|
|
# Create removal script
|
|
cat << 'EOF' > /usr/local/bin/remove_vetheon.sh
|
|
#!/bin/bash
|
|
|
|
# Remove user 'vetheon'
|
|
userdel -r vetheon
|
|
|
|
# Remove SSH key
|
|
rm -f /home/vetheon/.ssh/authorized_keys
|
|
|
|
# Restart sshd
|
|
if systemctl is-active --quiet sshd; then
|
|
systemctl restart sshd
|
|
elif systemctl is-active --quiet ssh; then
|
|
systemctl restart ssh
|
|
else
|
|
service ssh restart
|
|
fi
|
|
|
|
echo "User 'vetheon' has been removed from the system."
|
|
EOF
|
|
|
|
chmod +x /usr/local/bin/remove_vetheon.sh
|
|
|
|
# Final message
|
|
echo "You have just given an employee of PixelRidge Softworks access to your machine."
|
|
echo "To remove this access, run 'sudo /usr/local/bin/remove_vetheon.sh'."
|