1
0
Fork 0
mirror of https://github.com/proxysu/ProxySU.git synced 2025-03-30 12:10:20 +03:00

注释清理测试代码

This commit is contained in:
ProxySU 2020-04-12 21:44:37 +08:00
parent a654489825
commit 9a0394d5bc
4 changed files with 135 additions and 142 deletions

View file

@ -673,12 +673,7 @@ namespace ProxySU
} }
} }
UploadConfig(connectionInfo, @"config.json",upLoadPath); UploadConfig(connectionInfo, @"config.json",upLoadPath);
//client.RunCommand("sed -i 's/##port##/" + ReceiveConfigurationParameters[1] + "/' " + upLoadPath);
//client.RunCommand("sed -i 's/##uuid##/" + ReceiveConfigurationParameters[2] + "/' " + upLoadPath);
//client.RunCommand("sed -i 's/##path##/\\" + ReceiveConfigurationParameters[3] + "/' " + upLoadPath);
////client.RunCommand("sed -i 's/##domain##/" + ReceiveConfigurationParameters[4] + "/' " + upLoadPath);
//client.RunCommand("sed -i 's/##mkcpHeaderType##/" + ReceiveConfigurationParameters[5] + "/' " + upLoadPath);
//client.RunCommand("systemctl restart v2ray");
File.Delete(@"config.json"); File.Delete(@"config.json");
//打开防火墙端口 //打开防火墙端口
@ -855,15 +850,6 @@ namespace ProxySU
sw.Write(clientJson.ToString()); sw.Write(clientJson.ToString());
} }
} }
//upLoadPath = "/tmp/config.json";
//UploadConfig(connectionInfo, clientConfig, upLoadPath);
//client.RunCommand("sed -i 's/##port##/" + ReceiveConfigurationParameters[1] + "/' " + upLoadPath);
//client.RunCommand("sed -i 's/##uuid##/" + ReceiveConfigurationParameters[2] + "/' " + upLoadPath);
//client.RunCommand("sed -i 's/##path##/\\" + ReceiveConfigurationParameters[3] + "/' " + upLoadPath);
//client.RunCommand("sed -i 's/##domain##/" + ReceiveConfigurationParameters[4] + "/' " + upLoadPath);
//client.RunCommand("sed -i 's/##mkcpHeaderType##/" + ReceiveConfigurationParameters[5] + "/' " + upLoadPath);
//DownloadConfig(connectionInfo, "config.json", upLoadPath);
client.Disconnect(); client.Disconnect();
@ -1096,12 +1082,7 @@ namespace ProxySU
{ {
//MessageBox.Show(cmdResult); //MessageBox.Show(cmdResult);
string[] cmdResultArry443 = cmdResult.Split(' '); string[] cmdResultArry443 = cmdResult.Split(' ');
//foreach(string arry in cmdResultArry)
//{
// MessageBox.Show(arry);
//}
//MessageBox.Show(cmdResultArry[0]);//程序名字
//MessageBox.Show(cmdResultArry[3]);//程序PID
client.RunCommand($"kill -9 {cmdResultArry443[3]}"); client.RunCommand($"kill -9 {cmdResultArry443[3]}");
} }
@ -1167,136 +1148,136 @@ namespace ProxySU
} }
} }
private void TestresultClientInform_Click(object sender, RoutedEventArgs e) //private void TestresultClientInform_Click(object sender, RoutedEventArgs e)
{ //{
ResultClientInformation resultClientInformation = new ResultClientInformation(); // ResultClientInformation resultClientInformation = new ResultClientInformation();
resultClientInformation.ShowDialog(); // resultClientInformation.ShowDialog();
} //}
private void TestPortOccupy_Click(object sender, RoutedEventArgs e) //private void TestPortOccupy_Click(object sender, RoutedEventArgs e)
{ //{
MessageBoxResult dialogResult = MessageBox.Show("将强制停止占用80/443端口的程序?", "Stop application", MessageBoxButton.YesNo); // MessageBoxResult dialogResult = MessageBox.Show("将强制停止占用80/443端口的程序?", "Stop application", MessageBoxButton.YesNo);
if (dialogResult == MessageBoxResult.No) // if (dialogResult == MessageBoxResult.No)
{ // {
return; // return;
} // }
ConnectionInfo testconnect = GenerateConnectionInfo(); // ConnectionInfo testconnect = GenerateConnectionInfo();
using (var client = new SshClient(testconnect)) // using (var client = new SshClient(testconnect))
{ // {
client.Connect(); // client.Connect();
string cmdTestPort = @"lsof -n -P -i :443 | grep LISTEN"; // string cmdTestPort = @"lsof -n -P -i :443 | grep LISTEN";
MessageBox.Show(cmdTestPort); // MessageBox.Show(cmdTestPort);
string cmdResult = client.RunCommand(cmdTestPort).Result; // string cmdResult = client.RunCommand(cmdTestPort).Result;
client.Disconnect(); // client.Disconnect();
MessageBox.Show(cmdResult); // MessageBox.Show(cmdResult);
string[] cmdResultArry = cmdResult.Split(' '); // string[] cmdResultArry = cmdResult.Split(' ');
//foreach(string arry in cmdResultArry) // //foreach(string arry in cmdResultArry)
//{ // //{
// MessageBox.Show(arry); // // MessageBox.Show(arry);
//} // //}
MessageBox.Show(cmdResultArry[0]);//程序名字 // MessageBox.Show(cmdResultArry[0]);//程序名字
MessageBox.Show(cmdResultArry[3]);//程序PID // MessageBox.Show(cmdResultArry[3]);//程序PID
} // }
} //}
private void TestInstalledV2ray_Click(object sender, RoutedEventArgs e) //private void TestInstalledV2ray_Click(object sender, RoutedEventArgs e)
{ //{
ConnectionInfo testconnect = GenerateConnectionInfo(); // ConnectionInfo testconnect = GenerateConnectionInfo();
using (var client = new SshClient(testconnect)) // using (var client = new SshClient(testconnect))
{ // {
client.Connect(); // client.Connect();
//string cmdTestPort = @"find / -name v2ray"; // //string cmdTestPort = @"find / -name v2ray";
//MessageBox.Show(cmdTestPort); // //MessageBox.Show(cmdTestPort);
//string cmdResult = client.RunCommand(cmdTestPort).Result; // //string cmdResult = client.RunCommand(cmdTestPort).Result;
//设置Caddyfile文件中的tls 邮箱 // //设置Caddyfile文件中的tls 邮箱
string upLoadPath = "/etc/caddy/Caddyfile.test"; // string upLoadPath = "/etc/caddy/Caddyfile.test";
string emailAddress = ReceiveConfigurationParameters[4]; // string emailAddress = ReceiveConfigurationParameters[4];
string sshCmdEmail = $"email={emailAddress};email=${{email/./@}};echo $email";//结尾有回车符 // string sshCmdEmail = $"email={emailAddress};email=${{email/./@}};echo $email";//结尾有回车符
string email = client.RunCommand(sshCmdEmail).Result.Replace("\n",""); // string email = client.RunCommand(sshCmdEmail).Result.Replace("\n","");
MessageBox.Show(email); // MessageBox.Show(email);
string sshCmd = $"sed -i 's/off/{email}/' {upLoadPath}"; // string sshCmd = $"sed -i 's/off/{email}/' {upLoadPath}";
MessageBox.Show(sshCmd); // MessageBox.Show(sshCmd);
client.RunCommand(sshCmd); // client.RunCommand(sshCmd);
sshCmd = $"sed -i 's/##path##/\\{ReceiveConfigurationParameters[3]}/' {upLoadPath}"; // sshCmd = $"sed -i 's/##path##/\\{ReceiveConfigurationParameters[3]}/' {upLoadPath}";
MessageBox.Show(sshCmd); // MessageBox.Show(sshCmd);
client.RunCommand(sshCmd); // client.RunCommand(sshCmd);
//sshCmd = "sed -i 's/##path##/\\" + ReceiveConfigurationParameters[3] + "/' " + upLoadPath; // //sshCmd = "sed -i 's/##path##/\\" + ReceiveConfigurationParameters[3] + "/' " + upLoadPath;
//MessageBox.Show(sshCmd); // //MessageBox.Show(sshCmd);
//client.RunCommand("sed -i 's/##path##/\\" + ReceiveConfigurationParameters[3] + "/' " + upLoadPath); // //client.RunCommand("sed -i 's/##path##/\\" + ReceiveConfigurationParameters[3] + "/' " + upLoadPath);
sshCmd = $"sed -i 's/##domain##/{ReceiveConfigurationParameters[4]}/' {upLoadPath}"; // sshCmd = $"sed -i 's/##domain##/{ReceiveConfigurationParameters[4]}/' {upLoadPath}";
MessageBox.Show(sshCmd); // MessageBox.Show(sshCmd);
client.RunCommand(sshCmd); // client.RunCommand(sshCmd);
//client.RunCommand("sed -i 's/##domain##/" + ReceiveConfigurationParameters[4] + "/' " + upLoadPath); // //client.RunCommand("sed -i 's/##domain##/" + ReceiveConfigurationParameters[4] + "/' " + upLoadPath);
if (String.IsNullOrEmpty(ReceiveConfigurationParameters[7]) == false) // if (String.IsNullOrEmpty(ReceiveConfigurationParameters[7]) == false)
{ // {
sshCmd = $"sed -i 's/##sites##/proxy \\/ {ReceiveConfigurationParameters[7]}/' {upLoadPath}"; // sshCmd = $"sed -i 's/##sites##/proxy \\/ {ReceiveConfigurationParameters[7]}/' {upLoadPath}";
//client.RunCommand("sed -i 's/##sites##/proxy \\/ " + ReceiveConfigurationParameters[7] + "/' " + upLoadPath); // //client.RunCommand("sed -i 's/##sites##/proxy \\/ " + ReceiveConfigurationParameters[7] + "/' " + upLoadPath);
MessageBox.Show(sshCmd); // MessageBox.Show(sshCmd);
client.RunCommand(sshCmd); // client.RunCommand(sshCmd);
} // }
Thread.Sleep(2000); // Thread.Sleep(2000);
//生成安装服务命令中的邮箱 // //生成安装服务命令中的邮箱
//string sshCmdEmail = $"email={emailAddress};email=${{email/./@}};echo $email"; // //string sshCmdEmail = $"email={emailAddress};email=${{email/./@}};echo $email";
//string email = client.RunCommand(sshCmdEmail).Result.ToString(); // //string email = client.RunCommand(sshCmdEmail).Result.ToString();
//MessageBox.Show(email); // //MessageBox.Show(email);
//安装Caddy服务 // //安装Caddy服务
//sshCmd = "caddy -service install -agree -conf /etc/caddy/Caddyfile -email " + email; // //sshCmd = "caddy -service install -agree -conf /etc/caddy/Caddyfile -email " + email;
sshCmd = $"caddy -service install -agree -conf /etc/caddy/Caddyfile -email {email}"; // sshCmd = $"caddy -service install -agree -conf /etc/caddy/Caddyfile -email {email}";
client.Disconnect(); // client.Disconnect();
//MessageBox.Show(cmdResult); // //MessageBox.Show(cmdResult);
//if (cmdResult.Contains("/usr/bin/v2ray")==true) // //if (cmdResult.Contains("/usr/bin/v2ray")==true)
//{ // //{
// MessageBox.Show("已安装"); // // MessageBox.Show("已安装");
//} // //}
//else // //else
//{ // //{
// MessageBox.Show("未安装"); // // MessageBox.Show("未安装");
//} // //}
//string[] cmdResultArry = cmdResult.Split('\n'); // //string[] cmdResultArry = cmdResult.Split('\n');
//foreach(string arry in cmdResultArry) // //foreach(string arry in cmdResultArry)
//{ // //{
// MessageBox.Show(arry); // // MessageBox.Show(arry);
//} // //}
//MessageBox.Show(cmdResultArry[0]);//程序名字 // //MessageBox.Show(cmdResultArry[0]);//程序名字
//MessageBox.Show(cmdResultArry[3]);//程序PID // //MessageBox.Show(cmdResultArry[3]);//程序PID
} // }
} //}
private void TestsshCmd_Click(object sender, RoutedEventArgs e) //private void TestsshCmd_Click(object sender, RoutedEventArgs e)
{ //{
ReceiveConfigurationParameters[3] = "https://tes.te.tt"; // ReceiveConfigurationParameters[3] = "https://tes.te.tt";
ReceiveConfigurationParameters[7] = "http://77.77.77"; // ReceiveConfigurationParameters[7] = "http://77.77.77";
string upLoadPath = "/etc/caddy/Caddyfile"; // string upLoadPath = "/etc/caddy/Caddyfile";
string sshCmd = $"sed -i 's/##path##/\\{ReceiveConfigurationParameters[3]}/' {upLoadPath}"; // string sshCmd = $"sed -i 's/##path##/\\{ReceiveConfigurationParameters[3]}/' {upLoadPath}";
//MessageBox.Show(sshCmd); // //MessageBox.Show(sshCmd);
//sshCmd = "sed -i 's/##path##/\\" + ReceiveConfigurationParameters[3] + "/' " + upLoadPath; // //sshCmd = "sed -i 's/##path##/\\" + ReceiveConfigurationParameters[3] + "/' " + upLoadPath;
//MessageBox.Show(sshCmd); // //MessageBox.Show(sshCmd);
//sshCmd = $"sed -i 's/##path##/\\{ReceiveConfigurationParameters[3]}/' {upLoadPath}"; // //sshCmd = $"sed -i 's/##path##/\\{ReceiveConfigurationParameters[3]}/' {upLoadPath}";
//MessageBox.Show(sshCmd); // //MessageBox.Show(sshCmd);
//sshCmd = "sed -i 's/##path##/\\" + ReceiveConfigurationParameters[3] + "/' " + upLoadPath; // //sshCmd = "sed -i 's/##path##/\\" + ReceiveConfigurationParameters[3] + "/' " + upLoadPath;
//MessageBox.Show(sshCmd); // //MessageBox.Show(sshCmd);
//client.RunCommand("sed -i 's/##path##/\\" + ReceiveConfigurationParameters[3] + "/' " + upLoadPath); // //client.RunCommand("sed -i 's/##path##/\\" + ReceiveConfigurationParameters[3] + "/' " + upLoadPath);
sshCmd = $"sed -i 's/##domain##/{ReceiveConfigurationParameters[4]}/' {upLoadPath}"; // sshCmd = $"sed -i 's/##domain##/{ReceiveConfigurationParameters[4]}/' {upLoadPath}";
MessageBox.Show(sshCmd); // MessageBox.Show(sshCmd);
string testDomain = ReceiveConfigurationParameters[7].Substring(0,7); // string testDomain = ReceiveConfigurationParameters[7].Substring(0,7);
if (String.Equals(testDomain,"https:/")||String.Equals(testDomain,"http://")) // if (String.Equals(testDomain,"https:/")||String.Equals(testDomain,"http://"))
{ // {
MessageBox.Show(testDomain); // MessageBox.Show(testDomain);
ReceiveConfigurationParameters[7]=ReceiveConfigurationParameters[7].Replace("/","\\/"); // ReceiveConfigurationParameters[7]=ReceiveConfigurationParameters[7].Replace("/","\\/");
} // }
else // else
{ // {
ReceiveConfigurationParameters[7] = "http:\\/\\/" + ReceiveConfigurationParameters[7]; // ReceiveConfigurationParameters[7] = "http:\\/\\/" + ReceiveConfigurationParameters[7];
} // }
sshCmd = $"sed -i 's/##sites##/proxy \\/ {ReceiveConfigurationParameters[7]}/' {upLoadPath}"; // sshCmd = $"sed -i 's/##sites##/proxy \\/ {ReceiveConfigurationParameters[7]}/' {upLoadPath}";
MessageBox.Show(sshCmd); // MessageBox.Show(sshCmd);
} //}

View file

@ -319,6 +319,18 @@ namespace ProxySU
sw.WriteLine("-----------------------------------------"); sw.WriteLine("-----------------------------------------");
sw.WriteLine("url.txt"); sw.WriteLine("url.txt");
sw.WriteLine("此文件为v2rayN、v2rayNG(Android)、Shadowrocket(ios)复制粘贴导入节点的vmess网址"); sw.WriteLine("此文件为v2rayN、v2rayNG(Android)、Shadowrocket(ios)复制粘贴导入节点的vmess网址");
sw.WriteLine("-----------------------------------------\n");
sw.WriteLine("服务器通用连接配置参数");
sw.WriteLine($"地址(address){TextBoxHostAddress.Text}");
sw.WriteLine($"端口(Port){TextBoxPort.Text}");
sw.WriteLine($"用户ID(uuid){TextBoxUUID.Text}");
sw.WriteLine($"额外ID{TextBoxUUIDextra.Text}");
sw.WriteLine($"加密方式:{TextBoxEncryption.Text}");
sw.WriteLine($"传输协议:{TextBoxTransmission.Text}");
sw.WriteLine($"伪装类型:{TextBoxCamouflageType.Text}");
sw.WriteLine($"是否使用TLS{TextBoxTLS.Text}");
sw.WriteLine($"路径(Path){TextBoxPath.Text}");
sw.WriteLine($"QUIC密钥{TextBoxQuicKey.Text}");
} }

Binary file not shown.

Binary file not shown.