diff --git a/ProxySU/MainWindow.xaml b/ProxySU/MainWindow.xaml index c1a6a93..e57612c 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" Height="600" Width="530"> + Title="ProxySU - v1.8.4" Height="600" Width="530"> @@ -117,9 +117,9 @@ - + - + @@ -131,8 +131,33 @@ --> - - + + + + + + + + + + + + + + + + + + + + + + + + @@ -146,18 +171,49 @@ - - - + + - - + + + + + + + + - + + @@ -170,7 +226,7 @@ - + @@ -278,29 +334,7 @@ - - - - - - - - - - - - - - - - - - - - + @@ -381,7 +415,7 @@ - + diff --git a/ProxySU/MainWindow.xaml.cs b/ProxySU/MainWindow.xaml.cs index 684d1a8..f52ad46 100644 --- a/ProxySU/MainWindow.xaml.cs +++ b/ProxySU/MainWindow.xaml.cs @@ -64,6 +64,9 @@ namespace ProxySU //初始化参数给 ReceiveConfigurationParameters = new string[8]; + //初始化Trojan的密码 + TextBoxTrojanPassword.Text = RandomUUID(); + //初始化NaiveProxy的用户名和密码 TextBoxNaivePassword.Text = RandomUUID(); TextBoxNaiveUser.Text = RandomUserName(); @@ -578,8 +581,8 @@ namespace ProxySU } else { - currentShellCommandResult = "检测结果:未安装V2Ray!"; - TextBoxMonitorCommandResults.Dispatcher.BeginInvoke(updateMonitorAction, TextBoxMonitorCommandResults, currentShellCommandResult);//显示命令执行的结果 + currentStatus = "检测结果:未安装V2Ray!"; + textBlockName.Dispatcher.BeginInvoke(updateAction, textBlockName, progressBar, currentStatus); currentShellCommandResult = currentStatus; TextBoxMonitorCommandResults.Dispatcher.BeginInvoke(updateMonitorAction, TextBoxMonitorCommandResults, currentShellCommandResult);//显示命令执行的结果 @@ -2346,16 +2349,16 @@ namespace ProxySU #region Trojan相关 //打开Trojan参数设置界面 - private void ButtonTrojanTemplate_Click(object sender, RoutedEventArgs e) - { - for (int i = 0; i != ReceiveConfigurationParameters.Length; i++) + //private void ButtonTrojanTemplate_Click(object sender, RoutedEventArgs e) + //{ + // for (int i = 0; i != ReceiveConfigurationParameters.Length; i++) - { - ReceiveConfigurationParameters[i] = ""; - } - TrojanTemplateWindow windowTrojanTemplateConfiguration = new TrojanTemplateWindow(); - windowTrojanTemplateConfiguration.ShowDialog(); - } + // { + // ReceiveConfigurationParameters[i] = ""; + // } + // TrojanTemplateWindow windowTrojanTemplateConfiguration = new TrojanTemplateWindow(); + // windowTrojanTemplateConfiguration.ShowDialog(); + //} //Trojan参数传递 private void ButtonTrojanSetUp_Click(object sender, RoutedEventArgs e) @@ -2366,23 +2369,61 @@ namespace ProxySU MessageBox.Show("远程主机连接信息有误,请检查"); return; } - string serverConfig = ""; //服务端配置文件 - string clientConfig = ""; //生成的客户端配置文件 - string upLoadPath = "/usr/local/etc/trojan/config.json"; //服务端文件位置 - if (String.IsNullOrEmpty(ReceiveConfigurationParameters[4]) == true) + //清空参数空间 + for (int i = 0; i != ReceiveConfigurationParameters.Length; i++) + { - ReceiveConfigurationParameters[4] = TextBoxHost.Text.ToString(); + ReceiveConfigurationParameters[i] = ""; } - if (String.IsNullOrEmpty(ReceiveConfigurationParameters[0]) == true) + if (string.IsNullOrEmpty(TextBoxTrojanHostDomain.Text.ToString()) == true) { - MessageBox.Show("请先选择配置模板!"); + MessageBox.Show("域名不能为空!"); return; } - else if (String.Equals(ReceiveConfigurationParameters[0], "TrojanTLS2Web")) + //传递模板类型 + ReceiveConfigurationParameters[0] = "TrojanTLS2Web"; + + //传递域名 + ReceiveConfigurationParameters[4] = TextBoxTrojanHostDomain.Text.ToString(); + //传递伪装网站 + ReceiveConfigurationParameters[7] = TextBoxTrojanSites.Text.ToString(); + //处理伪装网站域名中的前缀 + if (TextBoxTrojanSites.Text.ToString().Length >= 7) { - serverConfig = "TemplateConfg\\trojan_server_config.json"; - clientConfig = "TemplateConfg\\trojan_client_config.json"; + string testDomain = TextBoxTrojanSites.Text.Substring(0, 7); + if (String.Equals(testDomain, "https:/") || String.Equals(testDomain, "http://")) + { + //MessageBox.Show(testDomain); + ReceiveConfigurationParameters[7] = TextBoxTrojanSites.Text.Replace("/", "\\/"); + } + else + { + ReceiveConfigurationParameters[7] = "http:\\/\\/" + TextBoxTrojanSites.Text; + } } + //传递服务端口 + ReceiveConfigurationParameters[1] = "443"; + //传递密码(uuid) + ReceiveConfigurationParameters[2] = TextBoxTrojanPassword.Text.ToString(); + + + string serverConfig = "TemplateConfg\\trojan_server_config.json"; //服务端配置文件 + string clientConfig = "TemplateConfg\\trojan_client_config.json"; //生成的客户端配置文件 + string upLoadPath = "/usr/local/etc/trojan/config.json"; //服务端文件位置 + //if (String.IsNullOrEmpty(ReceiveConfigurationParameters[4]) == true) + //{ + // ReceiveConfigurationParameters[4] = TextBoxHost.Text.ToString(); + //} + //if (String.IsNullOrEmpty(ReceiveConfigurationParameters[0]) == true) + //{ + // MessageBox.Show("请先选择配置模板!"); + // return; + //} + //else if (String.Equals(ReceiveConfigurationParameters[0], "TrojanTLS2Web")) + //{ + // serverConfig = "TemplateConfg\\trojan_server_config.json"; + // clientConfig = "TemplateConfg\\trojan_client_config.json"; + //} Thread thread = new Thread(() => StartSetUpTrojan(connectionInfo, TextBlockSetUpProcessing, ProgressBarSetUpProcessing, serverConfig, clientConfig, upLoadPath)); thread.SetApartmentState(ApartmentState.STA); thread.Start(); @@ -2392,7 +2433,7 @@ namespace ProxySU private void StartSetUpTrojan(ConnectionInfo connectionInfo, TextBlock textBlockName, ProgressBar progressBar, string serverConfig, string clientConfig, string upLoadPath) { string currentStatus = "正在登录远程主机......"; - Action updateAction = new Action(UpdateTextBlock); + //Action updateAction = new Action(UpdateTextBlock); textBlockName.Dispatcher.BeginInvoke(updateAction, textBlockName, progressBar, currentStatus); currentShellCommandResult = currentStatus; TextBoxMonitorCommandResults.Dispatcher.BeginInvoke(updateMonitorAction, TextBoxMonitorCommandResults, currentShellCommandResult);//显示命令执行的结果 @@ -2511,8 +2552,8 @@ namespace ProxySU } else { - currentShellCommandResult = "检测结果:未安装Trojan!"; - TextBoxMonitorCommandResults.Dispatcher.BeginInvoke(updateMonitorAction, TextBoxMonitorCommandResults, currentShellCommandResult);//显示命令执行的结果 + currentStatus = "检测结果:未安装Trojan!"; + textBlockName.Dispatcher.BeginInvoke(updateAction, textBlockName, progressBar, currentStatus);//显示命令执行的结果 currentShellCommandResult = currentStatus; TextBoxMonitorCommandResults.Dispatcher.BeginInvoke(updateMonitorAction, TextBoxMonitorCommandResults, currentShellCommandResult);//显示命令执行的结果 @@ -3970,6 +4011,12 @@ namespace ProxySU #endregion } + + //更新Trojan的密码 + private void ButtonTrojanPassword_Click(object sender, RoutedEventArgs e) + { + TextBoxTrojanPassword.Text = RandomUUID(); + } #endregion #region Trojan-go相关 @@ -4132,8 +4179,8 @@ namespace ProxySU } else { - currentShellCommandResult = "检测结果:未安装Trojan-go!"; - TextBoxMonitorCommandResults.Dispatcher.BeginInvoke(updateMonitorAction, TextBoxMonitorCommandResults, currentShellCommandResult);//显示命令执行的结果 + currentStatus = "检测结果:未安装Trojan-go!"; + textBlockName.Dispatcher.BeginInvoke(updateAction, textBlockName, progressBar, currentStatus);//显示命令执行的结果 currentShellCommandResult = currentStatus; TextBoxMonitorCommandResults.Dispatcher.BeginInvoke(updateMonitorAction, TextBoxMonitorCommandResults, currentShellCommandResult);//显示命令执行的结果 @@ -6574,8 +6621,7 @@ namespace ProxySU //更新NaiveProxy的密码 private void ButtonNaivePassword_Click(object sender, RoutedEventArgs e) { - Guid uuid = Guid.NewGuid(); - TextBoxNaivePassword.Text = uuid.ToString(); + TextBoxNaivePassword.Text = RandomUUID(); } //生成随机UUID @@ -8036,9 +8082,9 @@ namespace ProxySU #endregion } - #endregion - + #endregion + } } diff --git a/ProxySU/Properties/AssemblyInfo.cs b/ProxySU/Properties/AssemblyInfo.cs index 1bc4460..4738786 100644 --- a/ProxySU/Properties/AssemblyInfo.cs +++ b/ProxySU/Properties/AssemblyInfo.cs @@ -51,5 +51,5 @@ using System.Windows; // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 // 方法是按如下所示使用“*”: : // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.8.3.0")] -[assembly: AssemblyFileVersion("1.8.3.0")] +[assembly: AssemblyVersion("0.0.0.0")] +[assembly: AssemblyFileVersion("0.0.0.0")] diff --git a/ProxySU/ProxySU.csproj b/ProxySU/ProxySU.csproj index 8febe77..5eeaa37 100644 --- a/ProxySU/ProxySU.csproj +++ b/ProxySU/ProxySU.csproj @@ -102,9 +102,6 @@ TrojanResultClientInfoWindow.xaml - - TrojanTemplateWindow.xaml - MSBuild:Compile Designer @@ -145,10 +142,6 @@ Designer MSBuild:Compile - - Designer - MSBuild:Compile - diff --git a/ProxySU/TrojanTemplateWindow.xaml b/ProxySU/TrojanTemplateWindow.xaml deleted file mode 100644 index e7d9807..0000000 --- a/ProxySU/TrojanTemplateWindow.xaml +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ProxySU/TrojanTemplateWindow.xaml.cs b/ProxySU/TrojanTemplateWindow.xaml.cs deleted file mode 100644 index 8fc7b91..0000000 --- a/ProxySU/TrojanTemplateWindow.xaml.cs +++ /dev/null @@ -1,87 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Shapes; - -namespace ProxySU -{ - /// - /// TrojanTemplateWindow.xaml 的交互逻辑 - /// - public partial class TrojanTemplateWindow : Window - { - public TrojanTemplateWindow() - { - InitializeComponent(); - RadioButtonTrojanTLS2Web.IsChecked = true; - } - private void ButtondDecide_Click(object sender, RoutedEventArgs e) - { - if (RadioButtonTrojanTLS2Web.IsChecked == true) - { - if (string.IsNullOrEmpty(TextBoxDomain.Text.ToString()) == true) - { - MessageBox.Show("域名不能为空!"); - return; - } - //传递模板类型 - MainWindow.ReceiveConfigurationParameters[0] = "TrojanTLS2Web"; - - //传递域名 - MainWindow.ReceiveConfigurationParameters[4] = TextBoxDomain.Text.ToString(); - //传递伪装网站 - MainWindow.ReceiveConfigurationParameters[7] = TextBoxMaskSites.Text.ToString(); - //处理伪装网站域名中的前缀 - if (TextBoxMaskSites.Text.ToString().Length >= 7) - { - 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; - } - } - //传递服务端口 - MainWindow.ReceiveConfigurationParameters[1] = "443"; - //传递密码(uuid) - MainWindow.ReceiveConfigurationParameters[2] = TextBoxNewUUID.Text.ToString(); - } - - - this.Close(); - } - private void ButtonNewUUID_Click(object sender, RoutedEventArgs e) - { - Guid uuid = Guid.NewGuid(); - TextBoxNewUUID.Text = uuid.ToString(); - } - //private void ButtonServerListenPort_Click(object sender, RoutedEventArgs e) - //{ - // Random random = new Random(); - // int randomServerPort = random.Next(10000, 50000); - // TextBoxServerListenPort.Text = randomServerPort.ToString(); - //} - private void ButtondCancel_Click(object sender, RoutedEventArgs e) => Close(); - - private void RadioButtonTrojanTLS2Web_Checked(object sender, RoutedEventArgs e) - { - Guid uuid = Guid.NewGuid(); - TextBoxNewUUID.Text = uuid.ToString(); - //Random random = new Random(); - //int randomServerPort = random.Next(10000, 50000); - //TextBoxServerListenPort.Text = "443"; - } - } -} diff --git a/ProxySU/bin/Beta/Beta.zip b/ProxySU/bin/Beta/Beta.zip index bb48b72..497e4cc 100644 Binary files a/ProxySU/bin/Beta/Beta.zip and b/ProxySU/bin/Beta/Beta.zip differ