1
0
mirror of https://github.com/proxysu/ProxySU.git synced 2024-11-21 20:56:08 +03:00

fix 申请证书失败问题

This commit is contained in:
next-autumn 2021-02-02 20:07:11 +08:00
parent e4971f286f
commit 7034a1dc22
25 changed files with 451 additions and 107 deletions

View File

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ContentModelStore">
<e p="C:\Users\huife\AppData\Local\JetBrains\Rider2020.2\extResources" t="IncludeRecursive" />
<e p="C:\Users\huife\AppData\Local\JetBrains\Rider2020.2\resharper-host\Local\Transient\Rider\v202\SolutionCaches\_ProxySU.1010492592.00" t="ExcludeRecursive" />
<e p="E:\dev\ProxySU" t="IncludeFlat">
<e p="packages" t="ExcludeRecursive" />
<e p="ProxySU" t="IncludeRecursive">
<e p="ProxySU.csproj" t="IncludeRecursive" />
</e>
<e p="ProxySU.sln" t="IncludeFlat" />
<e p="WpfApp1" t="IncludeRecursive">
<e p="App.xaml" t="Include" />
<e p="App.xaml.cs" t="Include" />
<e p="AssemblyInfo.cs" t="Include" />
<e p="bin" t="ExcludeRecursive" />
<e p="MainWindow.xaml" t="Include" />
<e p="MainWindow.xaml.cs" t="Include" />
<e p="obj" t="ExcludeRecursive">
<e p="Debug" t="Include">
<e p="netcoreapp3.1-windows" t="Include">
<e p="App.g.cs" t="Include" />
<e p="MainWindow.g.cs" t="Include" />
<e p="WpfApp1.AssemblyInfo.cs" t="Include" />
</e>
</e>
</e>
<e p="WpfApp1.csproj" t="IncludeRecursive" />
</e>
</e>
</component>
</project>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ContentModelUserStore">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/.idea.ProxySU/riderModule.iml" filepath="$PROJECT_DIR$/.idea/.idea.ProxySU/riderModule.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RiderProjectSettingsUpdater">
<option name="vcsConfiguration" value="2" />
</component>
</project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AutoGeneratedRunConfigurationManager">
<projectFile>ProxySU/ProxySU.csproj</projectFile>
<projectFile>WpfApp1/WpfApp1.csproj</projectFile>
</component>
<component name="ChangeListManager">
<list default="true" id="669dc0ab-dc83-4456-b675-b70a2f5f75b2" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/ProxySU.sln" beforeDir="false" afterPath="$PROJECT_DIR$/ProxySU.sln" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ProxySU/bin/Beta/Beta.zip" beforeDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="HighlightingSettingsPerFile">
<setting file="file://$PROJECT_DIR$/ProxySU/MainWindow.xaml" root0="SKIP_HIGHLIGHTING" />
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/WpfApp1/MainWindow.xaml" />
</list>
</option>
</component>
<component name="ProjectId" id="1lRuJq6UGgT2UlI6dsaBIqwjatG" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="dart.analysis.tool.window.visible" value="false" />
<property name="vue.rearranger.settings.migration" value="true" />
</component>
<component name="RunManager" selected=".NET Project.WpfApp1">
<configuration name="ProxySU" type="DotNetProject" factoryName=".NET Project">
<option name="EXE_PATH" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
<option name="RUNTIME_ARGUMENTS" value="" />
<option name="PROJECT_PATH" value="$PROJECT_DIR$/ProxySU/ProxySU.csproj" />
<option name="PROJECT_EXE_PATH_TRACKING" value="1" />
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="1" />
<option name="PROJECT_KIND" value="Console" />
<option name="PROJECT_TFM" value="" />
<method v="2">
<option name="Build" />
</method>
</configuration>
<configuration name="WpfApp1" type="DotNetProject" factoryName=".NET Project">
<option name="EXE_PATH" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
<option name="RUNTIME_ARGUMENTS" value="" />
<option name="PROJECT_PATH" value="$PROJECT_DIR$/WpfApp1/WpfApp1.csproj" />
<option name="PROJECT_EXE_PATH_TRACKING" value="1" />
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="1" />
<option name="PROJECT_KIND" value="DotNetCore" />
<option name="PROJECT_TFM" value="" />
<method v="2">
<option name="Build" />
</method>
</configuration>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="669dc0ab-dc83-4456-b675-b70a2f5f75b2" name="Default Changelist" comment="" />
<created>1607572158648</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1607572158648</updated>
<workItem from="1607572166623" duration="517000" />
</task>
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="UnityProjectConfiguration" hasMinimizedUI="null" />
<component name="UnityUnitTestConfiguration" currentTestLauncher="NUnit" />
<component name="VcsManagerConfiguration">
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="true" />
</component>
<component name="WindowStateProjectService">
<state width="1877" height="275" key="GridCell.Tab.0.bottom" timestamp="1607572691215">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="275" key="GridCell.Tab.0.bottom/0.0.1920.1040@0.0.1920.1040" timestamp="1607572691215" />
<state width="1877" height="275" key="GridCell.Tab.0.center" timestamp="1607572691215">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="275" key="GridCell.Tab.0.center/0.0.1920.1040@0.0.1920.1040" timestamp="1607572691215" />
<state width="1877" height="275" key="GridCell.Tab.0.left" timestamp="1607572691215">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="275" key="GridCell.Tab.0.left/0.0.1920.1040@0.0.1920.1040" timestamp="1607572691215" />
<state width="1877" height="275" key="GridCell.Tab.0.right" timestamp="1607572691215">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="275" key="GridCell.Tab.0.right/0.0.1920.1040@0.0.1920.1040" timestamp="1607572691215" />
<state x="552" y="252" key="Rider.ProjectTemplateDialog.Size" timestamp="1607572543584">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="552" y="252" key="Rider.ProjectTemplateDialog.Size/0.0.1920.1040@0.0.1920.1040" timestamp="1607572543584" />
</component>
</project>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="RIDER_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$/../.." />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

10
ProxySU.Core/App.xaml Normal file
View File

@ -0,0 +1,10 @@
<Application x:Class="ProxySU.Core.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ProxySU.Core"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

17
ProxySU.Core/App.xaml.cs Normal file
View File

@ -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
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

View File

@ -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)
)]

View File

@ -0,0 +1,28 @@
<Window x:Class="ProxySU.Core.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ProxySU.Core"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<Menu Style="{DynamicResource MaterialDesignMenu}">
<MenuItem Header="文件" Style="{DynamicResource MaterialDesignMenuItem}">
<MenuItem Header="SubMenu">肖文杰</MenuItem>
</MenuItem>
<MenuItem Header="文件" Style="{DynamicResource MaterialDesignMenuItem}"></MenuItem>
<MenuItem Header="文件" Style="{DynamicResource MaterialDesignMenuItem}"></MenuItem>
</Menu>
<!--<TabControl Style="{DynamicResource MaterialDesignNavigatilRailTabControl}" >
<TabItem Header="Item2" Style="{DynamicResource MaterialDesignNavigationRailTabItem}">
<Button Style="{DynamicResource MaterialDesignRaisedButton}" Content="Hello!"></Button>
</TabItem>
<TabItem Header="Item2"></TabItem>
</TabControl>-->
</Grid>
</Window>

View File

@ -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
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWPF>true</UseWPF>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MaterialDesignThemes" Version="3.2.0" />
</ItemGroup>
</Project>

View File

@ -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.3 Beta1" Height="675" Width="660">
Title="ProxySU - v2.5.6" Height="720" Width="660">
<!--以下样式参考自https://yq.aliyun.com/articles/331878
https://docs.microsoft.co/en-us/dotnet/desktop-wpf/fundamentals/styles-templates-overview-->
<Window.Resources>
@ -57,6 +57,7 @@
<Grid>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="1.3*"></RowDefinition>
<RowDefinition Height="1.8*"></RowDefinition>
</Grid.RowDefinitions>
@ -147,23 +148,29 @@
<TextBlock x:Name="TextBlockProxyPassword" IsEnabled="False" Text="{DynamicResource TextBlockHostPassword}" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="5" Grid.Column="2" Grid.Row="1" ></TextBlock>
<TextBox x:Name="TextBoxProxyUserName" IsEnabled="False" Text="" Margin="3" Grid.Column="1" Grid.Row="1" />
<PasswordBox x:Name="PasswordBoxProxyPassword" IsEnabled="False" Password="" Margin="3" Grid.Column="3" Grid.Row="1"></PasswordBox>
<Button x:Name="ButtonSaveInstalledLog" Content="{DynamicResource ButtonSaveInstalledLog}" Grid.Column="4" Grid.Row="1" Grid.ColumnSpan="2" Margin="10,3,10,3" Click="ButtonSaveInstalledLog_Click"></Button>
</Grid>
</Grid>
<Grid Grid.Row="1">
<StackPanel Margin="10,0,0,0" Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock Foreground="Red" x:Name="AcmeEmailLabel" Text="Email:" VerticalAlignment="Center" />
<TextBox Margin="10,0,0,0" Height="20" Width="200" x:Name="AcmeEmailTextBox" />
<TextBlock Margin="10,0,0,0" Text="{DynamicResource AcmeEmailDesc}" Foreground="Red" />
</StackPanel>
</Grid>
<Grid Grid.Row="2">
<Grid.RowDefinitions>
<RowDefinition Height="20"></RowDefinition>
<RowDefinition Height="20"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Button x:Name="ButtonSaveInstalledLog" Content="{DynamicResource ButtonSaveInstalledLog}" Margin="0,0,10,0" Width="140" HorizontalAlignment="Right" Click="ButtonSaveInstalledLog_Click"></Button>
<TextBlock x:Name="TextBlockSetUpProcessing" Text="{DynamicResource TextBlockSetUpProcessing}" Foreground="Blue" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="0"></TextBlock>
<ProgressBar x:Name="ProgressBarSetUpProcessing" Minimum="0" Maximum="100" Value="{Binding InsertBindingHere}" Margin="10,0,10,3" Grid.Row="1"></ProgressBar>
<TextBlock Text="{Binding ElementName=ProgressBarSetUpProcessing, Path=Value, StringFormat={}{0:0}%}" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="1"/>
<TextBox x:Name="TextBoxMonitorCommandResults" IsReadOnly="True" TextWrapping="Wrap" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" Grid.Row="2" Margin="10,0,10,3"></TextBox>
</Grid>
<Grid Grid.Row="2">
<Grid Grid.Row="3">
<TabControl Grid.Column="0" Grid.Row="9" Grid.ColumnSpan="4" Grid.RowSpan="3">
<TabItem Header="Xray" Width="60" Height="30">
<Grid>

View File

@ -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)
{
@ -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; }
////****** "系统环境检测完毕,符合安装要求,开始布署......" ******
@ -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;
}
@ -7338,12 +7348,12 @@ 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);
@ -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);
}
@ -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);
@ -9138,9 +9148,9 @@ 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();
@ -9251,7 +9261,7 @@ namespace ProxySU
functionResult = true;
}
string[] returnstr = new string[listCount];
for(int i=0;i<listCount;i++)
for (int i = 0; i < listCount; i++)
{
returnstr[i] = NatDns64s[i].IpAddr;
}
@ -9289,7 +9299,7 @@ namespace ProxySU
}
//安装过程所运行的命令与相应结果
private string MainWindowsShowCmd(SshClient client,string sshShellCommand)
private string MainWindowsShowCmd(SshClient client, string sshShellCommand, bool stopIfError = true)
{
TextBoxMonitorCommandResults.Dispatcher.BeginInvoke(updateMonitorAction, TextBoxMonitorCommandResults, sshShellCommand);//显示执行的命令
SshCommand cmdResult = client.RunCommand(sshShellCommand);
@ -9297,8 +9307,9 @@ namespace ProxySU
string currentShellCommandError = cmdResult.Error; //命令执行出错的提示
int cmdExitStatus = cmdResult.ExitStatus;
//if (String.IsNullOrEmpty(currentShellCommandResult) == true)
if(cmdExitStatus == 1)
if (cmdExitStatus == 1)
{
if (stopIfError) { }
//currentShellCommandResult = currentShellCommandError;
TextBoxMonitorCommandResults.Dispatcher.BeginInvoke(updateMonitorAction, TextBoxMonitorCommandResults, currentShellCommandError);//显示命令执行错误的提示
}
@ -9380,7 +9391,7 @@ namespace ProxySU
//condition---已安装的条件
//functionResult = SoftInstalledIsNoYes(client, "v2ray", @"/usr/local/bin/v2ray");
//if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
private bool SoftInstalledIsNoYes(SshClient client,string soft,string condition)
private bool SoftInstalledIsNoYes(SshClient client, string soft, string condition)
{
//******"检测系统是否已经安装......"******03
SetUpProgressBarProcessing(8);
@ -9447,15 +9458,15 @@ namespace ProxySU
sshShellCommand = @"command -v apt-get";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
getApt = ! String.IsNullOrEmpty(currentShellCommandResult);
getApt = !String.IsNullOrEmpty(currentShellCommandResult);
sshShellCommand = @"command -v dnf";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
getDnf = ! String.IsNullOrEmpty(currentShellCommandResult);
getDnf = !String.IsNullOrEmpty(currentShellCommandResult);
sshShellCommand = @"command -v yum";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
getYum = ! String.IsNullOrEmpty(currentShellCommandResult);
getYum = !String.IsNullOrEmpty(currentShellCommandResult);
SetUpProgressBarProcessing(13);
@ -9465,11 +9476,11 @@ namespace ProxySU
sshShellCommand = @"command -v systemctl";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
bool getSystemd = ! String.IsNullOrEmpty(currentShellCommandResult);
bool getSystemd = !String.IsNullOrEmpty(currentShellCommandResult);
sshShellCommand = @"command -v getenforce";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
bool getGetenforce = ! String.IsNullOrEmpty(currentShellCommandResult);
bool getGetenforce = !String.IsNullOrEmpty(currentShellCommandResult);
//没有安装apt-get也没有安装dnf\yum也没有安装zypper,或者没有安装systemd的不满足安装条件
@ -9806,7 +9817,7 @@ namespace ProxySU
sshShellCommand = @"firewall-cmd --state";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
if(String.Equals(currentShellCommandResult.Trim(), "running") == false)
if (String.Equals(currentShellCommandResult.Trim(), "running") == false)
{
sshShellCommand = @"systemctl restart firewalld";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
@ -9941,7 +9952,9 @@ namespace ProxySU
{
string nativeIp = ipv4;
sshShellCommand = "ping " + ReceiveConfigurationParameters[4] + " -c1 | grep -oE -m1 \"([0-9]{1,3}\\.){3}[0-9]{1,3}\"";
//string cmdFilter = "";
string cmdFilter = @"| grep -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -n 1";
sshShellCommand = $"dig @resolver1.opendns.com A {ReceiveConfigurationParameters[4]} +short -4 {cmdFilter}";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
string resultTestDomainCmd = currentShellCommandResult.TrimEnd('\r', '\n');
@ -9958,11 +9971,11 @@ namespace ProxySU
}
else
{
string nativeIp = ipv6;
//sshShellCommand = "ping6 " + ReceiveConfigurationParameters[4] + " -c1 | grep -oE -m1 \"([0-9]{1,3}\\.){3}[0-9]{1,3}\"";
sshShellCommand = $"dig @resolver1.opendns.com AAAA {ReceiveConfigurationParameters[4]} +short -6";
//string cmdFilter = "";
string cmdFilter = @"| grep -oE '(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))' | head -n 1";
sshShellCommand = $"dig @resolver1.opendns.com AAAA {ReceiveConfigurationParameters[4]} +short -6 {cmdFilter}";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
string resultTestDomainCmd = currentShellCommandResult.TrimEnd('\r', '\n');
@ -9993,7 +10006,7 @@ namespace ProxySU
//安装代理程序 37--40
//functionResult = ProxySoftInstall(client,@"",@"");
//if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
private bool ProxySoftInstall(SshClient client,string proxyName,string downloadUrl)
private bool ProxySoftInstall(SshClient client, string proxyName, string downloadUrl)
{
//****** "系统环境检测完毕,符合安装要求,开始布署......" ******
SetUpProgressBarProcessing(37);
@ -10034,7 +10047,7 @@ namespace ProxySU
//condition---成功安装的条件
//functionResult = SoftInstalledSuccessOrFail(client,"v2ray",@"/usr/local/bin/v2ray");
//if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
private bool SoftInstalledSuccessOrFail(SshClient client,string soft,string condition)
private bool SoftInstalledSuccessOrFail(SshClient client, string soft, string condition)
{
SetUpProgressBarProcessing(41);
//sshShellCommand = $"find / -name {soft}";
@ -10083,7 +10096,6 @@ namespace ProxySU
//if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
private bool AcmeShInstall(SshClient client)
{
//****** "正在安装acme.sh......" ******22
SetUpProgressBarProcessing(51);
currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallAcmeSh").ToString();
@ -10100,7 +10112,8 @@ namespace ProxySU
sshShellCommand = $"{sshCmdInstall}automake autoconf libtool";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
sshShellCommand = $"curl https://raw.githubusercontent.com/acmesh-official/acme.sh/master/acme.sh | INSTALLONLINE=1 sh";
//sshShellCommand = $"curl https://raw.githubusercontent.com/acmesh-official/acme.sh/master/acme.sh | INSTALLONLINE=1 sh";
sshShellCommand = $"curl https://raw.githubusercontent.com/acmesh-official/acme.sh/master/acme.sh | sh -s -- --install-online -m {acmeEmail}";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
if (currentShellCommandResult.Contains("Install success") == true)
@ -10302,7 +10315,7 @@ namespace ProxySU
//设置Caddy配置文件
//functionResult = SetCaddyfile(client, @"/etc/caddy/Caddyfile");
//if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
private bool SetCaddyfile(SshClient client,string upLoadPath)
private bool SetCaddyfile(SshClient client, string upLoadPath)
{
//设置Caddyfile文件中的tls 邮箱,在caddy2中已经不需要设置。
@ -10344,7 +10357,7 @@ namespace ProxySU
//condition---成功启动的条件
//functionResult = SoftStartDetect(client, "v2ray", @"/usr/local/bin/v2ray");
//if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
private bool SoftStartDetect(SshClient client,string soft,string condition)
private bool SoftStartDetect(SshClient client, string soft, string condition)
{
//****** "正在启动......" ******33
//SetUpProgressBarProcessing(87);

View File

@ -51,5 +51,5 @@ using System.Windows;
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.5.3.0")]
[assembly: AssemblyFileVersion("2.5.3.0")]
[assembly: AssemblyVersion("2.5.6.0")]
[assembly: AssemblyFileVersion("2.5.6.0")]

View File

@ -13,6 +13,7 @@
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<Deterministic>true</Deterministic>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
@ -23,10 +24,10 @@
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationRevision>1</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@ -51,6 +52,18 @@
<PropertyGroup>
<ApplicationIcon>ProxySU.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>01AFC64B121E781F77B42A6E9F1B587DDBAD475A</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>ProxySU_TemporaryKey.pfx</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>true</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<SignManifests>true</SignManifests>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json">
<HintPath>..\json.net\net40\Newtonsoft.Json.dll</HintPath>
@ -186,17 +199,11 @@
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>del "$(TargetDir)*.xml"
del "$(TargetDir)*.pdb"
del "$(TargetDir)*.zip"
mkdir "$(TargetDir)TemplateConfg"
xcopy /Y /E /R "$(TargetDir)..\..\..\TemplateConfg\*.*" "$(TargetDir)TemplateConfg\"
"$(TargetDir)..\..\..\7z\7z.exe" a $(TargetDir)Release.zip $(TargetDir) -xr!*config
rmdir /S /Q "$(TargetDir)..\Beta"
mkdir "$(TargetDir)..\Beta"
copy /Y "$(TargetDir)Release.zip" "$(TargetDir)..\Beta\Beta.zip"</PostBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PreBuildEvent>rmdir /S /Q "$(TargetDir)</PreBuildEvent>
<PreBuildEvent>
</PreBuildEvent>
</PropertyGroup>
</Project>

View File

@ -9,5 +9,9 @@
<ErrorReportUrlHistory />
<FallbackCulture>zh-CN</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
<ProjectView>ProjectFiles</ProjectView>
</PropertyGroup>
<PropertyGroup>
<EnableSecurityDebugging>false</EnableSecurityDebugging>
</PropertyGroup>
</Project>

View File

@ -27,6 +27,8 @@
<sys:String x:Key="RadioButtonProxyNoLogin">Not Login</sys:String>
<sys:String x:Key="RadiobuttonProxyYesLogin">Requires Login</sys:String>
<sys:String x:Key="TextBlockProxyHost">Proxy Addr:</sys:String>
<sys:String x:Key="AcmeEmail">Email</sys:String>
<sys:String x:Key="AcmeEmailDesc">Acme.sh SSL must an available email address.</sys:String>
<sys:String x:Key="ButtonSaveInstalledLog">Save Installation Log...</sys:String>
<sys:String x:Key="TextBlockSetUpProcessing">Waiting for installation and deployment</sys:String>
<sys:String x:Key="TabItemHeaderSysTools">System Tools</sys:String>

View File

@ -27,6 +27,8 @@
<sys:String x:Key="RadioButtonProxyNoLogin">不需登录</sys:String>
<sys:String x:Key="RadiobuttonProxyYesLogin">需要登录</sys:String>
<sys:String x:Key="TextBlockProxyHost">代理地址:</sys:String>
<sys:String x:Key="AcmeEmail">Email</sys:String>
<sys:String x:Key="AcmeEmailDesc">申请SSL证书需要一个可用的Email地址</sys:String>
<sys:String x:Key="ButtonSaveInstalledLog">安装日志另存为...</sys:String>
<sys:String x:Key="TextBlockSetUpProcessing">等待安装布署</sys:String>
<sys:String x:Key="TabItemHeaderSysTools">系统工具</sys:String>

View File

@ -27,6 +27,8 @@
<sys:String x:Key="RadioButtonProxyNoLogin">不需登錄</sys:String>
<sys:String x:Key="RadiobuttonProxyYesLogin">需要登錄</sys:String>
<sys:String x:Key="TextBlockProxyHost">代理地址:</sys:String>
<sys:String x:Key="AcmeEmail">Email</sys:String>
<sys:String x:Key="AcmeEmailDesc">申請SSL證書需要一個可用的Email地址</sys:String>
<sys:String x:Key="ButtonSaveInstalledLog">安裝日誌另存為...</sys:String>
<sys:String x:Key="TextBlockSetUpProcessing">等待安裝佈署</sys:String>
<sys:String x:Key="TabItemHeaderSysTools">系統工具</sys:String>

4
ProxySU/packages.config Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="SSH.NET" version="2016.1.0" targetFramework="net40" />
</packages>

View File

@ -267,7 +267,7 @@ Microsoft [.NET Framework 4.0](https://dotnet.microsoft.com/download/dotnet-fram
在使用遇到问题时,请先看一下[常见问题集锦](https://github.com/proxysu/windows/wiki/CommonError),如果还不能解决,可以到以上平台询问,个人精力有限,尽力解答。
## v1.0.0发布小记
足足用了近两个月的业余时间终于做成一个功能还算完善的版本。虽是一个简单的小工具没想到对于我这个初学C#的人,还是有点小吃力,如果不是因为武汉肺炎疫情被禁足在家还真没时间。学习C#,为啥编写这样一个小工具软件来练手?现在一键安装脚本多的是,这样的工具还有必要吗?咋说呢?我也不知道有多少人会喜欢这个小工具,只是觉得自己用着方便,也想方便一下别人吧,喜欢用就用,不喜欢,也随意。
足足用了近两个月的业余时间终于做成一个功能还算完善的版本。虽是一个简单的小工具没想到对于我这个初学C#的人,还是有点小吃力,如果不是因为新冠肺炎疫情被禁足在家还真没时间。学习C#,为啥编写这样一个小工具软件来练手?现在一键安装脚本多的是,这样的工具还有必要吗?咋说呢?我也不知道有多少人会喜欢这个小工具,只是觉得自己用着方便,也想方便一下别人吧,喜欢用就用,不喜欢,也随意。
生意又忙起来了,对于我这个业余的编程爱好者,可能没有多少业余时间继续折腾了,尽力吧。
记于2020.4.18
## V2.0.0发布小记