diff --git a/.idea/.idea.ProxySU/.idea/codeStyles/codeStyleConfig.xml b/.idea/.idea.ProxySU/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..7ad1bf1 --- /dev/null +++ b/.idea/.idea.ProxySU/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/.idea.ProxySU/.idea/contentModel.xml b/.idea/.idea.ProxySU/.idea/contentModel.xml new file mode 100644 index 0000000..0f66ecb --- /dev/null +++ b/.idea/.idea.ProxySU/.idea/contentModel.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.ProxySU/.idea/encodings.xml b/.idea/.idea.ProxySU/.idea/encodings.xml new file mode 100644 index 0000000..df87cf9 --- /dev/null +++ b/.idea/.idea.ProxySU/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/.idea.ProxySU/.idea/indexLayout.xml b/.idea/.idea.ProxySU/.idea/indexLayout.xml new file mode 100644 index 0000000..27ba142 --- /dev/null +++ b/.idea/.idea.ProxySU/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.ProxySU/.idea/modules.xml b/.idea/.idea.ProxySU/.idea/modules.xml new file mode 100644 index 0000000..a7c012b --- /dev/null +++ b/.idea/.idea.ProxySU/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.ProxySU/.idea/projectSettingsUpdater.xml b/.idea/.idea.ProxySU/.idea/projectSettingsUpdater.xml new file mode 100644 index 0000000..4bb9f4d --- /dev/null +++ b/.idea/.idea.ProxySU/.idea/projectSettingsUpdater.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/.idea.ProxySU/.idea/vcs.xml b/.idea/.idea.ProxySU/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/.idea.ProxySU/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/.idea.ProxySU/.idea/workspace.xml b/.idea/.idea.ProxySU/.idea/workspace.xml new file mode 100644 index 0000000..cfb386b --- /dev/null +++ b/.idea/.idea.ProxySU/.idea/workspace.xml @@ -0,0 +1,121 @@ + + + + ProxySU/ProxySU.csproj + WpfApp1/WpfApp1.csproj + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1607572158648 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.ProxySU/riderModule.iml b/.idea/.idea.ProxySU/riderModule.iml new file mode 100644 index 0000000..1a4e0d9 --- /dev/null +++ b/.idea/.idea.ProxySU/riderModule.iml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/ProxySU.Core/App.xaml b/ProxySU.Core/App.xaml new file mode 100644 index 0000000..6f169ad --- /dev/null +++ b/ProxySU.Core/App.xaml @@ -0,0 +1,10 @@ + + + + + diff --git a/ProxySU.Core/App.xaml.cs b/ProxySU.Core/App.xaml.cs new file mode 100644 index 0000000..ba24f85 --- /dev/null +++ b/ProxySU.Core/App.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace ProxySU.Core +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} diff --git a/ProxySU.Core/AssemblyInfo.cs b/ProxySU.Core/AssemblyInfo.cs new file mode 100644 index 0000000..8b5504e --- /dev/null +++ b/ProxySU.Core/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Windows; + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/ProxySU.Core/MainWindow.xaml b/ProxySU.Core/MainWindow.xaml new file mode 100644 index 0000000..01c479c --- /dev/null +++ b/ProxySU.Core/MainWindow.xaml @@ -0,0 +1,28 @@ + + + + + 肖文杰 + + + + + + + + + diff --git a/ProxySU.Core/MainWindow.xaml.cs b/ProxySU.Core/MainWindow.xaml.cs new file mode 100644 index 0000000..920ed49 --- /dev/null +++ b/ProxySU.Core/MainWindow.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +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.Navigation; +using System.Windows.Shapes; + +namespace ProxySU.Core +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + } + } +} diff --git a/ProxySU.Core/ProxySU.Core.csproj b/ProxySU.Core/ProxySU.Core.csproj new file mode 100644 index 0000000..1480162 --- /dev/null +++ b/ProxySU.Core/ProxySU.Core.csproj @@ -0,0 +1,13 @@ + + + + WinExe + netcoreapp3.1 + true + + + + + + + diff --git a/ProxySU/MainWindow.xaml b/ProxySU/MainWindow.xaml index b8d4bc0..9a26b7b 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.5.5" Height="720" Width="660"> + Title="ProxySU - v2.5.6" Height="720" Width="660"> diff --git a/ProxySU/MainWindow.xaml.cs b/ProxySU/MainWindow.xaml.cs index e615084..7350959 100644 --- a/ProxySU/MainWindow.xaml.cs +++ b/ProxySU/MainWindow.xaml.cs @@ -99,6 +99,7 @@ namespace ProxySU static int randomCaddyListenPort = 8800; //Caddy做伪装网站所监听的端口,随机10001-60000 static int installationDegree = 0; //安装进度条显示的百分比 static string saveShellScriptFileName = "install.sh"; //用来保存下载的脚本名称 + static string acmeEmail = ""; //****** ****** // Application.Current.FindResource("").ToString() @@ -564,8 +565,17 @@ namespace ProxySU //远程主机连接信息 private ConnectionInfo GenerateConnectionInfo() { + acmeEmail = AcmeEmailTextBox.Text; + ConnectionInfo connectionInfo; + if (string.IsNullOrEmpty(acmeEmail)) + { + var acmeEmailDesc = Application.Current.FindResource("AcmeEmailDesc").ToString(); + MessageBox.Show(acmeEmailDesc); + return connectionInfo = null; + } + #region 检测输入的内容是否有错,并读取内容 if (string.IsNullOrEmpty(PreTrim(TextBoxHost.Text)) == true || string.IsNullOrEmpty(PreTrim(TextBoxPort.Text)) == true || string.IsNullOrEmpty(PreTrim(TextBoxUserName.Text)) == true) { @@ -737,7 +747,7 @@ namespace ProxySU } - + #region V2Ray相关 //打开v2ray模板设置窗口 @@ -1240,7 +1250,7 @@ namespace ProxySU functionResult = SetCaddyfile(client, upLoadPath); if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; } - + #endregion //启动Caddy服务 @@ -1359,8 +1369,8 @@ namespace ProxySU if (functionResult == true) { - sshShellCommand = @"mv /usr/local/etc/v2ray/config.json /usr/local/etc/v2ray/config.json.1"; - currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); + sshShellCommand = @"mv /usr/local/etc/v2ray/config.json /usr/local/etc/v2ray/config.json.1"; + currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); } //读取配置文件各个模块 string logConfigJson = $"{pwdir}" + @"TemplateConfg\v2ray\server\00_log\00_log.json"; @@ -2923,8 +2933,8 @@ namespace ProxySU if (functionResult == true) { - sshShellCommand = @"mv /usr/local/etc/xray/config.json /usr/local/etc/xray/config.json.1"; - currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); + sshShellCommand = @"mv /usr/local/etc/xray/config.json /usr/local/etc/xray/config.json.1"; + currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); } //读取配置文件各个模块 string logConfigJson = $"{pwdir}" + @"TemplateConfg\xray\server\00_log\00_log.json"; @@ -5268,7 +5278,7 @@ namespace ProxySU if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; } //安装代理程序 37--40 - functionResult = ProxySoftInstall(client,@"NaiveProxy", @"https://raw.githubusercontent.com/proxysu/shellscript/master/Caddy-Naive/caddy-naive-install.sh"); + functionResult = ProxySoftInstall(client, @"NaiveProxy", @"https://raw.githubusercontent.com/proxysu/shellscript/master/Caddy-Naive/caddy-naive-install.sh"); if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; } ////****** "系统环境检测完毕,符合安装要求,开始布署......" ****** @@ -5562,7 +5572,7 @@ namespace ProxySU { ReceiveConfigurationParameters[i] = ""; } - + bool domainNotEmpty = ClassModel.TestDomainIsEmpty(TextBoxSSRHostDomain.Text); bool preDomainMask = ClassModel.PreDomainMask(TextBoxSSRSites.Text); if (domainNotEmpty == false || preDomainMask == false) @@ -6792,10 +6802,10 @@ namespace ProxySU private string GenerateRandomStr(int length) { var rand = System.Security.Cryptography.RandomNumberGenerator.Create(); - byte[] bytes = new byte[length*2]; + byte[] bytes = new byte[length * 2]; rand.GetBytes(bytes); string randStr = Convert.ToBase64String(bytes); - randStr = randStr.Replace("+", "").Replace("/", "").Replace("=", "").Substring(0,length); + randStr = randStr.Replace("+", "").Replace("/", "").Replace("=", "").Substring(0, length); //MessageBox.Show(randStr); return randStr; } @@ -6882,7 +6892,7 @@ namespace ProxySU FileStream createDownloadConfig = File.Open(localConfigSavePathAndFileName, FileMode.Create); sftpClient.DownloadFile(remoteConfigPathAndFileName, createDownloadConfig); createDownloadConfig.Close(); - + sftpClient.Disconnect(); } @@ -6898,24 +6908,24 @@ namespace ProxySU //伪装网站处理 //private string DisguiseURLprocessing(string fakeUrl) //{ - //var uri = new Uri(fakeUrl); - //return uri.Host; + //var uri = new Uri(fakeUrl); + //return uri.Host; - ////处理伪装网站域名中的前缀 - //if (fakeUrl.Length >= 7) - //{ - // string testDomainMask = fakeUrl.Substring(0, 7); - // if (String.Equals(testDomainMask, "https:/") || String.Equals(testDomainMask, "http://")) - // { - // //MessageBox.Show(testDomain); - // string[] tmpUrl = fakeUrl.Split('/'); - // //MainWindow.ReceiveConfigurationParameters[7] = TextBoxMaskSites.Text.Replace("/", "\\/"); - // fakeUrl = tmpUrl[2]; - // } + ////处理伪装网站域名中的前缀 + //if (fakeUrl.Length >= 7) + //{ + // string testDomainMask = fakeUrl.Substring(0, 7); + // if (String.Equals(testDomainMask, "https:/") || String.Equals(testDomainMask, "http://")) + // { + // //MessageBox.Show(testDomain); + // string[] tmpUrl = fakeUrl.Split('/'); + // //MainWindow.ReceiveConfigurationParameters[7] = TextBoxMaskSites.Text.Replace("/", "\\/"); + // fakeUrl = tmpUrl[2]; + // } - //} - //return fakeUrl; - // } + //} + //return fakeUrl; + // } #region 检测系统内核是否符合安装要求 //private static bool DetectKernelVersion(string kernelVer) @@ -7057,7 +7067,7 @@ namespace ProxySU thread.SetApartmentState(ApartmentState.STA); thread.Start(); } - + //启用BBR的主要进程 private void StartTestAndEnableBBR(ConnectionInfo connectionInfo) { @@ -7155,7 +7165,7 @@ namespace ProxySU //****** "BBR已经启用了!" ****** currentStatus = Application.Current.FindResource("DisplayInstallInfo_BBRisEnabled").ToString(); MainWindowsShowInfo(currentStatus); - + } else { @@ -7165,7 +7175,7 @@ namespace ProxySU } client.Disconnect();//断开服务器ssh连接 - + return; } } @@ -7181,7 +7191,7 @@ namespace ProxySU #endregion } - + //检测要启用BBR主要的内核版本 private static bool DetectKernelVersionBBR(string kernelVer) { @@ -7233,7 +7243,7 @@ namespace ProxySU thread.SetApartmentState(ApartmentState.STA); thread.Start(); } - + } //卸载代理进程 private void StartRemoveProxySoft(ConnectionInfo connectionInfo) @@ -7338,18 +7348,18 @@ namespace ProxySU //如果未检测到有效的ip,连接就会被断开 if (client.IsConnected == false) { - return ; + return; } if (onlyIpv6 == true) { functionResult = SetUpNat64(client, true); - if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return ; } + if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; } //SetUpNat64(client, true); //sshShellCommand = $"{sshCmdUpdate}"; //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); } - + //******"开始卸载......"****** SetUpProgressBarProcessing(10); currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartRemoveProxy").ToString() + "......"; @@ -7409,7 +7419,7 @@ namespace ProxySU functionResult = FileCheckExists(client, @"/usr/local/bin/v2ray"); if (functionResult == true) - //if (currentShellCommandResult.Contains("/usr/local/bin/v2ray") == true) + //if (currentShellCommandResult.Contains("/usr/local/bin/v2ray") == true) { //******"V2Ray卸载失败!请向开发者问询!"****** currentStatus = "V2Ray" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString(); @@ -7419,7 +7429,7 @@ namespace ProxySU { //******"V2Ray卸载成功!"****** SetUpProgressBarProcessing(16); - currentStatus ="V2Ray" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftSuccess").ToString(); + currentStatus = "V2Ray" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftSuccess").ToString(); MainWindowsShowInfo(currentStatus); } @@ -7453,7 +7463,7 @@ namespace ProxySU currentStatus = Application.Current.FindResource("DisplayInstallInfo_DiscoverProxySoft").ToString() + "Trojan-go!" + Application.Current.FindResource("DisplayInstallInfo_StartRemoveProxy").ToString() - + "Trojan-go......"; + + "Trojan-go......"; MainWindowsShowInfo(currentStatus); sshShellCommand = @"systemctl stop trojan-go"; @@ -7909,15 +7919,15 @@ namespace ProxySU sshShellCommand = @"command -v apt-get"; currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); - bool getApt = ! String.IsNullOrEmpty(currentShellCommandResult); + bool getApt = !String.IsNullOrEmpty(currentShellCommandResult); sshShellCommand = @"command -v dnf"; currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); - bool getDnf = ! String.IsNullOrEmpty(currentShellCommandResult); + bool getDnf = !String.IsNullOrEmpty(currentShellCommandResult); sshShellCommand = @"command -v yum"; currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); - bool getYum = ! String.IsNullOrEmpty(currentShellCommandResult); + bool getYum = !String.IsNullOrEmpty(currentShellCommandResult); SetUpProgressBarProcessing(55); @@ -7925,7 +7935,7 @@ namespace ProxySU currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); bool getZypper = String.IsNullOrEmpty(currentShellCommandResult); - + string sshCmdRemove = ""; //string sshCmdRemove2; //设置安装软件所用的命令格式 @@ -8135,7 +8145,7 @@ namespace ProxySU //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); } - + //******"卸载成功!"******04 SetUpProgressBarProcessing(100); currentStatus = Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftSuccess").ToString(); @@ -8903,7 +8913,7 @@ namespace ProxySU } } - + #region 免翻网址资源标签 private void ButtonWebBrowserHomePageFreeWallURL_Click(object sender, RoutedEventArgs e) @@ -8984,7 +8994,7 @@ namespace ProxySU #endregion #endregion - + #region 测试用代码 private void Button_Click(object sender, RoutedEventArgs e) { @@ -9079,7 +9089,7 @@ namespace ProxySU SetUpProgressBarProcessing(3); currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString(); MainWindowsShowInfo(currentStatus); - + sshShellCommand = @"id -u"; currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); @@ -9138,16 +9148,16 @@ namespace ProxySU } //设置Nat64与删除设置Nat64 - private bool SetUpNat64(SshClient client,bool set) + private bool SetUpNat64(SshClient client, bool set) { - if(set == true) + if (set == true) { //****** "正在查找最快的Nat64网关......" ****** currentStatus = Application.Current.FindResource("DisplayInstallInfo_FindFastestSetUpNat64").ToString(); MainWindowsShowInfo(currentStatus); //string[] dns64 = new string[2]; var dns64 = FilterFastestIP(client); - + if (functionResult == false) { //****** "未能找到有效的Nat64网关......" ****** @@ -9158,7 +9168,7 @@ namespace ProxySU client.Disconnect(); return false; } - + //****** "正在设置Nat64网关......" ****** currentStatus = Application.Current.FindResource("DisplayInstallInfo_SetUpNat64").ToString(); MainWindowsShowInfo(currentStatus); @@ -9169,7 +9179,7 @@ namespace ProxySU sshShellCommand = @"mv /etc/resolv.conf /etc/resolv.conf.proxysu"; currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); } - + foreach (string gateip in dns64) { @@ -9198,7 +9208,7 @@ namespace ProxySU sshShellCommand = @"mv /etc/resolv.conf.proxysu /etc/resolv.conf"; currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); } - + return true; } @@ -9251,7 +9261,7 @@ namespace ProxySU functionResult = true; } string[] returnstr = new string[listCount]; - for(int i=0;i zh-CN false + ProjectFiles + + + false \ No newline at end of file diff --git a/ProxySU/packages.config b/ProxySU/packages.config new file mode 100644 index 0000000..6161026 --- /dev/null +++ b/ProxySU/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file