# 函数:将 IP 地址转换为二进制格式 functionip_to_binary() { local ip=$1 local binary="" local IFS='.' local octets=($ip) for octet in"${octets[@]}"; do local bin_octet="" local num=$octet for (( i=0; i<8; i++ )); do bin_octet=$((num % 2))$bin_octet num=$((num / 2)) done binary+=$bin_octet done echo$binary }