#!/usr/bin/env bash export LC_ALL=C.UTF-8 export LANG=en_US.UTF-8 YELLOW='\e[33m' GREEN='\e[32m' CYAN='\e[36m' PINK='\e[35m' RED='\e[31m' RESET='\e[0m' detect_os() { if [ -f /etc/almalinux-release ]; then cat /etc/almalinux-release elif [ -f /etc/rocky-release ]; then cat /etc/rocky-release elif [ -f /etc/centos-release ]; then cat /etc/centos-release elif [ -f /etc/redhat-release ]; then cat /etc/redhat-release elif [ -f /etc/lsb-release ]; then . /etc/lsb-release 2>/dev/null && echo "${DISTRIB_DESCRIPTION:-Ubuntu}" elif [ -f /etc/debian_version ]; then echo "Debian $(cat /etc/debian_version)" elif [ -f /etc/os-release ]; then . /etc/os-release 2>/dev/null && echo "${PRETTY_NAME:-Linux}" else uname -s fi } spinner() { local duration=${1:-12} local delay=0.08 local spinstr='|/-\' local text="Lisanslama işlemi devam ediyor, lütfen bekleyiniz... Kurulum sonrası bir kaç dakika içerisinde panelinizde güncellenir.... " local printed="" local start_time=$(date +%s) local i=0 while (( $(date +%s) - start_time < duration )); do for ((s=0; s<${#spinstr}; s++)); do # yazıyı harf harf ekle if [ $i -lt ${#text} ]; then printed="${printed}${text:$i:1}" ((i++)) fi printf "\r${CYAN}[${spinstr:$s:1}]${RESET} %s" "$printed" sleep $delay done done printf "\r${GREEN}[✓]${RESET} %s\n" "$text" } spinner_wait() { local pid="$1" local delay=0.10 local spinstr='|/-\' local text="Lisanslama işlemi devam ediyor, lütfen bekleyiniz... " local i=0 while kill -0 "$pid" 2>/dev/null; do printf "\r${CYAN}[${spinstr:$((i % 4)):1}]${RESET} %s" "$text" i=$((i + 1)) sleep "$delay" done wait "$pid" local rc=$? if [ "$rc" -eq 0 ]; then printf "\r${GREEN}[✓]${RESET} Lisanslama işlemi tamamlandı. \n" else printf "\r${RED}[✖]${RESET} Lisanslama işlemi başarısız oldu. \n" fi return "$rc" } is_bad_response() { local value="$1" local first_line first_line=$(printf '%s' "$value" | tr -d '\r' | sed -n '/[^[:space:]]/{p;q;}') if [ -z "$first_line" ]; then return 0 fi if printf '%s' "$value" | grep -Eiq '|404|Oops!|Something Went wrong|Internal Server Error|Fatal error|Warning:'; then return 0 fi if [ "${#first_line}" -gt 160 ]; then return 0 fi return 1 } fetch_text() { local url="$1" local fallback="${2:-}" local value value=$(curl -4 -fsSL --connect-timeout 8 --max-time 20 "$url" 2>/dev/null || true) value=$(printf '%s' "$value" | tr -d '\r' | sed -n '/[^[:space:]]/{p;q;}' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//') if is_bad_response "$value"; then printf '%s' "$fallback" return fi printf '%s' "$value" } normalize_brand() { local value="$1" local fallback="${2:-License Portal}" value=$(printf '%s' "$value" | tr -d '\r\n' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//') if is_bad_response "$value"; then printf '%s' "$fallback" return fi case "$(printf '%s' "$value" | tr '[:upper:]' '[:lower:]')" in ""|"licenseapis.com"|"license api service"|"proxylicense.net"|"proxy license"|"724license.com"|"license seller") printf '%s' "$fallback" ;; *) printf '%s' "$value" ;; esac } safe_command_name() { local value="$1" value=$(printf '%s' "$value" | tr -d '\r\n' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//') if is_bad_response "$value" || ! [[ "$value" =~ ^[A-Za-z0-9_-]{2,32}$ ]]; then printf '%s' "license" return fi printf '%s' "$value" } license_status_response() { local service="$1" curl -4 -sSL --connect-timeout 8 --max-time 20 \ "$API_BASE/lic/status.php?service=${service}&ip=${SERVER_IP}&format=env" 2>/dev/null || true } show_result() { local logfile="$1" local ok_msg="$2" local rc="${3:-0}" if [ "$rc" -ne 0 ]; then echo -e "${RED}----------------------------------------------------------------------${RESET}" echo -e "${RED} ✖ Lisanslama işlemi tamamlanamadı.${RESET}" if [ -s "$logfile" ]; then echo -e "${RED}----------------------------------------------------------------------${RESET}" tail -n 20 "$logfile" fi echo -e "${RED}----------------------------------------------------------------------${RESET}" rm -f "$logfile" return 1 fi if [ ! -s "$logfile" ]; then rm -f "$logfile" echo -e "${GREEN}[TAMAMLANDI] ${ok_msg}${RESET}" return fi local content content=$(cat "$logfile") rm -f "$logfile" if echo "$content" | grep -qi 'suspended'; then echo -e "${RED}----------------------------------------------------------------------${RESET}" echo -e "${RED} ✖ LİSANS ASKIYA ALINDI${RESET}" echo -e "${RED}----------------------------------------------------------------------${RESET}" return 1 fi if echo "$content" | grep -Eqi 'license status[[:space:]]*:[[:space:]]*OK|has been installed|installed\. Enjoy|License has been installed|License Expire'; then echo -e "${GREEN}[TAMAMLANDI] ${ok_msg}${RESET}" return 0 fi if echo "$content" | grep -Eqi 'NO LICENSE FOUND|License not found|invalid license|LİSANS BULUNAMADI|403 Forbidden|404 Not Found|status:403|status:404|'; then echo -e "${RED}----------------------------------------------------------------------${RESET}" echo -e "${RED} ✖ Lisans doğrulaması başarısız oldu.${RESET}" echo -e "${RED}----------------------------------------------------------------------${RESET}" return 1 fi echo -e "${GREEN}[TAMAMLANDI] ${ok_msg}${RESET}" } license_check() { local resp="$1" local today="$2" if is_bad_response "$resp"; then echo "Bilinmiyor" echo "LİSANSSIZ" return fi if printf '%s\n' "$resp" | grep -q '^WL_'; then local WL_STATUS="" WL_EXPIRES_AT="" WL_MESSAGE="" local safe_env safe_env=$(printf '%s\n' "$resp" | grep -E "^WL_[A-Z0-9_]+='[^']*'$" || true) if [ -n "$safe_env" ]; then eval "$safe_env" fi case "$(printf '%s' "$WL_STATUS" | tr '[:upper:]' '[:lower:]')" in lifetime) echo "Lifetime ∞" echo "Ömür Boyu" return ;; active) resp="$WL_EXPIRES_AT" ;; suspended) echo "${WL_EXPIRES_AT:-Bilinmiyor}" echo "ASKIYA_ALINDI" return ;; expired) echo "${WL_EXPIRES_AT:-Bilinmiyor}" echo "DOLMUŞ" return ;; maintenance|invalid_service|invalid_ip) echo "Bilinmiyor" echo "BAKIM" return ;; *) echo "Bilinmiyor" echo "LİSANSSIZ" return ;; esac fi if [[ "$resp" == "Lifetime" ]]; then echo "Lifetime ∞" echo "Ömür Boyu" return fi if [[ "$resp" == "Unknown" ]] || [[ -z "$resp" ]]; then echo "Bilinmiyor" echo "LİSANSSIZ" return fi local expire=$(echo "$resp" | tr '-' '/') local today_e=$(date -d "$today" +%s 2>/dev/null || echo "") local exp_e=$(date -d "$expire" +%s 2>/dev/null || echo "") if [[ -n "$today_e" && -n "$exp_e" ]]; then local diff=$(( (exp_e - today_e) / 86400 )) echo "$expire" if [[ $diff -lt 0 ]]; then echo "DOLMUŞ" else echo "$diff gün kaldı" fi else echo "$expire" echo "Bilinmiyor" fi } license_exit_check() { local remaining="$1" local product="$2" local today="$3" if [[ "$remaining" == "LİSANSSIZ" ]]; then echo -e "${PINK}Bugün :${RESET} $today" echo "" echo -e "${RED}----------------------------------------------------------------------${RESET}" echo -e "${RED} ✖ LİSANSSIZ - ${product} lisansı bu IP için bulunamadı.${RESET}" echo -e "${RED} Lütfen satıcınızla iletişime geçiniz.${RESET}" echo -e "${RED}----------------------------------------------------------------------${RESET}" exit 1 fi if [[ "$remaining" == "ASKIYA_ALINDI" ]]; then echo -e "${PINK}Bugün :${RESET} $today" echo "" echo -e "${RED}----------------------------------------------------------------------${RESET}" echo -e "${RED} ✖ LİSANS ASKIYA ALINMIŞ - ${product}${RESET}" echo -e "${RED} Lütfen satıcınızla iletişime geçiniz.${RESET}" echo -e "${RED}----------------------------------------------------------------------${RESET}" exit 1 fi if [[ "$remaining" == "BAKIM" ]]; then echo -e "${PINK}Bugün :${RESET} $today" echo "" echo -e "${RED}----------------------------------------------------------------------${RESET}" echo -e "${RED} ✖ Lisans durumu şu an doğrulanamıyor.${RESET}" echo -e "${RED} Lütfen kısa süre sonra tekrar deneyiniz.${RESET}" echo -e "${RED}----------------------------------------------------------------------${RESET}" exit 1 fi if [[ "$remaining" == "DOLMUŞ" ]]; then echo -e "${PINK}Bugün :${RESET} $today" echo "" echo -e "${RED}----------------------------------------------------------------------${RESET}" echo -e "${RED} ✖ LİSANS SÜRESİ DOLMUŞ - ${product}${RESET}" echo -e "${RED} Yenileme için satıcınızla iletişime geçiniz.${RESET}" echo -e "${RED}----------------------------------------------------------------------${RESET}" exit 1 fi } CURRENT_YEAR=$(date +%Y) clear 2>/dev/null || true API_BASE="https://li.sitesiparis.com" CURRENT_SERVICE="unknown" SERVER_IP=$(curl -4 -fsS --connect-timeout 5 --max-time 10 ifconfig.me 2>/dev/null || curl -4 -fsS --connect-timeout 5 --max-time 10 https://api.ipify.org 2>/dev/null || echo 'Bilinmiyor') BRAND_RAW=$(fetch_text "$API_BASE/lic/brander.php?service=${CURRENT_SERVICE}&ip=$SERVER_IP" "") SITE_BRAND=$(fetch_text "$API_BASE/lic/site_brand.php" "License Portal") BRAND=$(normalize_brand "$BRAND_RAW" "$(normalize_brand "$SITE_BRAND" "License Portal")") BRAND_API_RAW=$(fetch_text "$API_BASE/lic/reseller_url.php?service=${CURRENT_SERVICE}&ip=$SERVER_IP" "") BRAND_API=$(normalize_brand "$BRAND_API_RAW" "$BRAND") HOSTNAME_VAL=$(hostname 2>/dev/null || echo 'Bilinmiyor') HOSTNAME_VAL=$(printf '%s' "$HOSTNAME_VAL" | tr -d '\r\n') OS_VERSION=$(detect_os 2>/dev/null | xargs 2>/dev/null || echo 'Linux') OS_VERSION=$(printf '%s' "$OS_VERSION" | tr -d '\r\n') KERNEL_VERSION=$(uname -r 2>/dev/null || echo 'Bilinmiyor') KERNEL_VERSION=$(printf '%s' "$KERNEL_VERSION" | tr -d '\r\n') FIELD_WIDTH=20 print_row() { local label="$1" local value="$2" printf "%b%-${FIELD_WIDTH}s%b : %s\n" "${GREEN}" "$label" "${RESET}" "$value" } echo -e "${YELLOW}---------------------- Lisans Sistemi Başlatıldı ----------------------${RESET}" echo -e "${YELLOW} ${BRAND_API} lisans sistemini kullandığınız için teşekkürler!${RESET}" echo -e "${YELLOW}----------------------------------------------------------------------${RESET}" echo "" print_row "Sağlayıcı" "$BRAND" print_row "Sunucu IP" "$SERVER_IP" print_row "Hostname" "$HOSTNAME_VAL" print_row "İşletim Sistemi" "$OS_VERSION" print_row "Kernel Versiyonu" "$KERNEL_VERSION" echo "" echo -e "${CYAN}Sorularınız için web sitemiz üzerinden destek talebi açabilirsiniz.${RESET}" echo -e "${YELLOW}----------------------------------------------------------------------${RESET}" echo -e "${YELLOW} Telif Hakkı 2019-${CURRENT_YEAR} ${BRAND_API} - Tüm hakları saklıdır.${RESET}" echo -e "${YELLOW}----------------------------------------------------------------------${RESET}" echo "" echo -e "${GREEN}${BRAND} lisans servisi hazır.${RESET}" echo -e "${CYAN}Kullanılabilir servisler: cpanel, litespeed, cloudlinux, imunify360, jetbackup, softaculous, sitepad, plesk, directadmin, whmreseller${RESET}" echo -e "${CYAN}Örnek: bash <(curl -fsSL ${API_BASE}/?service=cpanel)${RESET}" exit 0