1
0
mirror of https://github.com/proxysu/ProxySU.git synced 2024-11-22 21:26:09 +03:00

Nat64网关是否可以连通github的测试

This commit is contained in:
ProxySU 2020-10-30 23:45:10 +08:00
parent 73a1d2c7ed
commit 4815a71ce9
6 changed files with 527 additions and 273 deletions

View File

@ -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="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="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 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> </Grid>
</TabItem> </TabItem>

View File

@ -1131,8 +1131,10 @@ namespace ProxySU
} }
//下载安装脚本安装 37--40 //下载安装脚本安装 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; } if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
//functionResult = V2RayInstallScript(client);
//if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
//程序是否安装成功检测 41--43 //程序是否安装成功检测 41--43
functionResult = SoftInstalledSuccessOrFail(client, "v2ray", @"/usr/local/bin/v2ray"); functionResult = SoftInstalledSuccessOrFail(client, "v2ray", @"/usr/local/bin/v2ray");
@ -1277,30 +1279,41 @@ namespace ProxySU
//下载安装脚本安装V2Ray 37--40 //下载安装脚本安装V2Ray 37--40
//functionResult = V2RayInstallScript(client); //functionResult = V2RayInstallScript(client);
//if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; } //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
private bool V2RayInstallScript(SshClient client) //private bool V2RayInstallScript(SshClient client)
{ //{
//****** "系统环境检测完毕,符合安装要求,开始布署......" ******17 // //****** "系统环境检测完毕,符合安装要求,开始布署......" ******17
currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstalling").ToString(); // currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstalling").ToString();
MainWindowsShowInfo(currentStatus); // MainWindowsShowInfo(currentStatus);
//下载官方安装脚本安装 // //下载官方安装脚本安装
//****** "正在安装V2Ray......" ******19 // //****** "正在安装V2Ray......" ******19
SetUpProgressBarProcessing(37); // SetUpProgressBarProcessing(37);
currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + "V2Ray......"; // currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + "V2Ray......";
MainWindowsShowInfo(currentStatus); // MainWindowsShowInfo(currentStatus);
sshShellCommand = $"curl -o /tmp/go.sh https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh"; // sshShellCommand = $"curl -o /tmp/go.sh https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); // currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
sshShellCommand = @"yes | bash /tmp/go.sh -f"; // functionResult = FileCheckExists(client, @"/tmp/go.sh");
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); // if (functionResult == true)
// {
// sshShellCommand = @"yes | bash /tmp/go.sh -f";
// currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
sshShellCommand = @"rm -f /tmp/go.sh"; // sshShellCommand = @"rm -f /tmp/go.sh";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); // currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
// }
// else
// {
// //***安装脚本下载失败!***
// currentStatus = Application.Current.FindResource("DisplayInstallInfo_DownloadScriptFailed").ToString();
// MainWindowsShowInfo(currentStatus);
// return false;
// }
SetUpProgressBarProcessing(40); // SetUpProgressBarProcessing(40);
return true; // return true;
} //}
//生成V2Ray服务端配置 44--46 //生成V2Ray服务端配置 44--46
//functionResult = GenerateServerConfiguration(client); //functionResult = GenerateServerConfiguration(client);
@ -2109,10 +2122,14 @@ namespace ProxySU
//Thread.Sleep(1000); //Thread.Sleep(1000);
//检测是否安装V2Ray //检测是否安装V2Ray
sshShellCommand = @"find / -name v2ray"; //sshShellCommand = @"find / -name v2ray";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); //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"****** //******"退出原因远程主机未安装V2ray"******
MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorUpgradeSoftNotInstall").ToString() + "V2Ray!"); MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorUpgradeSoftNotInstall").ToString() + "V2Ray!");
@ -2413,8 +2430,10 @@ namespace ProxySU
if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; } if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
//下载脚本安装Trojan-go 37--40 //下载脚本安装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; } if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
//functionResult = TrojanGoInstall(client);
//if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
//程序是否安装成功检测并设置开机启动 41--43 //程序是否安装成功检测并设置开机启动 41--43
functionResult = SoftInstalledSuccessOrFail(client, "trojan-go", @"/usr/local/bin/trojan-go"); functionResult = SoftInstalledSuccessOrFail(client, "trojan-go", @"/usr/local/bin/trojan-go");
@ -2591,30 +2610,42 @@ namespace ProxySU
//下载脚本安装Trojan-go 37--40 //下载脚本安装Trojan-go 37--40
//functionResult = TrojanGoInstall(client); //functionResult = TrojanGoInstall(client);
//if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; } //if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
private bool TrojanGoInstall(SshClient client) //private bool TrojanGoInstall(SshClient client)
{ //{
//****** "系统环境检测完毕,符合安装要求,开始布署......" ****** // //****** "系统环境检测完毕,符合安装要求,开始布署......" ******
SetUpProgressBarProcessing(37); // SetUpProgressBarProcessing(37);
currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstalling").ToString(); // currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstalling").ToString();
MainWindowsShowInfo(currentStatus); // MainWindowsShowInfo(currentStatus);
//****** "正在安装Trojan-go......" ****** // //****** "正在安装Trojan-go......" ******
SetUpProgressBarProcessing(38); // SetUpProgressBarProcessing(38);
currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + "Trojan-go......"; // currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + "Trojan-go......";
MainWindowsShowInfo(currentStatus); // MainWindowsShowInfo(currentStatus);
sshShellCommand = $"curl -o /tmp/trojan-go.sh https://raw.githubusercontent.com/proxysu/shellscript/master/trojan-go.sh"; // sshShellCommand = $"curl -o /tmp/trojan-go.sh https://raw.githubusercontent.com/proxysu/shellscript/master/trojan-go.sh";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); // currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
sshShellCommand = @"yes | bash /tmp/trojan-go.sh -f"; // functionResult = FileCheckExists(client, @"/tmp/trojan-go.sh");
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); // if (functionResult == true)
// {
// sshShellCommand = @"yes | bash /tmp/trojan-go.sh -f";
// currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
sshShellCommand = @"rm -f /tmp/trojan-go.sh"; // sshShellCommand = @"rm -f /tmp/trojan-go.sh";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); // 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 //生成Trojan-go服务端配置 44--46
//functionResult = GenerateServerConfigurationTrojanGo(client); //functionResult = GenerateServerConfigurationTrojanGo(client);
@ -2753,10 +2784,14 @@ namespace ProxySU
//string cmdTestTrojanInstalled = @"find / -name trojan-go"; //string cmdTestTrojanInstalled = @"find / -name trojan-go";
sshShellCommand = @"find / -name trojan-go"; //sshShellCommand = @"find / -name trojan-go";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); //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"****** //******"退出原因远程主机未安装Trojan-go"******
MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorUpgradeSoftNotInstall").ToString() + "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"; sshShellCommand = $"curl -o /tmp/trojan-go.sh https://raw.githubusercontent.com/proxysu/shellscript/master/trojan-go.sh";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); 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); currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
sshShellCommand = @"rm -f /tmp/trojan-go.sh"; sshShellCommand = @"rm -f /tmp/trojan-go.sh";
@ -3021,20 +3065,23 @@ namespace ProxySU
functionResult = DomainResolutionCurrentIPDetect(client); functionResult = DomainResolutionCurrentIPDetect(client);
if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; } if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
//下载安装脚本安装 //下载安装脚本安装 37-40
//****** "正在安装Trojan......" ****** functionResult = ProxySoftInstall(client, @"Trojan", @"https://raw.githubusercontent.com/trojan-gfw/trojan-quickstart/master/trojan-quickstart.sh");
SetUpProgressBarProcessing(37); if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; }
currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + "Trojan......";
MainWindowsShowInfo(currentStatus);
sshShellCommand = $"curl -o /tmp/trojan-quickstart.sh https://raw.githubusercontent.com/trojan-gfw/trojan-quickstart/master/trojan-quickstart.sh"; ////****** "正在安装Trojan......" ******
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); //SetUpProgressBarProcessing(37);
//currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + "Trojan......";
//MainWindowsShowInfo(currentStatus);
sshShellCommand = @"yes | bash /tmp/trojan-quickstart.sh"; //sshShellCommand = $"curl -o /tmp/trojan-quickstart.sh https://raw.githubusercontent.com/trojan-gfw/trojan-quickstart/master/trojan-quickstart.sh";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
sshShellCommand = @"rm -f /tmp/trojan-quickstart.sh"; //sshShellCommand = @"yes | bash /tmp/trojan-quickstart.sh";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
//sshShellCommand = @"rm -f /tmp/trojan-quickstart.sh";
//currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
//程序是否安装成功检测并设置开机启动 41--43 //程序是否安装成功检测并设置开机启动 41--43
functionResult = SoftInstalledSuccessOrFail(client, "trojan", @"/usr/local/bin/trojan"); functionResult = SoftInstalledSuccessOrFail(client, "trojan", @"/usr/local/bin/trojan");
@ -3284,10 +3331,14 @@ namespace ProxySU
//string cmdTestTrojanInstalled = @"find / -name trojan"; //string cmdTestTrojanInstalled = @"find / -name trojan";
//string resultCmdTestTrojanInstalled = client.RunCommand(cmdTestTrojanInstalled).Result; //string resultCmdTestTrojanInstalled = client.RunCommand(cmdTestTrojanInstalled).Result;
sshShellCommand = @"find / -name trojan"; //sshShellCommand = @"find / -name trojan";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); //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"****** //******"退出原因远程主机未安装Trojan"******
MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorUpgradeSoftNotInstall").ToString() + "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"; sshShellCommand = $"curl -o /tmp/trojan-quickstart.sh https://raw.githubusercontent.com/trojan-gfw/trojan-quickstart/master/trojan-quickstart.sh";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); 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"; sshShellCommand = @"yes | bash /tmp/trojan-quickstart.sh";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); 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"; sshShellCommand = $"curl -o /tmp/caddy.zip https://raw.githubusercontent.com/proxysu/Resources/master/Caddy2/caddy2.zip";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); 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"; sshShellCommand = @"yes | unzip -o /tmp/caddy.zip";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
@ -3933,26 +4001,29 @@ namespace ProxySU
functionResult = DomainResolutionCurrentIPDetect(client); functionResult = DomainResolutionCurrentIPDetect(client);
if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; } 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); //SetUpProgressBarProcessing(37);
currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstalling").ToString(); //currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstalling").ToString();
MainWindowsShowInfo(currentStatus); //MainWindowsShowInfo(currentStatus);
//下载安装脚本安装 ////下载安装脚本安装
//****** "正在安装SSR......" ****** ////****** "正在安装SSR......" ******
SetUpProgressBarProcessing(38); //SetUpProgressBarProcessing(38);
currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + "SSR......"; //currentStatus = Application.Current.FindResource("DisplayInstallInfo_StartInstallSoft").ToString() + "SSR......";
MainWindowsShowInfo(currentStatus); //MainWindowsShowInfo(currentStatus);
sshShellCommand = $"curl -o /tmp/ssr.sh https://raw.githubusercontent.com/proxysu/shellscript/master/ssr/ssr.sh"; //sshShellCommand = $"curl -o /tmp/ssr.sh https://raw.githubusercontent.com/proxysu/shellscript/master/ssr/ssr.sh";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
sshShellCommand = @"yes | bash /tmp/ssr.sh"; //sshShellCommand = @"yes | bash /tmp/ssr.sh";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
sshShellCommand = @"rm -f /tmp/ssr.sh"; //sshShellCommand = @"rm -f /tmp/ssr.sh";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
//程序是否安装成功检测并设置开机启动 41--43 //程序是否安装成功检测并设置开机启动 41--43
functionResult = SoftInstalledSuccessOrFail(client, "server.py", @"/usr/local/shadowsocks/server.py"); 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"; sshShellCommand = $"curl -o /tmp/install.sh https://raw.githubusercontent.com/proxysu/shellscript/master/ss/ss-install.sh";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); 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"; sshShellCommand = @"yes | bash /tmp/install.sh";
TextBoxMonitorCommandResults.Dispatcher.BeginInvoke(updateMonitorAction, TextBoxMonitorCommandResults, sshShellCommand);//显示执行的命令 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"; sshShellCommand = $"curl -o /tmp/install.sh https://raw.githubusercontent.com/proxysu/shellscript/master/ss/ss-plugins/cloak-plugin-install.sh";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); 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"; sshShellCommand = @"yes | bash /tmp/install.sh";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); 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"; sshShellCommand = $"curl -o /tmp/install.sh https://raw.githubusercontent.com/proxysu/shellscript/master/ss/ss-plugins/obfs-install.sh";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); 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"; sshShellCommand = @"yes | bash /tmp/install.sh";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); 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"; sshShellCommand = $"curl -o /tmp/install.sh https://raw.githubusercontent.com/proxysu/shellscript/master/ss/ss-plugins/v2ray-plugin-install.sh";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); 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"; sshShellCommand = @"yes | bash /tmp/install.sh";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); 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"; sshShellCommand = $"curl -o /tmp/install.sh https://raw.githubusercontent.com/proxysu/shellscript/master/ss/ss-plugins/kcptun-plugin-install.sh";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); 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"; sshShellCommand = @"yes | bash /tmp/install.sh";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); 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"; sshShellCommand = $"curl -o /tmp/install.sh https://raw.githubusercontent.com/proxysu/shellscript/master/ss/ss-plugins/goquiet-plugin-install.sh";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); 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"; sshShellCommand = @"yes | bash /tmp/install.sh";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
@ -4834,6 +4959,7 @@ namespace ProxySU
} }
//下载安装脚本安装MTProto 37--40 //下载安装脚本安装MTProto 37--40
functionResult = MTProtoInstall(client); functionResult = MTProtoInstall(client);
if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return; } 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"; sshShellCommand = $"curl -o /tmp/mtg_install.sh https://raw.githubusercontent.com/proxysu/shellscript/master/MTProto/mtg_install.sh";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); 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]}"; sshShellCommand = $"yes | bash /tmp/mtg_install.sh {ReceiveConfigurationParameters[1]} {ReceiveConfigurationParameters[7]}";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
@ -4955,10 +5090,8 @@ namespace ProxySU
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
SetUpProgressBarProcessing(40); SetUpProgressBarProcessing(40);
return true; return true;
} }
#endregion #endregion
#region #region
@ -5509,10 +5642,10 @@ namespace ProxySU
currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "V2ray......"; currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "V2ray......";
MainWindowsShowInfo(currentStatus); MainWindowsShowInfo(currentStatus);
sshShellCommand = @"find / -name v2ray"; //sshShellCommand = @"find / -name v2ray";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
functionResult = FileCheckExists(client, @"/usr/local/bin/v2ray");
if (currentShellCommandResult.Contains("/usr/local/bin/v2ray") == true) if (functionResult == true)
{ {
//******"检测到已安装V2Ray!开始卸载V2Ray......"****** //******"检测到已安装V2Ray!开始卸载V2Ray......"******
SetUpProgressBarProcessing(12); SetUpProgressBarProcessing(12);
@ -5540,10 +5673,12 @@ namespace ProxySU
sshShellCommand = @"rm -f install-release.sh"; sshShellCommand = @"rm -f install-release.sh";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
sshShellCommand = @"find / -name v2ray"; //sshShellCommand = @"find / -name v2ray";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); //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卸载失败请向开发者问询"****** //******"V2Ray卸载失败请向开发者问询"******
currentStatus = "V2Ray" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString(); currentStatus = "V2Ray" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString();
@ -5575,10 +5710,12 @@ namespace ProxySU
currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "Trojan-go......"; currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "Trojan-go......";
MainWindowsShowInfo(currentStatus); MainWindowsShowInfo(currentStatus);
sshShellCommand = @"find / -name trojan-go"; //sshShellCommand = @"find / -name trojan-go";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); //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......"****** //******"检测到已安装Trojan-go,开始卸载Trojan-go......"******
SetUpProgressBarProcessing(18); SetUpProgressBarProcessing(18);
@ -5606,10 +5743,12 @@ namespace ProxySU
sshShellCommand = @"rm -f trojan-go.sh"; sshShellCommand = @"rm -f trojan-go.sh";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
sshShellCommand = @"find / -name trojan-go"; //sshShellCommand = @"find / -name trojan-go";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); //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卸载失败请向开发者问询"******
currentStatus = "Trojan-go" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString(); currentStatus = "Trojan-go" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString();
@ -5641,10 +5780,12 @@ namespace ProxySU
currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "Trojan......"; currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "Trojan......";
MainWindowsShowInfo(currentStatus); MainWindowsShowInfo(currentStatus);
sshShellCommand = @"find / -name trojan"; //sshShellCommand = @"find / -name trojan";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); //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......"****** //******"检测到已安装Trojan,开始卸载Trojan......"******
SetUpProgressBarProcessing(24); SetUpProgressBarProcessing(24);
@ -5663,10 +5804,12 @@ namespace ProxySU
sshShellCommand = @"rm -rf /usr/local/bin/trojan /etc/systemd/system/trojan.service /usr/local/etc/trojan"; sshShellCommand = @"rm -rf /usr/local/bin/trojan /etc/systemd/system/trojan.service /usr/local/etc/trojan";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
sshShellCommand = @"find / -name trojan"; //sshShellCommand = @"find / -name trojan";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); //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卸载失败请向开发者问询"******
currentStatus = "Trojan" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString(); currentStatus = "Trojan" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString();
@ -5698,10 +5841,12 @@ namespace ProxySU
currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "SSR......"; currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "SSR......";
MainWindowsShowInfo(currentStatus); MainWindowsShowInfo(currentStatus);
sshShellCommand = @"if [ -f /usr/local/shadowsocks/server.py ];then echo '1';else echo '0'; fi"; //sshShellCommand = @"if [ -f /usr/local/shadowsocks/server.py ];then echo '1';else echo '0'; fi";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); //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......"****** //******"检测到已安装SSR,开始卸载SSR......"******
SetUpProgressBarProcessing(32); SetUpProgressBarProcessing(32);
@ -5726,10 +5871,12 @@ namespace ProxySU
sshShellCommand = @"rm -f ssr.sh"; sshShellCommand = @"rm -f ssr.sh";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
sshShellCommand = @"if [ -f /usr/local/shadowsocks/server.py ];then echo '1';else echo '0'; fi"; //sshShellCommand = @"if [ -f /usr/local/shadowsocks/server.py ];then echo '1';else echo '0'; fi";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); //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卸载失败请向开发者问询"******
currentStatus = "SSR" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString(); currentStatus = "SSR" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString();
@ -5761,10 +5908,12 @@ namespace ProxySU
currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "SS (Shadowsoks-libev)......"; currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "SS (Shadowsoks-libev)......";
MainWindowsShowInfo(currentStatus); MainWindowsShowInfo(currentStatus);
sshShellCommand = @"find / -name ss-server"; //sshShellCommand = @"find / -name ss-server";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); //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)......"****** //******"检测到SS(Shadowsoks-libev),开始卸载SS(Shadowsoks-libev)......"******
SetUpProgressBarProcessing(38); 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"; 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); currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
sshShellCommand = @"find / -name ss-server"; //sshShellCommand = @"find / -name ss-server";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); //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)卸载失败!请向开发者问询!"******
currentStatus = "SS (Shadowsoks-libev)" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString(); 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......"; currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "acme.sh......";
MainWindowsShowInfo(currentStatus); 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); currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
if (currentShellCommandResult.Contains("1") == true) if (currentShellCommandResult.Contains("1") == true)
@ -5848,7 +5999,7 @@ namespace ProxySU
sshShellCommand = @"rm -r ~/.acme.sh"; sshShellCommand = @"rm -r ~/.acme.sh";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); 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); currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
if (currentShellCommandResult.Contains("1") == true) if (currentShellCommandResult.Contains("1") == true)
@ -5883,10 +6034,12 @@ namespace ProxySU
currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "Caddy/NaiveProxy......"; currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "Caddy/NaiveProxy......";
MainWindowsShowInfo(currentStatus); MainWindowsShowInfo(currentStatus);
sshShellCommand = @"find / -name caddy"; //sshShellCommand = @"find / -name caddy";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); //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......"****** //******"检测到Caddy/NaiveProxy,开始卸载Caddy/NaiveProxy......"******
SetUpProgressBarProcessing(49); SetUpProgressBarProcessing(49);
@ -5951,10 +6104,12 @@ namespace ProxySU
sshShellCommand = $"{sshCmdRemove}caddy"; sshShellCommand = $"{sshCmdRemove}caddy";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
sshShellCommand = @"find / -name caddy"; //sshShellCommand = @"find / -name caddy";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); //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卸载失败请向开发者问询"****** //******"Caddy/NaiveProxy卸载失败请向开发者问询"******
currentStatus = "Caddy/NaiveProxy" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString(); currentStatus = "Caddy/NaiveProxy" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString();
@ -5985,10 +6140,12 @@ namespace ProxySU
currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "MtProto......"; currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestExistSoft").ToString() + "MtProto......";
MainWindowsShowInfo(currentStatus); MainWindowsShowInfo(currentStatus);
sshShellCommand = @"find / -name mtg"; //sshShellCommand = @"find / -name mtg";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); //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......"****** //******"检测到MtProto,开始卸载MtProto......"******
SetUpProgressBarProcessing(63); SetUpProgressBarProcessing(63);
@ -6016,10 +6173,12 @@ namespace ProxySU
sshShellCommand = @"rm -rf /usr/local/etc/mtg.sh"; sshShellCommand = @"rm -rf /usr/local/etc/mtg.sh";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
sshShellCommand = @"find / -name mtg"; //sshShellCommand = @"find / -name mtg";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); //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卸载失败请向开发者问询"******
currentStatus = "MtProto" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString(); currentStatus = "MtProto" + Application.Current.FindResource("DisplayInstallInfo_RemoveProxySoftFailed").ToString();
@ -6863,30 +7022,42 @@ namespace ProxySU
#region #region
private void Button_Click(object sender, RoutedEventArgs e) private void Button_Click(object sender, RoutedEventArgs e)
{ {
proxyType = "TrojanGo"; //proxyType = "TrojanGo";
ResultClientInformation resultClientInformation = new ResultClientInformation(); //ResultClientInformation resultClientInformation = new ResultClientInformation();
resultClientInformation.ShowDialog(); //resultClientInformation.ShowDialog();
return; //return;
//string pwdir = AppDomain.CurrentDomain.BaseDirectory; //string pwdir = AppDomain.CurrentDomain.BaseDirectory;
//MessageBox.Show(pwdir); //MessageBox.Show(pwdir);
//ConnectionInfo connectionInfo = GenerateConnectionInfo(); ConnectionInfo connectionInfo = GenerateConnectionInfo();
//if (connectionInfo == null) if (connectionInfo == null)
//{ {
// //****** "远程主机连接信息有误,请检查!" ****** //****** "远程主机连接信息有误,请检查!" ******
// MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString()); MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorHostConnection").ToString());
// return; return;
//} }
//using (var client = new SshClient(connectionInfo)) using (var client = new SshClient(connectionInfo))
//{ {
// client.Connect(); client.Connect();
// if (client.IsConnected == true) if (client.IsConnected == true)
// { {
// //******"主机登录成功"****** //******"主机登录成功"******
// SetUpProgressBarProcessing(3); SetUpProgressBarProcessing(3);
// currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString(); currentStatus = Application.Current.FindResource("DisplayInstallInfo_LoginSuccessful").ToString();
// MainWindowsShowInfo(currentStatus); 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); // SetUpNat64(client, true);
//FilterFastestIP(client); //FilterFastestIP(client);
//string cmdErr = client.RunCommand(@"aaa ee").Error; //string cmdErr = client.RunCommand(@"aaa ee").Error;
@ -6919,7 +7090,7 @@ namespace ProxySU
//{ //{
// MessageBox.Show("disConnected"); // MessageBox.Show("disConnected");
//} //}
// } }
} }
private string CaddyInstallTest(SshClient client) private string CaddyInstallTest(SshClient client)
@ -6993,27 +7164,44 @@ namespace ProxySU
//****** "正在查找最快的Nat64网关......" ****** //****** "正在查找最快的Nat64网关......" ******
currentStatus = Application.Current.FindResource("DisplayInstallInfo_FindFastestSetUpNat64").ToString(); currentStatus = Application.Current.FindResource("DisplayInstallInfo_FindFastestSetUpNat64").ToString();
MainWindowsShowInfo(currentStatus); MainWindowsShowInfo(currentStatus);
string[] dns64 = new string[2]; //string[] dns64 = new string[2];
dns64 = FilterFastestIP(client); var dns64 = FilterFastestIP(client);
//****** "当前主机最快的Nat64网关为:" ****** //****** "当前主机最快的Nat64网关为:" ******
currentStatus = Application.Current.FindResource("DisplayInstallInfo_FindFastestNat64AsIs").ToString(); //currentStatus = Application.Current.FindResource("DisplayInstallInfo_FindFastestNat64AsIs").ToString();
MainWindowsShowInfo(currentStatus); //MainWindowsShowInfo(currentStatus);
currentStatus = dns64[0]; //currentStatus = dns64[0];
MainWindowsShowInfo(currentStatus); //MainWindowsShowInfo(currentStatus);
currentStatus = dns64[1]; //currentStatus = dns64[1];
MainWindowsShowInfo(currentStatus); //MainWindowsShowInfo(currentStatus);
//****** "正在设置Nat64网关......" ****** //****** "正在设置Nat64网关......" ******
currentStatus = Application.Current.FindResource("DisplayInstallInfo_SetUpNat64").ToString(); currentStatus = Application.Current.FindResource("DisplayInstallInfo_SetUpNat64").ToString();
MainWindowsShowInfo(currentStatus); MainWindowsShowInfo(currentStatus);
sshShellCommand = @"mv /etc/resolv.conf /etc/resolv.conf.bak"; sshShellCommand = @"mv /etc/resolv.conf /etc/resolv.conf.bak";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
sshShellCommand = $"echo \"nameserver {dns64[0]}\" >>/etc/resolv.conf";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); foreach (string gateip in dns64)
sshShellCommand = $"echo \"nameserver {dns64[1]}\" >>/etc/resolv.conf"; {
sshShellCommand = $"echo \"nameserver {gateip}\" > /etc/resolv.conf";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); 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 else
{ {
@ -7047,7 +7235,7 @@ namespace ProxySU
"2a00:1098:2c::1", "2a00:1098:2c::1",
"2a09:11c0:100::53", "2a09:11c0:100::53",
}; };
string[] returnstr = new string[2];
List<NatDns64> NatDns64s = new List<NatDns64>(); List<NatDns64> NatDns64s = new List<NatDns64>();
foreach (string gateip in gateNat64) foreach (string gateip in gateNat64)
{ {
@ -7066,9 +7254,14 @@ namespace ProxySU
} }
NatDns64s = NatDns64s.OrderBy(o => o.Avg).ToList(); NatDns64s = NatDns64s.OrderBy(o => o.Avg).ToList();
returnstr[0] = NatDns64s[0].IpAddr; int listCount = NatDns64s.Count;
returnstr[1] = NatDns64s[1].IpAddr; 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; return returnstr;
} }
@ -7127,6 +7320,23 @@ namespace ProxySU
MainWindowsShowInfo(currentStatus); MainWindowsShowInfo(currentStatus);
return ""; 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 #endregion
//检测root权限 5--7 //检测root权限 5--7
@ -7174,11 +7384,13 @@ namespace ProxySU
MainWindowsShowInfo(currentStatus); MainWindowsShowInfo(currentStatus);
sshShellCommand = $"find / -name {soft}"; //sshShellCommand = $"find / -name {soft}";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); //currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
//string resultCmdTestV2rayInstalled = currentShellCommandResult; //string resultCmdTestV2rayInstalled = currentShellCommandResult;
if (currentShellCommandResult.Contains($"{condition}") == true) //if (currentShellCommandResult.Contains($"{condition}") == true)
functionResult = FileCheckExists(client, condition);
if (functionResult == true)
{ {
//******"远程主机已安装V2ray,是否强制重新安装?"****** //******"远程主机已安装V2ray,是否强制重新安装?"******
string messageShow = Application.Current.FindResource("MessageBoxShow_ExistedSoft").ToString() + string messageShow = Application.Current.FindResource("MessageBoxShow_ExistedSoft").ToString() +
@ -7750,8 +7962,39 @@ namespace ProxySU
//安装代理程序 37--40 //安装代理程序 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; return true;
} }
@ -7763,10 +8006,14 @@ namespace ProxySU
private bool SoftInstalledSuccessOrFail(SshClient client,string soft,string condition) private bool SoftInstalledSuccessOrFail(SshClient client,string soft,string condition)
{ {
SetUpProgressBarProcessing(41); SetUpProgressBarProcessing(41);
sshShellCommand = $"find / -name {soft}"; //sshShellCommand = $"find / -name {soft}";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); //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()); MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorInstallSoftFail").ToString());
@ -7958,10 +8205,14 @@ namespace ProxySU
} }
sshShellCommand = @"find / -name caddy"; //sshShellCommand = @"find / -name caddy";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand); //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失败" ****** //****** "安装Caddy失败" ******
MessageBox.Show(Application.Current.FindResource("DisplayInstallInfo_ErrorInstallCaddyFail").ToString()); MessageBox.Show(Application.Current.FindResource("DisplayInstallInfo_ErrorInstallCaddyFail").ToString());

View File

@ -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_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_OpenFireWallPort">Open the corresponding port of the firewall...</sys:String>
<sys:String x:Key="DisplayInstallInfo_StartInstallSoft">Installing</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="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="MessageBoxShow_ErrorInstallSoftFail">The installation failed, the script runs incorrectly!</sys:String>
<sys:String x:Key="DisplayInstallInfo_SoftInstallSuccess">The installation is successful!</sys:String> <sys:String x:Key="DisplayInstallInfo_SoftInstallSuccess">The installation is successful!</sys:String>

View File

@ -311,6 +311,7 @@
<sys:String x:Key="DisplayInstallInfo_StartInstalling">系统环境检测完毕,符合安装要求,开始布署......</sys:String> <sys:String x:Key="DisplayInstallInfo_StartInstalling">系统环境检测完毕,符合安装要求,开始布署......</sys:String>
<sys:String x:Key="DisplayInstallInfo_OpenFireWallPort">开启防火墙相应端口......</sys:String> <sys:String x:Key="DisplayInstallInfo_OpenFireWallPort">开启防火墙相应端口......</sys:String>
<sys:String x:Key="DisplayInstallInfo_StartInstallSoft">正在安装</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="DisplayInstallInfo_CompilingSS">编译中,请耐心等待.............</sys:String>
<sys:String x:Key="MessageBoxShow_ErrorInstallSoftFail">安装失败,脚本运行出错!</sys:String> <sys:String x:Key="MessageBoxShow_ErrorInstallSoftFail">安装失败,脚本运行出错!</sys:String>
<sys:String x:Key="DisplayInstallInfo_SoftInstallSuccess">安装成功!</sys:String> <sys:String x:Key="DisplayInstallInfo_SoftInstallSuccess">安装成功!</sys:String>

View File

@ -306,6 +306,7 @@
<sys:String x:Key="DisplayInstallInfo_StartInstalling">系統環境檢測完畢,符合安裝要求,開始佈署......</sys:String> <sys:String x:Key="DisplayInstallInfo_StartInstalling">系統環境檢測完畢,符合安裝要求,開始佈署......</sys:String>
<sys:String x:Key="DisplayInstallInfo_OpenFireWallPort">開啟防火牆相應端口......</sys:String> <sys:String x:Key="DisplayInstallInfo_OpenFireWallPort">開啟防火牆相應端口......</sys:String>
<sys:String x:Key="DisplayInstallInfo_StartInstallSoft">正在安裝</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="DisplayInstallInfo_CompilingSS">編譯中,請耐心等待.............</sys:String>
<sys:String x:Key="MessageBoxShow_ErrorInstallSoftFail">安裝失敗,腳本運行出錯!</sys:String> <sys:String x:Key="MessageBoxShow_ErrorInstallSoftFail">安裝失敗,腳本運行出錯!</sys:String>
<sys:String x:Key="DisplayInstallInfo_SoftInstallSuccess">安裝成功!</sys:String> <sys:String x:Key="DisplayInstallInfo_SoftInstallSuccess">安裝成功!</sys:String>

Binary file not shown.