diff --git a/ProxySU/MainWindow.xaml b/ProxySU/MainWindow.xaml index a4a54a8..1a2c34e 100644 --- a/ProxySU/MainWindow.xaml +++ b/ProxySU/MainWindow.xaml @@ -171,6 +171,7 @@ + diff --git a/ProxySU/MainWindow.xaml.cs b/ProxySU/MainWindow.xaml.cs index 932c053..0e8a90a 100644 --- a/ProxySU/MainWindow.xaml.cs +++ b/ProxySU/MainWindow.xaml.cs @@ -42,6 +42,7 @@ namespace ProxySU //ReceiveConfigurationParameters[4]----domain //ReceiveConfigurationParameters[5]----伪装类型 //ReceiveConfigurationParameters[6]----QUIC密钥 + //ReceiveConfigurationParameters[7]----伪装网站 //public static ConnectionInfo ConnectionInfo; public MainWindow() { @@ -50,7 +51,7 @@ namespace ProxySU RadioButtonNoProxy.IsChecked = true; RadioButtonProxyNoLogin.IsChecked = true; RadioButtonSocks4.Visibility = Visibility.Collapsed; - ReceiveConfigurationParameters = new string[7]; + ReceiveConfigurationParameters = new string[8]; } @@ -726,29 +727,37 @@ namespace ProxySU client.RunCommand("mkdir -p /var/www"); - //currentStatus = "上传Caddy配置文件......"; - //textBlockName.Dispatcher.BeginInvoke(updateAction, textBlockName, progressBar, currentStatus); - //Thread.Sleep(1000); + currentStatus = "上传Caddy配置文件......"; + textBlockName.Dispatcher.BeginInvoke(updateAction, textBlockName, progressBar, currentStatus); + Thread.Sleep(1000); serverConfig = "TemplateConfg\\WebSocketTLSWeb_server_config.caddyfile"; upLoadPath = "/etc/caddy/Caddyfile"; UploadConfig(connectionInfo, serverConfig, upLoadPath); - //string[] splitDomain = ReceiveConfigurationParameters[4].Split('.'); //设置Caddyfile文件中的tls 邮箱 - string emailAddress = ReceiveConfigurationParameters[4]; - string sshCmd = $"email={emailAddress};email=${{email/./@}};sed -i \"s/off/${{email:=\"off\"}}/\" /etc/caddy/Caddyfile"; + string sshCmdEmail = $"email={ReceiveConfigurationParameters[4]};email=${{email/./@}};echo $email";//结尾有回车符 + string email = client.RunCommand(sshCmdEmail).Result.Replace("\n", "");//删除结尾的回车符 + string sshCmd = $"sed -i 's/off/{email}/' {upLoadPath}";//设置Caddyfile中的邮箱 client.RunCommand(sshCmd); - client.RunCommand("sed -i 's/##path##/\\" + ReceiveConfigurationParameters[3] + "/' " + upLoadPath); - client.RunCommand("sed -i 's/##domain##/" + ReceiveConfigurationParameters[4] + "/' " + upLoadPath); + //设置Path + sshCmd = $"sed -i 's/##path##/\\{ReceiveConfigurationParameters[3]}/' {upLoadPath}"; + //MessageBox.Show(sshCmd); + client.RunCommand(sshCmd); + //设置域名 + sshCmd = $"sed -i 's/##domain##/{ReceiveConfigurationParameters[4]}/' {upLoadPath}"; + //MessageBox.Show(sshCmd); + client.RunCommand(sshCmd); + //设置伪装网站 + if (String.IsNullOrEmpty(ReceiveConfigurationParameters[7])==false) + { + sshCmd = $"sed -i 's/##sites##/proxy \\/ {ReceiveConfigurationParameters[7]}/' {upLoadPath}"; + //MessageBox.Show(sshCmd); + client.RunCommand(sshCmd); + } Thread.Sleep(2000); - - //生成安装服务命令中的邮箱 - string sshCmdEmail = $"email={emailAddress};email=${{email/./@}};echo $email"; - string email= client.RunCommand(sshCmdEmail).Result.ToString(); - //MessageBox.Show(email); //安装Caddy服务 - sshCmd = "caddy -service install -agree -conf /etc/caddy/Caddyfile -email " + email; + sshCmd = $"caddy -service install -agree -conf /etc/caddy/Caddyfile -email {email}"; //MessageBox.Show(sshCmd); client.RunCommand(sshCmd); @@ -1196,19 +1205,59 @@ namespace ProxySU using (var client = new SshClient(testconnect)) { client.Connect(); - string cmdTestPort = @"find / -name v2ray"; - MessageBox.Show(cmdTestPort); - string cmdResult = client.RunCommand(cmdTestPort).Result; + //string cmdTestPort = @"find / -name v2ray"; + //MessageBox.Show(cmdTestPort); + //string cmdResult = client.RunCommand(cmdTestPort).Result; + //设置Caddyfile文件中的tls 邮箱 + string upLoadPath = "/etc/caddy/Caddyfile.test"; + string emailAddress = ReceiveConfigurationParameters[4]; + string sshCmdEmail = $"email={emailAddress};email=${{email/./@}};echo $email";//结尾有回车符 + string email = client.RunCommand(sshCmdEmail).Result.Replace("\n",""); + MessageBox.Show(email); + string sshCmd = $"sed -i 's/off/{email}/' {upLoadPath}"; + + MessageBox.Show(sshCmd); + client.RunCommand(sshCmd); + sshCmd = $"sed -i 's/##path##/\\{ReceiveConfigurationParameters[3]}/' {upLoadPath}"; + MessageBox.Show(sshCmd); + client.RunCommand(sshCmd); + //sshCmd = "sed -i 's/##path##/\\" + ReceiveConfigurationParameters[3] + "/' " + upLoadPath; + //MessageBox.Show(sshCmd); + //client.RunCommand("sed -i 's/##path##/\\" + ReceiveConfigurationParameters[3] + "/' " + upLoadPath); + sshCmd = $"sed -i 's/##domain##/{ReceiveConfigurationParameters[4]}/' {upLoadPath}"; + MessageBox.Show(sshCmd); + client.RunCommand(sshCmd); + //client.RunCommand("sed -i 's/##domain##/" + ReceiveConfigurationParameters[4] + "/' " + upLoadPath); + if (String.IsNullOrEmpty(ReceiveConfigurationParameters[7]) == false) + { + sshCmd = $"sed -i 's/##sites##/proxy \\/ {ReceiveConfigurationParameters[7]}/' {upLoadPath}"; + //client.RunCommand("sed -i 's/##sites##/proxy \\/ " + ReceiveConfigurationParameters[7] + "/' " + upLoadPath); + MessageBox.Show(sshCmd); + client.RunCommand(sshCmd); + } + Thread.Sleep(2000); + + //生成安装服务命令中的邮箱 + //string sshCmdEmail = $"email={emailAddress};email=${{email/./@}};echo $email"; + //string email = client.RunCommand(sshCmdEmail).Result.ToString(); + + //MessageBox.Show(email); + + //安装Caddy服务 + //sshCmd = "caddy -service install -agree -conf /etc/caddy/Caddyfile -email " + email; + sshCmd = $"caddy -service install -agree -conf /etc/caddy/Caddyfile -email {email}"; + + client.Disconnect(); - MessageBox.Show(cmdResult); - if (cmdResult.Contains("/usr/bin/v2ray")==true) - { - MessageBox.Show("已安装"); - } - else - { - MessageBox.Show("未安装"); - } + //MessageBox.Show(cmdResult); + //if (cmdResult.Contains("/usr/bin/v2ray")==true) + //{ + // MessageBox.Show("已安装"); + //} + //else + //{ + // MessageBox.Show("未安装"); + //} //string[] cmdResultArry = cmdResult.Split('\n'); //foreach(string arry in cmdResultArry) //{ @@ -1219,6 +1268,36 @@ namespace ProxySU } } + private void TestsshCmd_Click(object sender, RoutedEventArgs e) + { + ReceiveConfigurationParameters[3] = "https://tes.te.tt"; + ReceiveConfigurationParameters[7] = "http://77.77.77"; + string upLoadPath = "/etc/caddy/Caddyfile"; + string sshCmd = $"sed -i 's/##path##/\\{ReceiveConfigurationParameters[3]}/' {upLoadPath}"; + //MessageBox.Show(sshCmd); + //sshCmd = "sed -i 's/##path##/\\" + ReceiveConfigurationParameters[3] + "/' " + upLoadPath; + //MessageBox.Show(sshCmd); + //sshCmd = $"sed -i 's/##path##/\\{ReceiveConfigurationParameters[3]}/' {upLoadPath}"; + //MessageBox.Show(sshCmd); + //sshCmd = "sed -i 's/##path##/\\" + ReceiveConfigurationParameters[3] + "/' " + upLoadPath; + //MessageBox.Show(sshCmd); + //client.RunCommand("sed -i 's/##path##/\\" + ReceiveConfigurationParameters[3] + "/' " + upLoadPath); + sshCmd = $"sed -i 's/##domain##/{ReceiveConfigurationParameters[4]}/' {upLoadPath}"; + MessageBox.Show(sshCmd); + string testDomain = ReceiveConfigurationParameters[7].Substring(0,7); + if (String.Equals(testDomain,"https:/")||String.Equals(testDomain,"http://")) + { + MessageBox.Show(testDomain); + ReceiveConfigurationParameters[7]=ReceiveConfigurationParameters[7].Replace("/","\\/"); + } + else + { + ReceiveConfigurationParameters[7] = "http:\\/\\/" + ReceiveConfigurationParameters[7]; + } + sshCmd = $"sed -i 's/##sites##/proxy \\/ {ReceiveConfigurationParameters[7]}/' {upLoadPath}"; + MessageBox.Show(sshCmd); + } + //private void Button_Click(object sender, RoutedEventArgs e) diff --git a/ProxySU/TemplateConfiguration.xaml b/ProxySU/TemplateConfiguration.xaml index 5944cce..7129984 100644 --- a/ProxySU/TemplateConfiguration.xaml +++ b/ProxySU/TemplateConfiguration.xaml @@ -6,13 +6,37 @@ xmlns:local="clr-namespace:ProxySU" mc:Ignorable="d" Title="TemplateConfiguration" Height="600" Width="850"> + + + + - + @@ -48,11 +72,11 @@ - + - + @@ -78,17 +102,20 @@ - + + + + @@ -97,28 +124,32 @@ + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - + + + - + diff --git a/ProxySU/TemplateConfiguration.xaml.cs b/ProxySU/TemplateConfiguration.xaml.cs index 68d4c50..f6fe62f 100644 --- a/ProxySU/TemplateConfiguration.xaml.cs +++ b/ProxySU/TemplateConfiguration.xaml.cs @@ -52,6 +52,18 @@ namespace ProxySU MainWindow.ReceiveConfigurationParameters[3] = TextBoxPath.Text.ToString(); //传递域名 MainWindow.ReceiveConfigurationParameters[4] = TextBoxDomain.Text.ToString(); + //传递伪装网站 + MainWindow.ReceiveConfigurationParameters[7] = TextBoxMaskSites.Text.ToString(); + string testDomain = TextBoxMaskSites.Text.Substring(0, 7); + if (String.Equals(testDomain, "https:/") || String.Equals(testDomain, "http://")) + { + //MessageBox.Show(testDomain); + MainWindow.ReceiveConfigurationParameters[7] = TextBoxMaskSites.Text.Replace("/", "\\/"); + } + else + { + MainWindow.ReceiveConfigurationParameters[7] = "http:\\/\\/" + TextBoxMaskSites.Text; + } } else if (RadioButtonHTTP2.IsChecked == true) @@ -162,18 +174,22 @@ namespace ProxySU //TextBlockServerListenPort.Visibility = Visibility.Visible; //TextBoxServerListenPort.Visibility = Visibility.Visible; //ButtonServerListenPort.Visibility = Visibility.Visible; - + //隐藏QUIC密钥 TextBlockQuicUUID.Visibility = Visibility.Collapsed; TextBoxQuicUUID.Visibility = Visibility.Collapsed; ButtonQuicUUID.Visibility = Visibility.Collapsed; - + //隐藏Path TextBlockPath.Visibility = Visibility.Collapsed; TextBoxPath.Visibility = Visibility.Collapsed; ButtonPath.Visibility = Visibility.Collapsed; - + //隐藏域名 TextBlockDomain.Visibility = Visibility.Collapsed; TextBoxDomain.Visibility = Visibility.Collapsed; ButtonDomain.Visibility = Visibility.Collapsed; + //隐藏伪装网站 + TextBlockMaskSites.Visibility = Visibility.Collapsed; + TextBoxMaskSites.Visibility = Visibility.Collapsed; + Guid uuid = Guid.NewGuid(); TextBoxNewUUID.Text = uuid.ToString(); @@ -181,6 +197,32 @@ namespace ProxySU int randomServerPort = random.Next(10000, 50000); TextBoxServerListenPort.Text = randomServerPort.ToString(); } + private void RadioButtonWebSocketTLS2Web_Checked(object sender, RoutedEventArgs e) + { + //TextBlockServerListenPort.Visibility = Visibility.Visible; + //TextBoxServerListenPort.Visibility = Visibility.Visible; + //ButtonServerListenPort.Visibility = Visibility.Visible; + TextBoxServerListenPort.Text = "443"; + //显示Path + TextBlockPath.Visibility = Visibility.Visible; + TextBoxPath.Visibility = Visibility.Visible; + TextBoxPath.Text = "/ray"; + ButtonPath.Visibility = Visibility.Visible; + //显示域名 + TextBlockDomain.Visibility = Visibility.Visible; + TextBoxDomain.Visibility = Visibility.Visible; + ButtonDomain.Visibility = Visibility.Visible; + //隐藏QUIC密钥 + TextBlockQuicUUID.Visibility = Visibility.Collapsed; + TextBoxQuicUUID.Visibility = Visibility.Collapsed; + ButtonQuicUUID.Visibility = Visibility.Collapsed; + //显示伪装网站 + TextBlockMaskSites.Visibility = Visibility.Visible; + TextBoxMaskSites.Visibility = Visibility.Visible; + + Guid uuid = Guid.NewGuid(); + TextBoxNewUUID.Text = uuid.ToString(); + } private void RadioButtonHTTP2_Checked(object sender, RoutedEventArgs e) { @@ -188,19 +230,22 @@ namespace ProxySU //TextBoxServerListenPort.Visibility = Visibility.Visible; //ButtonServerListenPort.Visibility = Visibility.Visible; TextBoxServerListenPort.Text = "443"; - + //显示Path TextBlockPath.Visibility = Visibility.Visible; TextBoxPath.Visibility = Visibility.Visible; TextBoxPath.Text = "/ray"; ButtonPath.Visibility = Visibility.Visible; - + //显示域名 TextBlockDomain.Visibility = Visibility.Visible; TextBoxDomain.Visibility = Visibility.Visible; ButtonDomain.Visibility = Visibility.Visible; - + //隐藏QUIC密钥 TextBlockQuicUUID.Visibility = Visibility.Collapsed; TextBoxQuicUUID.Visibility = Visibility.Collapsed; ButtonQuicUUID.Visibility = Visibility.Collapsed; + //隐藏伪装网站 + TextBlockMaskSites.Visibility = Visibility.Collapsed; + TextBoxMaskSites.Visibility = Visibility.Collapsed; Guid uuid = Guid.NewGuid(); TextBoxNewUUID.Text = uuid.ToString(); @@ -211,35 +256,43 @@ namespace ProxySU //TextBoxServerListenPort.Visibility = Visibility.Visible; //ButtonServerListenPort.Visibility = Visibility.Visible; TextBoxServerListenPort.Text = "80"; - + //隐藏Path TextBlockPath.Visibility = Visibility.Collapsed; TextBoxPath.Visibility = Visibility.Collapsed; ButtonPath.Visibility = Visibility.Collapsed; + //隐藏域名 TextBlockDomain.Visibility = Visibility.Collapsed; TextBoxDomain.Visibility = Visibility.Collapsed; ButtonDomain.Visibility = Visibility.Collapsed; - + //隐藏QUIC密钥 TextBlockQuicUUID.Visibility = Visibility.Collapsed; TextBoxQuicUUID.Visibility = Visibility.Collapsed; ButtonQuicUUID.Visibility = Visibility.Collapsed; + //隐藏伪装网站 + TextBlockMaskSites.Visibility = Visibility.Collapsed; + TextBoxMaskSites.Visibility = Visibility.Collapsed; Guid uuid = Guid.NewGuid(); TextBoxNewUUID.Text = uuid.ToString(); } private void RadioButtonQuicNone_Checked(object sender, RoutedEventArgs e) { + //显示QUIC密钥 TextBlockQuicUUID.Visibility = Visibility.Visible; TextBoxQuicUUID.Visibility = Visibility.Visible; ButtonQuicUUID.Visibility = Visibility.Visible; - + //隐藏Path TextBlockPath.Visibility = Visibility.Collapsed; TextBoxPath.Visibility = Visibility.Collapsed; ButtonPath.Visibility = Visibility.Collapsed; - + //隐藏域名 TextBlockDomain.Visibility = Visibility.Collapsed; TextBoxDomain.Visibility = Visibility.Collapsed; ButtonDomain.Visibility = Visibility.Collapsed; + //隐藏伪装网站 + TextBlockMaskSites.Visibility = Visibility.Collapsed; + TextBoxMaskSites.Visibility = Visibility.Collapsed; Guid uuid = Guid.NewGuid(); TextBoxNewUUID.Text = uuid.ToString(); diff --git a/ProxySU/bin/Release/ProxySU.exe b/ProxySU/bin/Release/ProxySU.exe index 8ffefeb..a1982e2 100644 Binary files a/ProxySU/bin/Release/ProxySU.exe and b/ProxySU/bin/Release/ProxySU.exe differ diff --git a/ProxySU/bin/Release/Release.zip b/ProxySU/bin/Release/Release.zip index bde163f..1a95b82 100644 Binary files a/ProxySU/bin/Release/Release.zip and b/ProxySU/bin/Release/Release.zip differ