diff --git a/hey403/utils/dns_utils.py b/hey403/utils/dns_utils.py index ef274a5..ae60726 100644 --- a/hey403/utils/dns_utils.py +++ b/hey403/utils/dns_utils.py @@ -44,10 +44,11 @@ def get_current_dns(self) -> str: elif self.platform == "Linux": result = subprocess.check_output( - ["nmcli", "-t", "-f", "IP4.DNS", "connection", "show", "--active"], - text=True, - ) - return result.strip() or "Unknown" + ["nmcli", "device", "show"], + text=True + ).splitlines() + res = [line[13:].strip() for line in result if line.startswith('IP4.DNS')] + return res[0].strip() or "Unknown" elif self.platform == "Darwin": result = subprocess.check_output( diff --git a/packaging/linux/hey403 b/packaging/linux/hey403 new file mode 100755 index 0000000..96dd8be Binary files /dev/null and b/packaging/linux/hey403 differ diff --git a/packaging/linux/hey403-linux.tar.gz b/packaging/linux/hey403-linux.tar.gz new file mode 100644 index 0000000..be0bf9a Binary files /dev/null and b/packaging/linux/hey403-linux.tar.gz differ diff --git a/packaging/linux/install.sh b/packaging/linux/install.sh new file mode 100755 index 0000000..34330cf --- /dev/null +++ b/packaging/linux/install.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# Author: Diramid +# Version: v1.2.0 +# Date: 2025-03-7 +# Description: hey403 installation script +# Usage: ./install.sh + +GREEN="\e[32m" +YELLOW="\e[33m" +NC="\e[0m" + +if [[ $EUID -ne 0 ]]; then + echo -e "${YELLOW}WARNING: You should run this script as the root user.${NC}" + read -t 15 -r -p "Do you want to continue as root? (Y/n): " choice + echo + choice=${choice:-Y} + + if [[ ${choice} =~ ^[Yy]$ ]]; then + echo -e "${GREEN}INFO: Running script with root privileges" + sudo "${0}" "$0" + exit 0 + else + exit 1 + fi + +fi + +SCRIPT_NAME="hey403" +DEST="/usr/local/bin" + +echo -e "${GREEN}INFO: Starting the hey403 installation process...${NC}" +echo -e "${GREEN}INFO: Moving files...${NC}" + +sudo cp "${SCRIPT_NAME}" "${DEST}" + +echo -e "${GREEN}INFO: Installation completed successfully!${NC}"