mirror of
https://github.com/proxysu/ProxySU.git
synced 2024-11-22 13:16:09 +03:00
Nat64网关是否可以连通github的测试
This commit is contained in:
parent
73a1d2c7ed
commit
4815a71ce9
@ -671,7 +671,7 @@
|
||||
<Button x:Name="ButtonEnableRootPassWord" Content="{DynamicResource ButtonEnableRootPassWord}" Grid.Column="0" Grid.Row="1" Margin="5" Click="ButtonEnableRootPassWord_Click"></Button>
|
||||
<Button x:Name="ButtonEnableRootCert" Content="{DynamicResource ButtonEnableRootCert}" Grid.Column="1" Grid.Row="1" Margin="5" Click="ButtonEnableRootCert_Click"></Button>
|
||||
<Button x:Name="ButtonRootProhibitsPasswordLogin" Content="{DynamicResource ButtonRootProhibitsPasswordLogin}" Grid.Column="2" Grid.Row="1" Margin="5" Click="ButtonRootProhibitsPasswordLogin_Click"></Button>
|
||||
<Button Content="test" Grid.Column="3" Grid.Row="2" Margin="10" Click="Button_Click" Visibility="Collapsed"></Button>
|
||||
<Button Content="test" Grid.Column="3" Grid.Row="2" Margin="10" Click="Button_Click" Visibility="Visible"></Button>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
|
@ -1131,8 +1131,10 @@ namespace ProxySU
|
||||
}
|
||||
|
||||
//下载安装脚本安装 37--40
|
||||
functionResult = V2RayInstallScript(client);
|
||||
functionResult = ProxySoftInstall(client, @"V2Ray", @"https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh");
|
||||
if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
|
||||
//functionResult = V2RayInstallScript(client);
|
||||
//if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
|
||||
|
||||
//程序是否安装成功检测 41--43
|
||||
functionResult = SoftInstalledSuccessOrFail(client, "v2ray", @"/usr/local/bin/v2ray");
|
||||
@ -1277,30 +1279,41 @@ namespace ProxySU
|
||||
//下载安装脚本安装V2Ray 37--40
|
||||
//functionResult = V2RayInstallScript(client);
|
||||
//if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
|
||||
private bool V2RayInstallScript(SshClient client)
|
||||
{
|
||||
//****** "系统环境检测完毕,符合安装要求,开始布署......" ******17
|
||||
currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstalling").ToString();
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
//private bool V2RayInstallScript(SshClient client)
|
||||
//{
|
||||
// //****** "系统环境检测完毕,符合安装要求,开始布署......" ******17
|
||||
// currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstalling").ToString();
|
||||
// MainWindowsShowInfo(currentStatus);
|
||||
|
||||
//下载官方安装脚本安装
|
||||
//****** "正在安装V2Ray......" ******19
|
||||
SetUpProgressBarProcessing(37);
|
||||
currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + "V2Ray......";
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
// //下载官方安装脚本安装
|
||||
// //****** "正在安装V2Ray......" ******19
|
||||
// SetUpProgressBarProcessing(37);
|
||||
// currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + "V2Ray......";
|
||||
// MainWindowsShowInfo(currentStatus);
|
||||
|
||||
sshShellCommand = $"curl -o /tmp/go.sh https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
// sshShellCommand = $"curl -o /tmp/go.sh https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh";
|
||||
// currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
sshShellCommand = @"yes | bash /tmp/go.sh -f";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
// functionResult = FileCheckExists(client, @"/tmp/go.sh");
|
||||
// if (functionResult == true)
|
||||
// {
|
||||
// sshShellCommand = @"yes | bash /tmp/go.sh -f";
|
||||
// currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
sshShellCommand = @"rm -f /tmp/go.sh";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
// sshShellCommand = @"rm -f /tmp/go.sh";
|
||||
// currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //***安装脚本下载失败!***
|
||||
// currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
|
||||
// MainWindowsShowInfo(currentStatus);
|
||||
// return false;
|
||||
// }
|
||||
|
||||
SetUpProgressBarProcessing(40);
|
||||
return true;
|
||||
}
|
||||
// SetUpProgressBarProcessing(40);
|
||||
// return true;
|
||||
//}
|
||||
|
||||
//生成V2Ray服务端配置 44--46
|
||||
//functionResult = GenerateServerConfiguration(client);
|
||||
@ -2109,10 +2122,14 @@ namespace ProxySU
|
||||
|
||||
//Thread.Sleep(1000);
|
||||
//检测是否安装V2Ray
|
||||
sshShellCommand = @"find / -name v2ray";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
//sshShellCommand = @"find / -name v2ray";
|
||||
//sshShellCommand = @"if [[ -f /usr/local/bin/v2ray ]];then echo '1';else echo '0'; fi";
|
||||
//currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
if (currentShellCommandResult.Contains("/usr/local/bin/v2ray") == false)
|
||||
//if (currentShellCommandResult.Contains("/usr/local/bin/v2ray") == false)
|
||||
//if (currentShellCommandResult.Trim().Equals("0") == true)
|
||||
functionResult = FileCheckExists(client, @"/usr/local/bin/v2ray");
|
||||
if (functionResult == false)
|
||||
{
|
||||
//******"退出!原因:远程主机未安装V2ray"******
|
||||
MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorUpgradeSoftNotInstall").ToString() + "V2Ray!");
|
||||
@ -2413,8 +2430,10 @@ namespace ProxySU
|
||||
if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
|
||||
|
||||
//下载脚本安装Trojan-go 37--40
|
||||
functionResult = TrojanGoInstall(client);
|
||||
functionResult = ProxySoftInstall(client, @"Trojan-go", @"https://raw.githubusercontent.com/proxysu/shellscript/master/trojan-go.sh");
|
||||
if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
|
||||
//functionResult = TrojanGoInstall(client);
|
||||
//if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
|
||||
|
||||
//程序是否安装成功检测并设置开机启动 41--43
|
||||
functionResult = SoftInstalledSuccessOrFail(client, "trojan-go", @"/usr/local/bin/trojan-go");
|
||||
@ -2591,30 +2610,42 @@ namespace ProxySU
|
||||
//下载脚本安装Trojan-go 37--40
|
||||
//functionResult = TrojanGoInstall(client);
|
||||
//if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
|
||||
private bool TrojanGoInstall(SshClient client)
|
||||
{
|
||||
//****** "系统环境检测完毕,符合安装要求,开始布署......" ******
|
||||
SetUpProgressBarProcessing(37);
|
||||
currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstalling").ToString();
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
//private bool TrojanGoInstall(SshClient client)
|
||||
//{
|
||||
// //****** "系统环境检测完毕,符合安装要求,开始布署......" ******
|
||||
// SetUpProgressBarProcessing(37);
|
||||
// currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstalling").ToString();
|
||||
// MainWindowsShowInfo(currentStatus);
|
||||
|
||||
//****** "正在安装Trojan-go......" ******
|
||||
SetUpProgressBarProcessing(38);
|
||||
currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + "Trojan-go......";
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
// //****** "正在安装Trojan-go......" ******
|
||||
// SetUpProgressBarProcessing(38);
|
||||
// currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + "Trojan-go......";
|
||||
// MainWindowsShowInfo(currentStatus);
|
||||
|
||||
sshShellCommand = $"curl -o /tmp/trojan-go.sh https://raw.githubusercontent.com/proxysu/shellscript/master/trojan-go.sh";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
// sshShellCommand = $"curl -o /tmp/trojan-go.sh https://raw.githubusercontent.com/proxysu/shellscript/master/trojan-go.sh";
|
||||
// currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
sshShellCommand = @"yes | bash /tmp/trojan-go.sh -f";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
// functionResult = FileCheckExists(client, @"/tmp/trojan-go.sh");
|
||||
// if (functionResult == true)
|
||||
// {
|
||||
// sshShellCommand = @"yes | bash /tmp/trojan-go.sh -f";
|
||||
// currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
sshShellCommand = @"rm -f /tmp/trojan-go.sh";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
// sshShellCommand = @"rm -f /tmp/trojan-go.sh";
|
||||
// currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //***安装脚本下载失败!***
|
||||
// currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
|
||||
// MainWindowsShowInfo(currentStatus);
|
||||
// return false;
|
||||
// }
|
||||
|
||||
SetUpProgressBarProcessing(40);
|
||||
return true;
|
||||
}
|
||||
|
||||
// SetUpProgressBarProcessing(40);
|
||||
// return true;
|
||||
//}
|
||||
|
||||
//生成Trojan-go服务端配置 44--46
|
||||
//functionResult = GenerateServerConfigurationTrojanGo(client);
|
||||
@ -2753,10 +2784,14 @@ namespace ProxySU
|
||||
|
||||
//string cmdTestTrojanInstalled = @"find / -name trojan-go";
|
||||
|
||||
sshShellCommand = @"find / -name trojan-go";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
//sshShellCommand = @"find / -name trojan-go";
|
||||
//sshShellCommand = @"if [[ -f /usr/local/bin/trojan-go ]];then echo '1';else echo '0'; fi";
|
||||
//currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
if (currentShellCommandResult.Contains("/usr/local/bin/trojan-go") == false)
|
||||
//if (currentShellCommandResult.Contains("/usr/local/bin/trojan-go") == false)
|
||||
//if (currentShellCommandResult.Trim().Equals("0") == true)
|
||||
functionResult = FileCheckExists(client, @"/usr/local/bin/trojan-go");
|
||||
if (functionResult == false)
|
||||
{
|
||||
//******"退出!原因:远程主机未安装Trojan-go"******
|
||||
MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorUpgradeSoftNotInstall").ToString() + "Trojan-go!");
|
||||
@ -2808,7 +2843,16 @@ namespace ProxySU
|
||||
sshShellCommand = $"curl -o /tmp/trojan-go.sh https://raw.githubusercontent.com/proxysu/shellscript/master/trojan-go.sh";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
sshShellCommand = @"yes | bash /tmp/trojan-go.sh -f";
|
||||
functionResult = FileCheckExists(client, @"/tmp/trojan-go.sh");
|
||||
if (functionResult == false)
|
||||
{
|
||||
//***文件下载失败!***
|
||||
currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
return;
|
||||
}
|
||||
|
||||
sshShellCommand = @"yes | bash /tmp/trojan-go.sh";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
sshShellCommand = @"rm -f /tmp/trojan-go.sh";
|
||||
@ -3021,20 +3065,23 @@ namespace ProxySU
|
||||
functionResult = DomainResolutionCurrentIPDetect(client);
|
||||
if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
|
||||
|
||||
//下载安装脚本安装
|
||||
//****** "正在安装Trojan......" ******
|
||||
SetUpProgressBarProcessing(37);
|
||||
currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + "Trojan......";
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
//下载安装脚本安装 37-40
|
||||
functionResult = ProxySoftInstall(client, @"Trojan", @"https://raw.githubusercontent.com/trojan-gfw/trojan-quickstart/master/trojan-quickstart.sh");
|
||||
if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
|
||||
|
||||
sshShellCommand = $"curl -o /tmp/trojan-quickstart.sh https://raw.githubusercontent.com/trojan-gfw/trojan-quickstart/master/trojan-quickstart.sh";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
////****** "正在安装Trojan......" ******
|
||||
//SetUpProgressBarProcessing(37);
|
||||
//currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + "Trojan......";
|
||||
//MainWindowsShowInfo(currentStatus);
|
||||
|
||||
sshShellCommand = @"yes | bash /tmp/trojan-quickstart.sh";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
//sshShellCommand = $"curl -o /tmp/trojan-quickstart.sh https://raw.githubusercontent.com/trojan-gfw/trojan-quickstart/master/trojan-quickstart.sh";
|
||||
//currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
sshShellCommand = @"rm -f /tmp/trojan-quickstart.sh";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
//sshShellCommand = @"yes | bash /tmp/trojan-quickstart.sh";
|
||||
//currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
//sshShellCommand = @"rm -f /tmp/trojan-quickstart.sh";
|
||||
//currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
//程序是否安装成功检测并设置开机启动 41--43
|
||||
functionResult = SoftInstalledSuccessOrFail(client, "trojan", @"/usr/local/bin/trojan");
|
||||
@ -3284,10 +3331,14 @@ namespace ProxySU
|
||||
|
||||
//string cmdTestTrojanInstalled = @"find / -name trojan";
|
||||
//string resultCmdTestTrojanInstalled = client.RunCommand(cmdTestTrojanInstalled).Result;
|
||||
sshShellCommand = @"find / -name trojan";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
//sshShellCommand = @"find / -name trojan";
|
||||
//sshShellCommand = @"if [[ -f /usr/local/bin/trojan ]];then echo '1';else echo '0'; fi";
|
||||
//currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
if (currentShellCommandResult.Contains("/usr/local/bin/trojan") == false)
|
||||
//if (currentShellCommandResult.Contains("/usr/local/bin/trojan") == false)
|
||||
//if (currentShellCommandResult.Trim().Equals("0") == true)
|
||||
functionResult = FileCheckExists(client, @"/usr/local/bin/trojan");
|
||||
if (functionResult == false)
|
||||
{
|
||||
//******"退出!原因:远程主机未安装Trojan"******
|
||||
MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorUpgradeSoftNotInstall").ToString() + "Trojan!");
|
||||
@ -3353,6 +3404,15 @@ namespace ProxySU
|
||||
sshShellCommand = $"curl -o /tmp/trojan-quickstart.sh https://raw.githubusercontent.com/trojan-gfw/trojan-quickstart/master/trojan-quickstart.sh";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
functionResult = FileCheckExists(client, @"/tmp/trojan-quickstart.sh");
|
||||
if (functionResult == false)
|
||||
{
|
||||
//***文件下载失败!***
|
||||
currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
return;
|
||||
}
|
||||
|
||||
sshShellCommand = @"yes | bash /tmp/trojan-quickstart.sh";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
@ -3573,6 +3633,14 @@ namespace ProxySU
|
||||
sshShellCommand = $"curl -o /tmp/caddy.zip https://raw.githubusercontent.com/proxysu/Resources/master/Caddy2/caddy2.zip";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
functionResult = FileCheckExists(client, @"/tmp/caddy.zip");
|
||||
if (functionResult == false)
|
||||
{
|
||||
//***文件下载失败!***
|
||||
currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
return;
|
||||
}
|
||||
sshShellCommand = @"yes | unzip -o /tmp/caddy.zip";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
@ -3933,26 +4001,29 @@ namespace ProxySU
|
||||
functionResult = DomainResolutionCurrentIPDetect(client);
|
||||
if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
|
||||
|
||||
//下载脚本安装SSR 37--40
|
||||
functionResult = ProxySoftInstall(client, @"SSR", @"https://raw.githubusercontent.com/proxysu/shellscript/master/ssr/ssr.sh");
|
||||
if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
|
||||
|
||||
//****** "系统环境检测完毕,符合安装要求,开始布署......" ******
|
||||
SetUpProgressBarProcessing(37);
|
||||
currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstalling").ToString();
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
////****** "系统环境检测完毕,符合安装要求,开始布署......" ******
|
||||
//SetUpProgressBarProcessing(37);
|
||||
//currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstalling").ToString();
|
||||
//MainWindowsShowInfo(currentStatus);
|
||||
|
||||
//下载安装脚本安装
|
||||
//****** "正在安装SSR......" ******
|
||||
SetUpProgressBarProcessing(38);
|
||||
currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + "SSR......";
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
////下载安装脚本安装
|
||||
////****** "正在安装SSR......" ******
|
||||
//SetUpProgressBarProcessing(38);
|
||||
//currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + "SSR......";
|
||||
//MainWindowsShowInfo(currentStatus);
|
||||
|
||||
sshShellCommand = $"curl -o /tmp/ssr.sh https://raw.githubusercontent.com/proxysu/shellscript/master/ssr/ssr.sh";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
//sshShellCommand = $"curl -o /tmp/ssr.sh https://raw.githubusercontent.com/proxysu/shellscript/master/ssr/ssr.sh";
|
||||
//currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
sshShellCommand = @"yes | bash /tmp/ssr.sh";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
//sshShellCommand = @"yes | bash /tmp/ssr.sh";
|
||||
//currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
sshShellCommand = @"rm -f /tmp/ssr.sh";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
//sshShellCommand = @"rm -f /tmp/ssr.sh";
|
||||
//currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
//程序是否安装成功检测并设置开机启动 41--43
|
||||
functionResult = SoftInstalledSuccessOrFail(client, "server.py", @"/usr/local/shadowsocks/server.py");
|
||||
@ -4330,6 +4401,15 @@ namespace ProxySU
|
||||
sshShellCommand = $"curl -o /tmp/install.sh https://raw.githubusercontent.com/proxysu/shellscript/master/ss/ss-install.sh";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
functionResult = FileCheckExists(client, @"/tmp/install.sh");
|
||||
if (functionResult == false)
|
||||
{
|
||||
//***文件下载失败!***
|
||||
currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
return;
|
||||
}
|
||||
|
||||
sshShellCommand = @"yes | bash /tmp/install.sh";
|
||||
TextBoxMonitorCommandResults.Dispatcher.BeginInvoke(updateMonitorAction, TextBoxMonitorCommandResults, sshShellCommand);//显示执行的命令
|
||||
|
||||
@ -4469,6 +4549,15 @@ namespace ProxySU
|
||||
sshShellCommand = $"curl -o /tmp/install.sh https://raw.githubusercontent.com/proxysu/shellscript/master/ss/ss-plugins/cloak-plugin-install.sh";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
functionResult = FileCheckExists(client, @"/tmp/install.sh");
|
||||
if (functionResult == false)
|
||||
{
|
||||
//***文件下载失败!***
|
||||
currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
return;
|
||||
}
|
||||
|
||||
sshShellCommand = @"yes | bash /tmp/install.sh";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
@ -4516,6 +4605,15 @@ namespace ProxySU
|
||||
sshShellCommand = $"curl -o /tmp/install.sh https://raw.githubusercontent.com/proxysu/shellscript/master/ss/ss-plugins/obfs-install.sh";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
functionResult = FileCheckExists(client, @"/tmp/install.sh");
|
||||
if (functionResult == false)
|
||||
{
|
||||
//***文件下载失败!***
|
||||
currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
return;
|
||||
}
|
||||
|
||||
sshShellCommand = @"yes | bash /tmp/install.sh";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
@ -4538,6 +4636,15 @@ namespace ProxySU
|
||||
sshShellCommand = $"curl -o /tmp/install.sh https://raw.githubusercontent.com/proxysu/shellscript/master/ss/ss-plugins/v2ray-plugin-install.sh";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
functionResult = FileCheckExists(client, @"/tmp/install.sh");
|
||||
if (functionResult == false)
|
||||
{
|
||||
//***文件下载失败!***
|
||||
currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
return;
|
||||
}
|
||||
|
||||
sshShellCommand = @"yes | bash /tmp/install.sh";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
@ -4559,6 +4666,15 @@ namespace ProxySU
|
||||
sshShellCommand = $"curl -o /tmp/install.sh https://raw.githubusercontent.com/proxysu/shellscript/master/ss/ss-plugins/kcptun-plugin-install.sh";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
functionResult = FileCheckExists(client, @"/tmp/install.sh");
|
||||
if (functionResult == false)
|
||||
{
|
||||
//***文件下载失败!***
|
||||
currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
return;
|
||||
}
|
||||
|
||||
sshShellCommand = @"yes | bash /tmp/install.sh";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
@ -4580,6 +4696,15 @@ namespace ProxySU
|
||||
sshShellCommand = $"curl -o /tmp/install.sh https://raw.githubusercontent.com/proxysu/shellscript/master/ss/ss-plugins/goquiet-plugin-install.sh";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
functionResult = FileCheckExists(client, @"/tmp/install.sh");
|
||||
if (functionResult == false)
|
||||
{
|
||||
//***文件下载失败!***
|
||||
currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
return;
|
||||
}
|
||||
|
||||
sshShellCommand = @"yes | bash /tmp/install.sh";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
@ -4834,6 +4959,7 @@ namespace ProxySU
|
||||
}
|
||||
|
||||
//下载安装脚本安装MTProto 37--40
|
||||
|
||||
functionResult = MTProtoInstall(client);
|
||||
if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
|
||||
|
||||
@ -4948,6 +5074,15 @@ namespace ProxySU
|
||||
sshShellCommand = $"curl -o /tmp/mtg_install.sh https://raw.githubusercontent.com/proxysu/shellscript/master/MTProto/mtg_install.sh";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
functionResult = FileCheckExists(client, @"/tmp/installproxy.sh");
|
||||
if (functionResult == false)
|
||||
{
|
||||
//***文件下载失败!***
|
||||
currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
return false;
|
||||
}
|
||||
|
||||
sshShellCommand = $"yes | bash /tmp/mtg_install.sh {ReceiveConfigurationParameters[1]} {ReceiveConfigurationParameters[7]}";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
@ -4955,10 +5090,8 @@ namespace ProxySU
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
SetUpProgressBarProcessing(40);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 其他功能函数及系统工具相关
|
||||
@ -5509,10 +5642,10 @@ namespace ProxySU
|
||||
currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "V2ray......";
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
|
||||
sshShellCommand = @"find / -name v2ray";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
if (currentShellCommandResult.Contains("/usr/local/bin/v2ray") == true)
|
||||
//sshShellCommand = @"find / -name v2ray";
|
||||
//currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
functionResult = FileCheckExists(client, @"/usr/local/bin/v2ray");
|
||||
if (functionResult == true)
|
||||
{
|
||||
//******"检测到已安装V2Ray!开始卸载V2Ray......"******
|
||||
SetUpProgressBarProcessing(12);
|
||||
@ -5540,10 +5673,12 @@ namespace ProxySU
|
||||
sshShellCommand = @"rm -f install-release.sh";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
sshShellCommand = @"find / -name v2ray";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
//sshShellCommand = @"find / -name v2ray";
|
||||
//currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
if (currentShellCommandResult.Contains("/usr/local/bin/v2ray") == true)
|
||||
functionResult = FileCheckExists(client, @"/usr/local/bin/v2ray");
|
||||
if (functionResult == true)
|
||||
//if (currentShellCommandResult.Contains("/usr/local/bin/v2ray") == true)
|
||||
{
|
||||
//******"V2Ray卸载失败!请向开发者问询!"******
|
||||
currentStatus = "V2Ray" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString();
|
||||
@ -5575,10 +5710,12 @@ namespace ProxySU
|
||||
currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "Trojan-go......";
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
|
||||
sshShellCommand = @"find / -name trojan-go";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
//sshShellCommand = @"find / -name trojan-go";
|
||||
//currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
if (currentShellCommandResult.Contains("/usr/local/bin/trojan-go") == true)
|
||||
//if (currentShellCommandResult.Contains("/usr/local/bin/trojan-go") == true)
|
||||
functionResult = FileCheckExists(client, @"/usr/local/bin/trojan-go");
|
||||
if (functionResult == true)
|
||||
{
|
||||
//******"检测到已安装Trojan-go,开始卸载Trojan-go......"******
|
||||
SetUpProgressBarProcessing(18);
|
||||
@ -5606,10 +5743,12 @@ namespace ProxySU
|
||||
sshShellCommand = @"rm -f trojan-go.sh";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
sshShellCommand = @"find / -name trojan-go";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
//sshShellCommand = @"find / -name trojan-go";
|
||||
//currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
if (currentShellCommandResult.Contains("/usr/local/bin/trojan-go") == true)
|
||||
//if (currentShellCommandResult.Contains("/usr/local/bin/trojan-go") == true)
|
||||
functionResult = FileCheckExists(client, @"/usr/local/bin/trojan-go");
|
||||
if (functionResult == true)
|
||||
{
|
||||
//******"Trojan-go卸载失败!请向开发者问询!"******
|
||||
currentStatus = "Trojan-go" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString();
|
||||
@ -5641,10 +5780,12 @@ namespace ProxySU
|
||||
currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "Trojan......";
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
|
||||
sshShellCommand = @"find / -name trojan";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
//sshShellCommand = @"find / -name trojan";
|
||||
//currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
if (currentShellCommandResult.Contains("/usr/local/bin/trojan") == true)
|
||||
//if (currentShellCommandResult.Contains("/usr/local/bin/trojan") == true)
|
||||
functionResult = FileCheckExists(client, @"/usr/local/bin/trojan");
|
||||
if (functionResult == true)
|
||||
{
|
||||
//******"检测到已安装Trojan,开始卸载Trojan......"******
|
||||
SetUpProgressBarProcessing(24);
|
||||
@ -5663,10 +5804,12 @@ namespace ProxySU
|
||||
sshShellCommand = @"rm -rf /usr/local/bin/trojan /etc/systemd/system/trojan.service /usr/local/etc/trojan";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
sshShellCommand = @"find / -name trojan";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
//sshShellCommand = @"find / -name trojan";
|
||||
//currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
if (currentShellCommandResult.Contains("/usr/local/bin/trojan") == true)
|
||||
//if (currentShellCommandResult.Contains("/usr/local/bin/trojan") == true)
|
||||
functionResult = FileCheckExists(client, @"/usr/local/bin/trojan");
|
||||
if (functionResult == true)
|
||||
{
|
||||
//******"Trojan卸载失败!请向开发者问询!"******
|
||||
currentStatus = "Trojan" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString();
|
||||
@ -5698,10 +5841,12 @@ namespace ProxySU
|
||||
currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "SSR......";
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
|
||||
sshShellCommand = @"if [ -f /usr/local/shadowsocks/server.py ];then echo '1';else echo '0'; fi";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
//sshShellCommand = @"if [ -f /usr/local/shadowsocks/server.py ];then echo '1';else echo '0'; fi";
|
||||
//currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
if (currentShellCommandResult.Contains("1") == true)
|
||||
//if (currentShellCommandResult.Contains("1") == true)
|
||||
functionResult = FileCheckExists(client, @"/usr/local/shadowsocks/server.py");
|
||||
if (functionResult == true)
|
||||
{
|
||||
//******"检测到已安装SSR,开始卸载SSR......"******
|
||||
SetUpProgressBarProcessing(32);
|
||||
@ -5726,10 +5871,12 @@ namespace ProxySU
|
||||
sshShellCommand = @"rm -f ssr.sh";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
sshShellCommand = @"if [ -f /usr/local/shadowsocks/server.py ];then echo '1';else echo '0'; fi";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
//sshShellCommand = @"if [ -f /usr/local/shadowsocks/server.py ];then echo '1';else echo '0'; fi";
|
||||
//currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
if (currentShellCommandResult.Contains("1") == true)
|
||||
//if (currentShellCommandResult.Contains("1") == true)
|
||||
functionResult = FileCheckExists(client, @"/usr/local/shadowsocks/server.py");
|
||||
if (functionResult == true)
|
||||
{
|
||||
//******"SSR卸载失败!请向开发者问询!"******
|
||||
currentStatus = "SSR" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString();
|
||||
@ -5761,10 +5908,12 @@ namespace ProxySU
|
||||
currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "SS (Shadowsoks-libev)......";
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
|
||||
sshShellCommand = @"find / -name ss-server";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
//sshShellCommand = @"find / -name ss-server";
|
||||
//currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
if (currentShellCommandResult.Contains("/usr/local/bin/ss-server") == true)
|
||||
//if (currentShellCommandResult.Contains("/usr/local/bin/ss-server") == true)
|
||||
functionResult = FileCheckExists(client, @"/usr/local/bin/ss-server");
|
||||
if (functionResult == true)
|
||||
{
|
||||
//******"检测到SS(Shadowsoks-libev),开始卸载SS(Shadowsoks-libev)......"******
|
||||
SetUpProgressBarProcessing(38);
|
||||
@ -5793,10 +5942,12 @@ namespace ProxySU
|
||||
sshShellCommand = @"rm -f /usr/local/bin/obfs-server /usr/local/bin/obfs-local /usr/local/bin/v2ray-plugin /usr/local/bin/kcptun-plugin-server /usr/local/bin/goquiet-plugin-server /usr/local/bin/cloak-plugin-server";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
sshShellCommand = @"find / -name ss-server";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
//sshShellCommand = @"find / -name ss-server";
|
||||
//currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
if (currentShellCommandResult.Contains("/usr/local/bin/ss-server") == true)
|
||||
//if (currentShellCommandResult.Contains("/usr/local/bin/ss-server") == true)
|
||||
functionResult = FileCheckExists(client, @"/usr/local/bin/ss-server");
|
||||
if (functionResult == true)
|
||||
{
|
||||
//******"SS(Shadowsoks-libev)卸载失败!请向开发者问询!"******
|
||||
currentStatus = "SS (Shadowsoks-libev)" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString();
|
||||
@ -5829,7 +5980,7 @@ namespace ProxySU
|
||||
currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "acme.sh......";
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
|
||||
sshShellCommand = @"if [ -d ~/.acme.sh ];then echo '1';else echo '0'; fi";
|
||||
sshShellCommand = @"if [[ -d ~/.acme.sh ]];then echo '1';else echo '0'; fi";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
if (currentShellCommandResult.Contains("1") == true)
|
||||
@ -5848,7 +5999,7 @@ namespace ProxySU
|
||||
sshShellCommand = @"rm -r ~/.acme.sh";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
sshShellCommand = @"if [ -d ~/.acme.sh ];then echo '1';else echo '0'; fi";
|
||||
sshShellCommand = @"if [[ -d ~/.acme.sh ]];then echo '1';else echo '0'; fi";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
if (currentShellCommandResult.Contains("1") == true)
|
||||
@ -5883,10 +6034,12 @@ namespace ProxySU
|
||||
currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "Caddy/NaiveProxy......";
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
|
||||
sshShellCommand = @"find / -name caddy";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
//sshShellCommand = @"find / -name caddy";
|
||||
//currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
if (currentShellCommandResult.Contains("/usr/bin/caddy") == true)
|
||||
//if (currentShellCommandResult.Contains("/usr/bin/caddy") == true)
|
||||
functionResult = FileCheckExists(client, @"/usr/bin/caddy");
|
||||
if (functionResult == true)
|
||||
{
|
||||
//******"检测到Caddy/NaiveProxy,开始卸载Caddy/NaiveProxy......"******
|
||||
SetUpProgressBarProcessing(49);
|
||||
@ -5951,10 +6104,12 @@ namespace ProxySU
|
||||
sshShellCommand = $"{sshCmdRemove}caddy";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
sshShellCommand = @"find / -name caddy";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
//sshShellCommand = @"find / -name caddy";
|
||||
//currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
if (currentShellCommandResult.Contains("/usr/local/bin/caddy") == true)
|
||||
//if (currentShellCommandResult.Contains("/usr/local/bin/caddy") == true)
|
||||
functionResult = FileCheckExists(client, @"/usr/bin/caddy");
|
||||
if (functionResult == true)
|
||||
{
|
||||
//******"Caddy/NaiveProxy卸载失败!请向开发者问询!"******
|
||||
currentStatus = "Caddy/NaiveProxy" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString();
|
||||
@ -5985,10 +6140,12 @@ namespace ProxySU
|
||||
currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "MtProto......";
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
|
||||
sshShellCommand = @"find / -name mtg";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
//sshShellCommand = @"find / -name mtg";
|
||||
//currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
if (currentShellCommandResult.Contains("/usr/local/bin/mtg") == true)
|
||||
//if (currentShellCommandResult.Contains("/usr/local/bin/mtg") == true)
|
||||
functionResult = FileCheckExists(client, @"/usr/local/bin/mtg");
|
||||
if (functionResult == true)
|
||||
{
|
||||
//******"检测到MtProto,开始卸载MtProto......"******
|
||||
SetUpProgressBarProcessing(63);
|
||||
@ -6016,10 +6173,12 @@ namespace ProxySU
|
||||
sshShellCommand = @"rm -rf /usr/local/etc/mtg.sh";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
sshShellCommand = @"find / -name mtg";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
//sshShellCommand = @"find / -name mtg";
|
||||
//currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
if (currentShellCommandResult.Contains("/usr/local/bin/mtg") == true)
|
||||
//if (currentShellCommandResult.Contains("/usr/local/bin/mtg") == true)
|
||||
functionResult = FileCheckExists(client, @"/usr/local/bin/mtg");
|
||||
if (functionResult == true)
|
||||
{
|
||||
//******"MtProto卸载失败!请向开发者问询!"******
|
||||
currentStatus = "MtProto" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString();
|
||||
@ -6863,30 +7022,42 @@ namespace ProxySU
|
||||
#region 测试用代码
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
proxyType = "TrojanGo";
|
||||
ResultClientInformation resultClientInformation = new ResultClientInformation();
|
||||
resultClientInformation.ShowDialog();
|
||||
return;
|
||||
//proxyType = "TrojanGo";
|
||||
//ResultClientInformation resultClientInformation = new ResultClientInformation();
|
||||
//resultClientInformation.ShowDialog();
|
||||
//return;
|
||||
//string pwdir = AppDomain.CurrentDomain.BaseDirectory;
|
||||
//MessageBox.Show(pwdir);
|
||||
//ConnectionInfo connectionInfo = GenerateConnectionInfo();
|
||||
//if (connectionInfo == null)
|
||||
//{
|
||||
// //****** "远程主机连接信息有误,请检查!" ******
|
||||
// MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
|
||||
// return;
|
||||
//}
|
||||
//using (var client = new SshClient(connectionInfo))
|
||||
//{
|
||||
// client.Connect();
|
||||
// if (client.IsConnected == true)
|
||||
// {
|
||||
// //******"主机登录成功"******
|
||||
// SetUpProgressBarProcessing(3);
|
||||
// currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
|
||||
// MainWindowsShowInfo(currentStatus);
|
||||
ConnectionInfo connectionInfo = GenerateConnectionInfo();
|
||||
if (connectionInfo == null)
|
||||
{
|
||||
//****** "远程主机连接信息有误,请检查!" ******
|
||||
MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
|
||||
return;
|
||||
}
|
||||
using (var client = new SshClient(connectionInfo))
|
||||
{
|
||||
client.Connect();
|
||||
if (client.IsConnected == true)
|
||||
{
|
||||
//******"主机登录成功"******
|
||||
SetUpProgressBarProcessing(3);
|
||||
currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
|
||||
// }
|
||||
}
|
||||
string fileProxy = @"/usr/local/bin/v2ray";
|
||||
sshShellCommand = $"if [[ -f {fileProxy} ]];then echo '1';else echo '0'; fi";
|
||||
//sshShellCommand = @"if [[ -f /usr/local/bin/v2ray ]];then echo '1';else echo '0'; fi";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
if (currentShellCommandResult.Trim().Equals("0") == true)
|
||||
{
|
||||
MessageBox.Show("0");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("1");
|
||||
}
|
||||
// SetUpNat64(client, true);
|
||||
//FilterFastestIP(client);
|
||||
//string cmdErr = client.RunCommand(@"aaa ee").Error;
|
||||
@ -6919,7 +7090,7 @@ namespace ProxySU
|
||||
//{
|
||||
// MessageBox.Show("disConnected");
|
||||
//}
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
private string CaddyInstallTest(SshClient client)
|
||||
@ -6993,27 +7164,44 @@ namespace ProxySU
|
||||
//****** "正在查找最快的Nat64网关......" ******
|
||||
currentStatus = Application.Current.FindResource("DisplayInstallInfo_FindFastestSetUpNat64").ToString();
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
string[] dns64 = new string[2];
|
||||
dns64 = FilterFastestIP(client);
|
||||
//string[] dns64 = new string[2];
|
||||
var dns64 = FilterFastestIP(client);
|
||||
|
||||
//****** "当前主机最快的Nat64网关为:" ******
|
||||
currentStatus = Application.Current.FindResource("DisplayInstallInfo_FindFastestNat64AsIs").ToString();
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
//currentStatus = Application.Current.FindResource("DisplayInstallInfo_FindFastestNat64AsIs").ToString();
|
||||
//MainWindowsShowInfo(currentStatus);
|
||||
|
||||
currentStatus = dns64[0];
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
currentStatus = dns64[1];
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
//currentStatus = dns64[0];
|
||||
//MainWindowsShowInfo(currentStatus);
|
||||
//currentStatus = dns64[1];
|
||||
//MainWindowsShowInfo(currentStatus);
|
||||
|
||||
//****** "正在设置Nat64网关......" ******
|
||||
currentStatus = Application.Current.FindResource("DisplayInstallInfo_SetUpNat64").ToString();
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
|
||||
sshShellCommand = @"mv /etc/resolv.conf /etc/resolv.conf.bak";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
sshShellCommand = $"echo \"nameserver {dns64[0]}\" >>/etc/resolv.conf";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
sshShellCommand = $"echo \"nameserver {dns64[1]}\" >>/etc/resolv.conf";
|
||||
|
||||
foreach (string gateip in dns64)
|
||||
{
|
||||
sshShellCommand = $"echo \"nameserver {gateip}\" > /etc/resolv.conf";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
sshShellCommand = @"curl -fsSL https://api.github.com/repos/proxysu/windows/releases/latest";
|
||||
//currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
SshCommand currentShellCommand = client.RunCommand(sshShellCommand);
|
||||
int cmdExitStatus = currentShellCommand.ExitStatus;
|
||||
if (cmdExitStatus == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//sshShellCommand = $"echo \"nameserver {dns64[1]}\" >>/etc/resolv.conf";
|
||||
//currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -7047,7 +7235,7 @@ namespace ProxySU
|
||||
"2a00:1098:2c::1",
|
||||
"2a09:11c0:100::53",
|
||||
};
|
||||
string[] returnstr = new string[2];
|
||||
|
||||
List<NatDns64> NatDns64s = new List<NatDns64>();
|
||||
foreach (string gateip in gateNat64)
|
||||
{
|
||||
@ -7066,9 +7254,14 @@ namespace ProxySU
|
||||
|
||||
}
|
||||
NatDns64s = NatDns64s.OrderBy(o => o.Avg).ToList();
|
||||
returnstr[0] = NatDns64s[0].IpAddr;
|
||||
returnstr[1] = NatDns64s[1].IpAddr;
|
||||
|
||||
int listCount = NatDns64s.Count;
|
||||
string[] returnstr = new string[listCount];
|
||||
for(int i=0;i<listCount;i++)
|
||||
{
|
||||
returnstr[i] = NatDns64s[i].IpAddr;
|
||||
}
|
||||
//returnstr[0] = NatDns64s[0].IpAddr;
|
||||
//returnstr[1] = NatDns64s[1].IpAddr;
|
||||
return returnstr;
|
||||
}
|
||||
|
||||
@ -7127,6 +7320,23 @@ namespace ProxySU
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
return "";
|
||||
}
|
||||
|
||||
//判断某个文件是否存在
|
||||
//functionResult = FileCheckExists(client, @"/usr/local/bin/mtg");
|
||||
private bool FileCheckExists(SshClient client, string pathFile)
|
||||
{
|
||||
sshShellCommand = $"if [[ -f {pathFile} ]];then echo '1';else echo '0'; fi";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
if (currentShellCommandResult.Trim().Equals("1") == true)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
//检测root权限 5--7
|
||||
@ -7174,11 +7384,13 @@ namespace ProxySU
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
|
||||
|
||||
sshShellCommand = $"find / -name {soft}";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
//sshShellCommand = $"find / -name {soft}";
|
||||
//currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
//string resultCmdTestV2rayInstalled = currentShellCommandResult;
|
||||
if (currentShellCommandResult.Contains($"{condition}") == true)
|
||||
//if (currentShellCommandResult.Contains($"{condition}") == true)
|
||||
functionResult = FileCheckExists(client, condition);
|
||||
if (functionResult == true)
|
||||
{
|
||||
//******"远程主机已安装V2ray,是否强制重新安装?"******
|
||||
string messageShow = Application.Current.FindResource("MessageBoxShow_ExistedSoft").ToString() +
|
||||
@ -7750,8 +7962,39 @@ namespace ProxySU
|
||||
|
||||
|
||||
//安装代理程序 37--40
|
||||
private bool SoftInstall()
|
||||
//functionResult = ProxySoftInstall(client,@"",@"");
|
||||
//if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
|
||||
private bool ProxySoftInstall(SshClient client,string proxyName,string downloadUrl)
|
||||
{
|
||||
//****** "系统环境检测完毕,符合安装要求,开始布署......" ******
|
||||
SetUpProgressBarProcessing(37);
|
||||
currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstalling").ToString();
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
|
||||
//****** "正在安装{proxyName}......" ******
|
||||
SetUpProgressBarProcessing(38);
|
||||
currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + $"{proxyName}......";
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
|
||||
sshShellCommand = $"curl -o /tmp/installproxy.sh {downloadUrl}";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
functionResult = FileCheckExists(client, @"/tmp/installproxy.sh");
|
||||
if (functionResult == false)
|
||||
{
|
||||
//***文件下载失败!***
|
||||
currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
|
||||
MainWindowsShowInfo(currentStatus);
|
||||
return false;
|
||||
|
||||
}
|
||||
sshShellCommand = @"yes | bash /tmp/installproxy.sh";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
sshShellCommand = @"rm -f /tmp/installproxy.sh";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
SetUpProgressBarProcessing(40);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -7763,10 +8006,14 @@ namespace ProxySU
|
||||
private bool SoftInstalledSuccessOrFail(SshClient client,string soft,string condition)
|
||||
{
|
||||
SetUpProgressBarProcessing(41);
|
||||
sshShellCommand = $"find / -name {soft}";
|
||||
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
//sshShellCommand = $"find / -name {soft}";
|
||||
//sshShellCommand = $"if [[ -f {condition} ]];then echo '1';else echo '0'; fi";
|
||||
//currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
|
||||
|
||||
if (!currentShellCommandResult.Contains($"{condition}"))
|
||||
bool functionResult = FileCheckExists(client, condition);
|
||||
|
||||
//if (!currentShellCommandResult.Contains($"{condition}"))
|
||||
if (functionResult == false)
|
||||
{
|
||||
//****** "安装失败,官方脚本运行出错!" ******
|
||||
MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorInstallSoftFail").ToString());
|
||||
@ -7958,10 +8205,14 @@ namespace ProxySU
|
||||
|
||||
}
|
||||
|
||||
sshShellCommand = @"find / -name caddy";
|
||||
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);
|
||||
|
||||
if (!currentShellCommandResult.Contains("/usr/bin/caddy"))
|
||||
//if (!currentShellCommandResult.Contains("/usr/bin/caddy"))
|
||||
//if (currentShellCommandResult.Trim().Equals("0") == true)
|
||||
functionResult = FileCheckExists(client, @"/usr/bin/caddy");
|
||||
if (functionResult == false)
|
||||
{
|
||||
//****** "安装Caddy失败!" ******
|
||||
MessageBox.Show(Application.Current.FindResource("DisplayInstallInfo_ErrorInstallCaddyFail").ToString());
|
||||
|
@ -306,6 +306,7 @@
|
||||
<sys:String x:Key="DisplayInstallInfo_StartInstalling">The system environment has been tested and the installation requirements are met, and the deployment begins...</sys:String>
|
||||
<sys:String x:Key="DisplayInstallInfo_OpenFireWallPort">Open the corresponding port of the firewall...</sys:String>
|
||||
<sys:String x:Key="DisplayInstallInfo_StartInstallSoft">Installing</sys:String>
|
||||
<sys:String x:Key="DisplayInstallInfo_DownloadScriptFailed">File download failed!</sys:String>
|
||||
<sys:String x:Key="DisplayInstallInfo_CompilingSS">Compiling, please wait patiently.............</sys:String>
|
||||
<sys:String x:Key="MessageBoxShow_ErrorInstallSoftFail">The installation failed, the script runs incorrectly!</sys:String>
|
||||
<sys:String x:Key="DisplayInstallInfo_SoftInstallSuccess">The installation is successful!</sys:String>
|
||||
|
@ -311,6 +311,7 @@
|
||||
<sys:String x:Key="DisplayInstallInfo_StartInstalling">系统环境检测完毕,符合安装要求,开始布署......</sys:String>
|
||||
<sys:String x:Key="DisplayInstallInfo_OpenFireWallPort">开启防火墙相应端口......</sys:String>
|
||||
<sys:String x:Key="DisplayInstallInfo_StartInstallSoft">正在安装</sys:String>
|
||||
<sys:String x:Key="DisplayInstallInfo_DownloadScriptFailed">文件下载失败!</sys:String>
|
||||
<sys:String x:Key="DisplayInstallInfo_CompilingSS">编译中,请耐心等待.............</sys:String>
|
||||
<sys:String x:Key="MessageBoxShow_ErrorInstallSoftFail">安装失败,脚本运行出错!</sys:String>
|
||||
<sys:String x:Key="DisplayInstallInfo_SoftInstallSuccess">安装成功!</sys:String>
|
||||
|
@ -306,6 +306,7 @@
|
||||
<sys:String x:Key="DisplayInstallInfo_StartInstalling">系統環境檢測完畢,符合安裝要求,開始佈署......</sys:String>
|
||||
<sys:String x:Key="DisplayInstallInfo_OpenFireWallPort">開啟防火牆相應端口......</sys:String>
|
||||
<sys:String x:Key="DisplayInstallInfo_StartInstallSoft">正在安裝</sys:String>
|
||||
<sys:String x:Key="DisplayInstallInfo_DownloadScriptFailed">文件下載失敗!</sys:String>
|
||||
<sys:String x:Key="DisplayInstallInfo_CompilingSS">編譯中,請耐心等待.............</sys:String>
|
||||
<sys:String x:Key="MessageBoxShow_ErrorInstallSoftFail">安裝失敗,腳本運行出錯!</sys:String>
|
||||
<sys:String x:Key="DisplayInstallInfo_SoftInstallSuccess">安裝成功!</sys:String>
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user