diff --git a/ProxySU/MainWindow.xaml b/ProxySU/MainWindow.xaml index 8164d04..b782b88 100644 --- a/ProxySU/MainWindow.xaml +++ b/ProxySU/MainWindow.xaml @@ -5,7 +5,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:ProxySU" mc:Ignorable="d" - Title="ProxySU - v2.4.19-beta1" Height="675" Width="650"> + Title="ProxySU - v2.4.19-beta2" Height="675" Width="650"> diff --git a/ProxySU/MainWindow.xaml.cs b/ProxySU/MainWindow.xaml.cs index ab248ef..3fe2a65 100644 --- a/ProxySU/MainWindow.xaml.cs +++ b/ProxySU/MainWindow.xaml.cs @@ -1116,7 +1116,7 @@ namespace ProxySU if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; } //检测系统是否符合安装要求 11--30 - //检测关闭Selinux及系统组件是否齐全(apt/yum/dnf/systemctl) + //检测关闭Selinux及系统组件是否齐全(apt-get/yum/dnf/systemctl) //安装依赖软件,检测端口,防火墙开启端口 functionResult = ShutDownSelinuxAndSysComponentsDetect(client); if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; } @@ -2422,7 +2422,7 @@ namespace ProxySU functionResult = SoftInstalledIsNoYes(client, "trojan-go", @"/usr/local/bin/trojan-go"); if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; } - //检测关闭Selinux及系统组件是否齐全(apt/yum/dnf/systemctl)11--30 + //检测关闭Selinux及系统组件是否齐全(apt-get/yum/dnf/systemctl)11--30 //安装依赖软件,检测端口,防火墙开启端口 functionResult = ShutDownSelinuxAndSysComponentsDetect(client); if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; } @@ -3049,7 +3049,7 @@ namespace ProxySU functionResult = SoftInstalledIsNoYes(client, "trojan", @"/usr/local/bin/trojan"); if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; } - //检测关闭Selinux及系统组件是否齐全(apt/yum/dnf/systemctl)11--30 + //检测关闭Selinux及系统组件是否齐全(apt-get/yum/dnf/systemctl)11--30 //安装依赖软件,检测端口,防火墙开启端口 functionResult = ShutDownSelinuxAndSysComponentsDetect(client); if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; } @@ -3614,7 +3614,7 @@ namespace ProxySU functionResult = SoftInstalledIsNoYes(client, "caddy", @"/usr/bin/caddy"); if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; } - //检测关闭Selinux及系统组件是否齐全(apt/yum/dnf/systemctl)11--30 + //检测关闭Selinux及系统组件是否齐全(apt-get/yum/dnf/systemctl)11--30 //安装依赖软件,检测端口,防火墙开启端口 functionResult = ShutDownSelinuxAndSysComponentsDetect(client); if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; } @@ -4005,7 +4005,7 @@ namespace ProxySU functionResult = SoftInstalledIsNoYes(client, "server.py", @"/usr/local/shadowsocks/server.py"); if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; } - //检测关闭Selinux及系统组件是否齐全(apt/yum/dnf/systemctl)11--30 + //检测关闭Selinux及系统组件是否齐全(apt-get/yum/dnf/systemctl)11--30 //安装依赖软件,检测端口,防火墙开启端口 functionResult = ShutDownSelinuxAndSysComponentsDetect(client); if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; } @@ -4387,7 +4387,7 @@ namespace ProxySU functionResult = SoftInstalledIsNoYes(client, "ss-server", @"/usr/local/bin/ss-server"); if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; } - //检测关闭Selinux及系统组件是否齐全(apt/yum/dnf/systemctl)11--30 + //检测关闭Selinux及系统组件是否齐全(apt-get/yum/dnf/systemctl)11--30 //安装依赖软件,检测端口,防火墙开启端口 functionResult = ShutDownSelinuxAndSysComponentsDetect(client); if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; } @@ -4964,7 +4964,7 @@ namespace ProxySU functionResult = SoftInstalledIsNoYes(client, "mtg", @"/usr/local/bin/mtg"); if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; } - //检测关闭Selinux及系统组件是否齐全(apt/yum/dnf/systemctl)11--30 + //检测关闭Selinux及系统组件是否齐全(apt-get/yum/dnf/systemctl)11--30 //安装依赖软件,检测端口,防火墙开启端口 functionResult = ShutDownSelinuxAndSysComponentsDetect(client); if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; } @@ -5634,7 +5634,7 @@ namespace ProxySU functionResult = RootAuthorityDetect(client); if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; } - sshShellCommand = @"command -v apt"; + sshShellCommand = @"command -v apt-get"; currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); getApt = !String.IsNullOrEmpty(currentShellCommandResult); @@ -5649,8 +5649,8 @@ namespace ProxySU //设置安装软件所用的命令格式 if (getApt == true) { - sshCmdUpdate = @"apt update"; - //sshCmdInstall = @"apt -y install "; + sshCmdUpdate = @"apt-get update"; + //sshCmdInstall = @"apt-get -y install "; } else if (getDnf == true) { @@ -6227,10 +6227,10 @@ namespace ProxySU sshShellCommand = @"systemctl disable caddy"; currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); - //检测系统是否支持yum 或 apt或zypper + //检测系统是否支持yum 或 apt-get或zypper //如果不存在组件,则命令结果为空,string.IsNullOrEmpty值为真, - sshShellCommand = @"command -v apt"; + sshShellCommand = @"command -v apt-get"; currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); bool getApt = ! String.IsNullOrEmpty(currentShellCommandResult); @@ -6254,8 +6254,8 @@ namespace ProxySU //设置安装软件所用的命令格式 if (getApt == true) { - //sshCmdUpdate = @"apt update"; - sshCmdRemove = @"apt -y autoremove --purge "; + //sshCmdUpdate = @"apt-get update"; + sshCmdRemove = @"apt-get -y autoremove --purge "; } else if (getDnf == true) { @@ -7645,14 +7645,14 @@ namespace ProxySU return true; } - //检测关闭Selinux及系统组件是否齐全(apt/yum/dnf/systemctl)11--30 + //检测关闭Selinux及系统组件是否齐全(apt-get/yum/dnf/systemctl)11--30 //安装依赖软件,检测端口,防火墙开启端口,检测是否为纯ipv6主机,若是则设置Nat64网关 //functionResult = ShutDownSelinuxAndSysComponentsDetect(client); //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; } private bool ShutDownSelinuxAndSysComponentsDetect(SshClient client) { - //检测系统是否支持yum 或 apt或zypper,且支持Systemd + //检测系统是否支持yum 或 apt-get或zypper,且支持Systemd //如果不存在组件,则命令结果为空,String.IsNullOrEmpty值为真 //取反则getApt,getDnf,getYum,getSystem,getGetenforce为假 //不存在组件,则为假 @@ -7662,7 +7662,7 @@ namespace ProxySU currentStatus = Application.Current.FindResource("DisplayInstallInfo_CheckSystemRequirements").ToString(); MainWindowsShowInfo(currentStatus); - sshShellCommand = @"command -v apt"; + sshShellCommand = @"command -v apt-get"; currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); getApt = ! String.IsNullOrEmpty(currentShellCommandResult); @@ -7689,11 +7689,11 @@ namespace ProxySU bool getGetenforce = ! String.IsNullOrEmpty(currentShellCommandResult); - //没有安装apt,也没有安装dnf\yum,也没有安装zypper,或者没有安装systemd的,不满足安装条件 - //也就是apt ,dnf\yum, zypper必须安装其中之一,且必须安装Systemd的系统才能安装。 + //没有安装apt-get,也没有安装dnf\yum,也没有安装zypper,或者没有安装systemd的,不满足安装条件 + //也就是apt-get ,dnf\yum, zypper必须安装其中之一,且必须安装Systemd的系统才能安装。 if ((getApt == false && getDnf == false && getYum == false) || getSystemd == false) { - //******"系统缺乏必要的安装组件如:apt||dnf||yum||zypper||Syetemd,主机系统推荐使用:CentOS 7/8,Debian 8/9/10,Ubuntu 16.04及以上版本"****** + //******"系统缺乏必要的安装组件如:apt-get||dnf||yum||zypper||Syetemd,主机系统推荐使用:CentOS 7/8,Debian 8/9/10,Ubuntu 16.04及以上版本"****** MessageBox.Show(Application.Current.FindResource("MessageBoxShow_MissingSystemComponents").ToString()); //******"系统环境不满足要求,安装失败!!"****** @@ -7716,8 +7716,8 @@ namespace ProxySU //设置安装软件所用的命令格式 if (getApt == true) { - sshCmdUpdate = @"apt update"; - sshCmdInstall = @"apt -y install dnsutils"; + sshCmdUpdate = @"apt-get update"; + sshCmdInstall = @"apt-get -y install dnsutils"; } else if (getDnf == true) { @@ -7740,8 +7740,8 @@ namespace ProxySU //设置安装软件所用的命令格式 if (getApt == true) { - sshCmdUpdate = @"apt update"; - sshCmdInstall = @"apt -y install "; + sshCmdUpdate = @"apt-get update"; + sshCmdInstall = @"apt-get -y install "; } else if (getDnf == true) { @@ -7882,7 +7882,7 @@ namespace ProxySU sshShellCommand = $"systemctl disable {cmdResultArry443[0]}"; currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); - sshShellCommand = $"kill -9 {cmdResultArry443[3]}"; + sshShellCommand = $"pkill {cmdResultArry443[0]}"; currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); } @@ -7896,9 +7896,29 @@ namespace ProxySU sshShellCommand = $"systemctl disable {cmdResultArry80[0]}"; currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); - sshShellCommand = $"kill -9 {cmdResultArry80[3]}"; + sshShellCommand = $"pkill {cmdResultArry80[0]}"; currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); } + testPort80 = string.Empty; + testPort443 = string.Empty; + + sshShellCommand = @"lsof -n -P -i :80 | grep LISTEN"; + currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); + testPort80 = currentShellCommandResult; + + sshShellCommand = @"lsof -n -P -i :443 | grep LISTEN"; + currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); + testPort443 = currentShellCommandResult; + + + if (String.IsNullOrEmpty(testPort80) == false || String.IsNullOrEmpty(testPort443) == false) + { + //****** "端口被占用,安装失败......" ****** + currentStatus = Application.Current.FindResource("DisplayInstallInfo_ErrorPortUsedFail").ToString(); + MainWindowsShowInfo(currentStatus); + //client.Disconnect(); + return false; + } //****** "80/443端口释放完毕!" ****** SetUpProgressBarProcessing(26); currentStatus = Application.Current.FindResource("DisplayInstallInfo_ReleasePortOK").ToString(); @@ -7946,9 +7966,24 @@ namespace ProxySU sshShellCommand = $"systemctl disable {cmdResultArry[0]}"; currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); - sshShellCommand = $"kill -9 {cmdResultArry[3]}"; + sshShellCommand = $"pkill {cmdResultArry[0]}"; currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); + testPort = string.Empty; + + sshShellCommand = $"lsof -n -P -i :{ReceiveConfigurationParameters[1]} | grep LISTEN"; + currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); + testPort = currentShellCommandResult; + + if (String.IsNullOrEmpty(testPort) == false) + { + //****** "端口被占用,安装失败......" ****** + currentStatus = Application.Current.FindResource("DisplayInstallInfo_ErrorPortUsedFail").ToString(); + MainWindowsShowInfo(currentStatus); + //client.Disconnect(); + return false; + } + //****** "端口释放完毕!" ****** SetUpProgressBarProcessing(26); currentStatus = Application.Current.FindResource("DisplayInstallInfo_ReleasePortOKOther").ToString(); @@ -8376,13 +8411,13 @@ namespace ProxySU sshShellCommand = @"echo ""deb [trusted=yes] https://apt.fury.io/caddy/ /"" | tee -a /etc/apt/sources.list.d/caddy-fury.list"; currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); - sshShellCommand = @"apt install -y apt-transport-https"; + sshShellCommand = @"apt-get install -y apt-transport-https"; currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); - sshShellCommand = @"apt update"; + sshShellCommand = @"apt-get update"; currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); - sshShellCommand = @"apt -y install caddy"; + sshShellCommand = @"apt-get -y install caddy"; currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); } @@ -8417,17 +8452,25 @@ namespace ProxySU sshShellCommand = @"yum -y install caddy"; currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); - sshShellCommand = @"sed -i 's/AmbientCapabilities/#AmbientCapabilities/g' /usr/lib/systemd/system/caddy.service"; - currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); - - sshShellCommand = @"sed -i 's/=caddy/=root/g' /usr/lib/systemd/system/caddy.service"; - currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); - - sshShellCommand = @"systemctl daemon-reload"; - currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); + } + string caddyService = @"/lib/systemd/system/caddy.service"; + functionResult = FileCheckExists(client, $"{caddyService}"); + if (functionResult == false) + { + caddyService = @"/usr/lib/systemd/system/caddy.service"; + } + sshShellCommand = $"sed -i 's/AmbientCapabilities/#AmbientCapabilities/g' {caddyService}"; + currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); + + sshShellCommand = $"sed -i 's/=caddy/=root/g' {caddyService}"; + currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); + + sshShellCommand = @"systemctl daemon-reload"; + currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); + //sshShellCommand = @"find / -name caddy"; //sshShellCommand = @"if [[ -f /usr/bin/caddy ]];then echo '1';else echo '0'; fi"; //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); diff --git a/ProxySU/ResultClientInformation.xaml b/ProxySU/ResultClientInformation.xaml index 87d10f4..90947c2 100644 --- a/ProxySU/ResultClientInformation.xaml +++ b/ProxySU/ResultClientInformation.xaml @@ -13,7 +13,7 @@ - + @@ -93,7 +93,7 @@ - + diff --git a/ProxySU/ResultClientInformation.xaml.cs b/ProxySU/ResultClientInformation.xaml.cs index 8195c29..b41a868 100644 --- a/ProxySU/ResultClientInformation.xaml.cs +++ b/ProxySU/ResultClientInformation.xaml.cs @@ -105,6 +105,8 @@ namespace ProxySU TextBoxEncryption.Text = "none"; TextBoxTransmission.Text = "tcp"; TextBoxCamouflageType.Text = "none"; + //TLS的Host /Quic 加密方式 + TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4]; TextBoxTLS.Text = "tls"; ShowHostName(); ShowPathV2ray(); @@ -113,6 +115,8 @@ namespace ProxySU { TextBoxTransmission.Text = "tcp"; TextBoxCamouflageType.Text = "none"; + //TLS的Host /Quic 加密方式 + TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4]; TextBoxTLS.Text = "tls"; ShowHostName(); ShowPathV2ray(); @@ -123,6 +127,8 @@ namespace ProxySU TextBoxTransmission.Text = "tcp"; TextBoxCamouflageType.Text = "none"; + //TLS的Host /Quic 加密方式 + TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4]; TextBoxEncryption.Text = "none"; TextBoxTLS.Text = "xtls"; HideAlterId(); @@ -136,6 +142,8 @@ namespace ProxySU TextBoxTransmission.Text = "tcp"; TextBoxCamouflageType.Text = "none"; + //TLS的Host /Quic 加密方式 + TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4]; TextBoxEncryption.Text = "none"; TextBoxTLS.Text = "tls"; HideAlterId(); @@ -149,6 +157,8 @@ namespace ProxySU TextBoxTransmission.Text = "ws"; TextBoxCamouflageType.Text = "none"; + //TLS的Host /Quic 加密方式 + TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4]; TextBoxEncryption.Text = "none"; TextBoxTLS.Text = "tls"; HideAlterId(); @@ -162,6 +172,8 @@ namespace ProxySU TextBoxTransmission.Text = "h2"; TextBoxCamouflageType.Text = "none"; + //TLS的Host /Quic 加密方式 + TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4]; TextBoxEncryption.Text = "none"; TextBoxTLS.Text = "tls"; HideAlterId(); @@ -182,6 +194,8 @@ namespace ProxySU TextBoxEncryption.Text = "none"; TextBoxTransmission.Text = "ws"; TextBoxCamouflageType.Text = "none"; + //TLS的Host /Quic 加密方式 + TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4]; TextBoxTLS.Text = "tls"; ShowHostName(); ShowPathV2ray(); @@ -191,6 +205,8 @@ namespace ProxySU TextBoxEncryption.Text = "none"; TextBoxTransmission.Text = "ws"; TextBoxCamouflageType.Text = "none"; + //TLS的Host /Quic 加密方式 + TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4]; TextBoxTLS.Text = "tls"; ShowHostName(); ShowPathV2ray(); @@ -199,6 +215,8 @@ namespace ProxySU { TextBoxTransmission.Text = "ws"; TextBoxCamouflageType.Text = "none"; + //TLS的Host /Quic 加密方式 + TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4]; TextBoxTLS.Text = "tls"; ShowHostName(); ShowPathV2ray(); @@ -208,6 +226,8 @@ namespace ProxySU TextBoxEncryption.Text = "none"; TextBoxTransmission.Text = "h2"; TextBoxCamouflageType.Text = "none"; + //TLS的Host /Quic 加密方式 + TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4]; TextBoxTLS.Text = "tls"; ShowHostName(); ShowPathV2ray(); @@ -226,6 +246,8 @@ namespace ProxySU { TextBoxTransmission.Text = "h2"; TextBoxCamouflageType.Text = "none"; + //TLS的Host /Quic 加密方式 + TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4]; TextBoxTLS.Text = "tls"; ShowHostName(); ShowPathV2ray(); @@ -674,6 +696,8 @@ namespace ProxySU TextBoxEncryption.Text = "none"; TextBoxTransmission.Text = "tcp"; TextBoxCamouflageType.Text = "none"; + //TLS的Host /Quic 加密方式 + TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4]; TextBoxTLS.Text = "xtls"; HideAlterId(); ShowHostName(); @@ -693,6 +717,8 @@ namespace ProxySU TextBoxEncryption.Text = "none"; TextBoxTransmission.Text = "tcp"; TextBoxCamouflageType.Text = "none"; + //TLS的Host /Quic 加密方式 + TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4]; TextBoxTLS.Text = "tls"; HideAlterId(); ShowHostName(); @@ -711,6 +737,8 @@ namespace ProxySU TextBoxEncryption.Text = "none"; TextBoxTransmission.Text = "ws"; TextBoxCamouflageType.Text = "none"; + //TLS的Host /Quic 加密方式 + TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4]; TextBoxTLS.Text = "tls"; HideAlterId(); ShowHostName(); @@ -725,6 +753,8 @@ namespace ProxySU TextBoxEncryption.Text = "none"; TextBoxTransmission.Text = "tcp"; TextBoxCamouflageType.Text = "http"; + //TLS的Host /Quic 加密方式 + TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4]; TextBoxTLS.Text = "tls"; ShowAlterId(); ShowHostName(); @@ -742,6 +772,8 @@ namespace ProxySU TextBoxEncryption.Text = "none"; TextBoxTransmission.Text = "ws"; TextBoxCamouflageType.Text = "none"; + //TLS的Host /Quic 加密方式 + TextBoxHostQuicEncryption.Text = MainWindow.ReceiveConfigurationParameters[4]; TextBoxTLS.Text = "tls"; ShowAlterId(); ShowHostName(); @@ -965,10 +997,11 @@ namespace ProxySU v2rayNjsonObject["aid"] = TextBoxUUIDextra.Text; //设置额外ID v2rayNjsonObject["net"] = TextBoxTransmission.Text; //设置传输模式 v2rayNjsonObject["type"] = TextBoxCamouflageType.Text; //设置伪装类型 - + if (TextBoxTransmission.Text.Contains("kcp") == true) { v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置mKCP Seed + v2rayNjsonObject["host"] = "";//设置Host } else if (TextBoxTransmission.Text.Contains("quic")==true) { @@ -1649,6 +1682,7 @@ namespace ProxySU if (TextBoxTransmission.Text.Contains("kcp") == true) { v2rayNjsonObject["path"] = TextBoxQuicKeyMkcpSeedPath.Text;//设置mKCP Seed + v2rayNjsonObject["host"] = "";//设置Host } else if (TextBoxTransmission.Text.Contains("quic") == true) { diff --git a/ProxySU/bin/Beta/Beta.zip b/ProxySU/bin/Beta/Beta.zip index 8d3cb3c..deebcf9 100644 Binary files a/ProxySU/bin/Beta/Beta.zip and b/ProxySU/bin/Beta/Beta.zip differ