#!/bin/bash # Exploit.or.id Client Installer # This script will automatically install the Exploit.or.id client # Colors for output GREEN='\033[0;32m' YELLOW='\033[1;33m' RED='\033[0;31m' NC='\033[0m' # No Color echo -e "${GREEN}=====================================${NC}" echo -e "${GREEN} Exploit.or.id Client Installer ${NC}" echo -e "${GREEN}=====================================${NC}" echo "" # Detect OS echo -e "${YELLOW}Detecting operating system...${NC}" if [[ "$OSTYPE" == "linux-gnu"* ]]; then OS="Linux" echo -e "${GREEN}Operating system: Linux${NC}" elif [[ "$OSTYPE" == "darwin"* ]]; then OS="macOS" echo -e "${GREEN}Operating system: macOS${NC}" else echo -e "${RED}Unsupported operating system: $OSTYPE${NC}" exit 1 fi # Check dependencies echo -e "\n${YELLOW}Checking dependencies...${NC}" check_dependency() { if ! command -v $1 &> /dev/null; then echo -e "${RED}$1 not found. Installing $1...${NC}" if [[ "$OS" == "Linux" ]]; then if command -v apt-get &> /dev/null; then sudo apt-get update sudo apt-get install -y $2 elif command -v yum &> /dev/null; then sudo yum install -y $2 else echo -e "${RED}Package manager not supported. Please install $1 manually.${NC}" exit 1 fi elif [[ "$OS" == "macOS" ]]; then if ! command -v brew &> /dev/null; then echo -e "${RED}Homebrew not found. Installing Homebrew...${NC}" /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" fi brew install $2 fi else echo -e "${GREEN}$1 is already installed.${NC}" fi } # Check required dependencies check_dependency "gcc" "gcc" check_dependency "make" "make" check_dependency "curl" "curl" # Check libcurl-dev echo -e "\n${YELLOW}Checking libcurl development package...${NC}" if [[ "$OS" == "Linux" ]]; then if ! pkg-config --exists libcurl || [ ! -f /usr/include/curl/curl.h ]; then echo -e "${RED}libcurl development package not found. Installing...${NC}" if command -v apt-get &> /dev/null; then sudo apt-get update sudo apt-get install -y libcurl4-openssl-dev elif command -v yum &> /dev/null; then sudo yum install -y libcurl-devel else echo -e "${RED}Package manager not supported. Please install libcurl development package manually.${NC}" exit 1 fi else echo -e "${GREEN}libcurl development package is already installed.${NC}" fi elif [[ "$OS" == "macOS" ]]; then if ! brew list curl &> /dev/null; then echo -e "${RED}libcurl not found. Installing libcurl...${NC}" brew install curl else echo -e "${GREEN}libcurl is already installed.${NC}" fi fi # Check json-c echo -e "\n${YELLOW}Checking json-c...${NC}" if [[ "$OS" == "Linux" ]]; then if ! pkg-config --exists json-c || [ ! -f /usr/include/json-c/json.h ]; then echo -e "${RED}json-c development package not found. Installing...${NC}" if command -v apt-get &> /dev/null; then sudo apt-get update sudo apt-get install -y libjson-c-dev elif command -v yum &> /dev/null; then sudo yum install -y json-c-devel else echo -e "${RED}Package manager not supported. Please install json-c development package manually.${NC}" exit 1 fi else echo -e "${GREEN}json-c development package is already installed.${NC}" fi elif [[ "$OS" == "macOS" ]]; then if ! brew list json-c &> /dev/null || [ ! -f /opt/homebrew/include/json-c/json.h -a ! -f /usr/local/include/json-c/json.h ]; then echo -e "${RED}json-c development package not found. Installing...${NC}" brew install json-c else echo -e "${GREEN}json-c development package is already installed.${NC}" fi fi # Check libzip echo -e "\n${YELLOW}Checking libzip...${NC}" if [[ "$OS" == "Linux" ]]; then if ! pkg-config --exists libzip || [ ! -f /usr/include/zip.h ]; then echo -e "${RED}libzip development package not found. Installing...${NC}" if command -v apt-get &> /dev/null; then sudo apt-get update sudo apt-get install -y libzip-dev elif command -v yum &> /dev/null; then sudo yum install -y libzip-devel else echo -e "${RED}Package manager not supported. Please install libzip development package manually.${NC}" exit 1 fi else echo -e "${GREEN}libzip development package is already installed.${NC}" fi elif [[ "$OS" == "macOS" ]]; then if ! brew list libzip &> /dev/null || [ ! -f /opt/homebrew/include/zip.h -a ! -f /usr/local/include/zip.h ]; then echo -e "${RED}libzip development package not found. Installing...${NC}" brew install libzip else echo -e "${GREEN}libzip development package is already installed.${NC}" fi fi # Compile client echo -e "\n${YELLOW}Compiling Exploit.or.id client...${NC}" make clean if make; then echo -e "${GREEN}Compilation successful!${NC}" else echo -e "${RED}Compilation failed. Please check the errors above.${NC}" exit 1 fi # Install client echo -e "\n${YELLOW}Installing Exploit.or.id client...${NC}" INSTALL_DIR="/usr/local/bin" if [[ "$OS" == "macOS" ]]; then # On macOS, check if /usr/local/bin exists and is writable if [ ! -d "$INSTALL_DIR" ] || [ ! -w "$INSTALL_DIR" ]; then INSTALL_DIR="$HOME/bin" mkdir -p "$INSTALL_DIR" echo -e "${YELLOW}Installing to $INSTALL_DIR because /usr/local/bin is not writable${NC}" fi fi # Copy executable to installation directory if cp exp "$INSTALL_DIR/exp"; then echo -e "${GREEN}Client successfully installed to $INSTALL_DIR/exp${NC}" # Add to PATH if needed if [[ "$INSTALL_DIR" == "$HOME/bin" ]]; then if ! echo "$PATH" | grep -q "$HOME/bin"; then echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bashrc echo 'export PATH="$HOME/bin:$PATH"' >> ~/.zshrc echo -e "${YELLOW}$HOME/bin added to PATH. Please restart your terminal or run 'source ~/.bashrc' or 'source ~/.zshrc'.${NC}" fi fi else echo -e "${RED}Failed to install client. Try running with sudo.${NC}" exit 1 fi # Create default configuration CONFIG_DIR="$HOME/.exp" mkdir -p "$CONFIG_DIR" if [ ! -f "$CONFIG_DIR/config" ]; then echo -e "\n${YELLOW}Creating default configuration...${NC}" cat > "$CONFIG_DIR/config" << EOF username= EOF echo -e "${GREEN}Default configuration created at $CONFIG_DIR/config${NC}" fi if [ ! -f "$CONFIG_DIR/token" ]; then touch "$CONFIG_DIR/token" echo -e "${GREEN}Token file created at $CONFIG_DIR/token${NC}" echo -e "${YELLOW}Please login using 'exp login ' to set your token.${NC}" fi echo -e "\n${GREEN}╔══════════════════════════════════════════════════════════════╗${NC}" echo -e "${GREEN}║ 🎉 Installation Complete! ║${NC}" echo -e "${GREEN}╚══════════════════════════════════════════════════════════════╝${NC}" echo -e "\n${YELLOW}📋 Available Commands:${NC}" echo -e "${GREEN} 🔐 Login:${NC} ${YELLOW}exp login ${NC}" echo -e "${GREEN} 📁 Initialize:${NC} ${YELLOW}exp init [description] [private]${NC}" echo -e "${GREEN} 🔄 Change Repo:${NC} ${YELLOW}exp change-repo ${NC}" echo -e "${GREEN} 📊 Status:${NC} ${YELLOW}exp status${NC}" echo -e "${GREEN} 📤 Upload:${NC} ${YELLOW}exp upload [--path ] [--replace]${NC}" echo -e "${GREEN} 🏷️ Release:${NC} ${YELLOW}exp release [description] [file]${NC}" echo -e "${GREEN} 🗑️ Delete:${NC} ${YELLOW}exp delete [path]${NC}" echo -e "${GREEN} 🏷️ Del Release:${NC} ${YELLOW}exp delete-release <tag>${NC}" echo -e "${GREEN} ❓ Help:${NC} ${YELLOW}exp --help${NC}" echo -e "\n${YELLOW}💡 Quick Start:${NC}" echo -e "${GREEN}1.${NC} Login to your account: ${YELLOW}exp login your_username your_password${NC}" echo -e "${GREEN}2.${NC} Initialize repository: ${YELLOW}exp init my-project \"My awesome project\"${NC}" echo -e "${GREEN}3.${NC} Upload your files: ${YELLOW}exp upload ./src${NC}" echo -e "${GREEN}4.${NC} Create a release: ${YELLOW}exp release v1-0-0 \"First Release\"${NC}" echo -e "\n${YELLOW}💡 Switch Repository:${NC}" echo -e "${GREEN}•${NC} Change active repo: ${YELLOW}exp change-repo admin existing-project${NC}" echo -e "\n${GREEN}🚀 Thank you for using Exploit.or.id CLI!${NC}" echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"