关键词:Kali Linux download, Kali Linux 官方下载, Kali Linux 镜像站点, Kali Linux 官方网站, Kali Linux 下载地址, Kali Linux 官方源地址, Kali Linux 下载教程, Kali Linux 官方镜像, Kali Linux 官网下载, Kali Linux 官方站点地址
For English:Kali Linux Download Websites and Mirror Sites Collection
# 添加国内镜像源(以清华为例) deb https://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling main non-free contrib deb-src https://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling main non-free contrib
这些镜像站点可以为您提供快速稳定的 Kali Linux 下载体验。建议根据您的地理位置和网络环境选择最适合的镜像站点。
# Kali Linux Smart Download Script # Automatically detects language, country, and OS to select the fastest mirror
# Colors for output RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' BLUE='\033[0;34m' PURPLE='\033[0;35m' CYAN='\033[0;36m' NC='\033[0m' # No Color
# Function to find fastest mirror find_fastest_mirror() { echo -e "${GREEN}[INFO]${NC} Finding the fastest mirror..." echo ""
local fastest_time=999999 local fastest_mirror="" local mirror_name=""
# Test Chinese mirrors if in China or Chinese language if [[ "$COUNTRY" == "CN" ]] || [[ "$LANGUAGE" == "zh" ]]; then echo -e "${PURPLE}[Testing Chinese Mirrors]${NC}" for name in "${!MIRRORS_CN[@]}"; do local url="${MIRRORS_CN[$name]}" test_mirror_speed "$url" local result=$? if [ $result -lt $fastest_time ] && [ $result -ne 999 ]; then fastest_time=$result fastest_mirror=$url mirror_name=$name fi done echo "" fi
# Test global mirrors echo -e "${PURPLE}[Testing Global Mirrors]${NC}" for name in "${!MIRRORS_GLOBAL[@]}"; do local url="${MIRRORS_GLOBAL[$name]}" test_mirror_speed "$url" local result=$? if [ $result -lt $fastest_time ] && [ $result -ne 999 ]; then fastest_time=$result fastest_mirror=$url mirror_name=$name fi done
if [ -n "$fastest_mirror" ]; then SELECTED_MIRROR=$fastest_mirror echo "" echo -e "${GREEN}[SUCCESS]${NC} Fastest mirror selected: ${BLUE}$mirror_name${NC} (${fastest_time}ms)" echo -e "${BLUE}URL:${NC} $SELECTED_MIRROR" else echo -e "${RED}[ERROR]${NC} No working mirror found. Using official mirror." SELECTED_MIRROR="${MIRRORS_GLOBAL[official]}" fi echo "" }
# Function to select Kali version select_kali_version() { echo -e "${GREEN}[INFO]${NC} Select Kali Linux version:" echo ""
local counter=1 local versions_list=()
for version in "${!KALI_VERSIONS[@]}"; do echo -e "${counter}. ${YELLOW}${version}${NC} - ${KALI_VERSIONS[$version]}" versions_list[$counter]=$version ((counter++)) done
if [[ $choice -ge 1 && $choice -le ${#versions_list[@]} ]]; then SELECTED_VERSION="${versions_list[$choice]}" echo -e "${GREEN}[SELECTED]${NC} Version: $SELECTED_VERSION" else echo -e "${YELLOW}[DEFAULT]${NC} Using default version" SELECTED_VERSION="default" fi
echo "" }
# Function to select download directory select_download_directory() { echo -e "${GREEN}[INFO]${NC} Select download directory:" echo ""
# Default download locations local default_dir="" if [[ "$OS_TYPE" == "Windows" ]]; then default_dir="$HOME/Downloads" elif [[ "$OS_TYPE" == "macOS" ]]; then default_dir="$HOME/Downloads" else default_dir="$HOME/Downloads" fi
echo -e "Default directory: ${BLUE}$default_dir${NC}" echo -e "Press Enter to use default, or enter custom path:" read -r custom_dir
if [ -n "$custom_dir" ]; then DOWNLOAD_DIR="$custom_dir" else DOWNLOAD_DIR="$default_dir" fi
# Create directory if it doesn't exist mkdir -p "$DOWNLOAD_DIR"
# Function to show help show_help() { echo "Kali Linux Smart Download Script" echo "" echo "Usage: $0 [OPTIONS]" echo "" echo "Options:" echo " -h, --help Show this help message" echo " -v, --version Show script version" echo " --auto Run in automatic mode" echo "" echo "Features:" echo " • Automatically detects your location and language" echo " • Tests multiple mirrors to find the fastest one" echo " • Supports multiple Kali Linux versions" echo " • Uses the best available download tool" echo " • Verifies file integrity after download" }
# Function to check dependencies check_dependencies() { echo -e "${GREEN}[INFO]${NC} Checking dependencies..."
local tools=("curl" "wget") local available_tools=()
for tool in "${tools[@]}"; do if command -v "$tool" >/dev/null 2>&1; then echo -e " ✓ ${GREEN}$tool${NC} - Available" available_tools+=("$tool") else echo -e " ✗ ${RED}$tool${NC} - Not found" fi done
# Check download tools local download_tools=("aria2c" "axel" "wget" "curl") local download_available=0
for tool in "${download_tools[@]}"; do if command -v "$tool" >/dev/null 2>&1; then echo -e " ✓ ${GREEN}$tool${NC} - Available (download tool)" download_available=1 fi done
if [ $download_available -eq 0 ]; then echo -e "${RED}[ERROR]${NC} No download tool available!" echo -e "Please install one of: aria2c, axel, wget, curl" exit 1 fi
echo "" }
# Main function main() { # Parse command line arguments case "$1" in -h|--help) show_help exit 0 ;; -v|--version) echo "Kali Linux Smart Download Script v$SCRIPT_VERSION" exit 0 ;; --auto) AUTO_MODE=1 ;; *) AUTO_MODE=0 ;; esac
# Print banner print_banner
# Check dependencies check_dependencies
# Detect system information detect_system
# Find fastest mirror find_fastest_mirror
# Select Kali version if [ $AUTO_MODE -eq 0 ]; then select_kali_version else SELECTED_VERSION="default" echo -e "${YELLOW}[AUTO]${NC} Using default version" fi
# Select download directory if [ $AUTO_MODE -eq 0 ]; then select_download_directory else DOWNLOAD_DIR="$HOME/Downloads" mkdir -p "$DOWNLOAD_DIR" echo -e "${YELLOW}[AUTO]${NC} Using default directory: $DOWNLOAD_DIR" fi
# Construct download URL construct_download_url
# Show summary show_summary
# Confirm download if [ $AUTO_MODE -eq 0 ]; then echo -e "${BLUE}Start download? (y/N):${NC} " read -r confirm if [[ ! "$confirm" =~ ^[Yy]$ ]]; then echo -e "${YELLOW}[CANCELLED]${NC} Download cancelled by user" exit 0 fi fi
# Download file download_file
# Final message echo "" echo -e "${GREEN}[COMPLETED]${NC} Kali Linux download finished successfully!" echo -e "${BLUE}Next steps:${NC}" echo -e " 1. Verify the checksum matches official values" echo -e " 2. Write the ISO to a USB drive using Rufus, Etcher, or dd" echo -e " 3. Boot from the USB and install Kali Linux" echo "" }
# Run main function main "$@"
Usage Instructions
1. Save the script
1 2 3
# Save as kali-downloader.sh nano kali-downloader.sh # Paste the script content and save
./kali-downloader.sh --help # Show help ./kali-downloader.sh --version # Show version ./kali-downloader.sh --auto # Automatic mode
Environment Variables:
1 2
export KALI_VERSION="everything" # Set default version export DOWNLOAD_DIR="/custom/path" # Set custom download directory
This script provides an intelligent, automated way to download Kali Linux from the fastest available mirror based on your location and system configuration.