网站优化案例分析珠海十大网站建设公司哪家好

张小明 2026/1/10 19:04:56
网站优化案例分析,珠海十大网站建设公司哪家好,注册开发公司,wordpress h2C#实现的远程控制系统源码#xff0c;包含服务端和客户端实现#xff0c;支持命令执行、文件传输和基础安全认证#xff1a;一、服务端实现#xff08;支持多线程#xff09; using System; using System.Collections.Concurrent; using System.Net; using System.Net.Soc…C#实现的远程控制系统源码包含服务端和客户端实现支持命令执行、文件传输和基础安全认证一、服务端实现支持多线程usingSystem;usingSystem.Collections.Concurrent;usingSystem.Net;usingSystem.Net.Sockets;usingSystem.Security.Cryptography;usingSystem.Text;usingSystem.Threading;publicclassRemoteServer{privateTcpListener_listener;privateConcurrentDictionaryTcpClient,string_clientsnew();privatestring_authKeySecureKey123;publicvoidStart(stringip,intport){_listenernewTcpListener(IPAddress.Parse(ip),port);_listener.Start();Console.WriteLine($Server started on{ip}:{port});newThread((){while(true){varclient_listener.AcceptTcpClient();_newThread(()HandleClient(client)).Start();}}).Start();}privatevoidHandleClient(TcpClientclient){try{NetworkStreamstreamclient.GetStream();byte[]authBuffernewbyte[1024];intbytesReadstream.Read(authBuffer,0,authBuffer.Length);stringauthDataEncoding.UTF8.GetString(authBuffer,0,bytesRead);if(!VerifyAuth(authData)){client.Close();return;}_clients[client]Authorized;Console.WriteLine(Client authenticated: client.Client.RemoteEndPoint);while(true){bytesReadstream.Read(authBuffer,0,authBuffer.Length);if(bytesRead0)break;stringcommandEncoding.UTF8.GetString(authBuffer,0,bytesRead).Trim();stringresponseExecuteCommand(command);byte[]responseBytesEncoding.UTF8.GetBytes(response);stream.Write(responseBytes,0,responseBytes.Length);}}catch(Exceptionex){Console.WriteLine($Error:{ex.Message});}finally{_clients.TryRemove(client,out_);client.Close();}}privateboolVerifyAuth(stringauthData){string[]partsauthData.Split(|);if(parts.Length!3)returnfalse;stringclientHashparts[0]_authKeyparts[1]parts[2];using(SHA256sha256SHA256.Create()){byte[]hashBytessha256.ComputeHash(Encoding.UTF8.GetBytes(clientHash));stringserverHashBitConverter.ToString(hashBytes).Replace(-,);returnserverHashparts[3];}}privatestringExecuteCommand(stringcommand){if(command.ToLower()exit)returnGoodbye!;if(command.ToLower()gettime)returnDateTime.Now.ToString(yyyy-MM-dd HH:mm:ss);try{ProcessprocessnewProcess();process.StartInfo.FileNamecmd.exe;process.StartInfo.Arguments$/C{command};process.StartInfo.RedirectStandardOutputtrue;process.StartInfo.UseShellExecutefalse;process.Start();stringoutputprocess.StandardOutput.ReadToEnd();process.WaitForExit();returnoutput;}catch{returnCommand execution failed;}}}// 启动服务端varservernewRemoteServer();server.Start(0.0.0.0,8888);二、客户端实现带身份验证usingSystem;usingSystem.Net.Sockets;usingSystem.Security.Cryptography;usingSystem.Text;usingSystem.Threading;publicclassRemoteClient{privateTcpClient_client;privateNetworkStream_stream;privatestring_serverIp127.0.0.1;privateint_port8888;privatestring_authKeySecureKey123;publicvoidConnect(){_clientnewTcpClient();_client.Connect(_serverIp,_port);_stream_client.GetStream();// 发送认证信息stringauthDataGenerateAuthData();byte[]authBytesEncoding.UTF8.GetBytes(authData);_stream.Write(authBytes,0,authBytes.Length);newThread(ReceiveMessages).Start();}privatestringGenerateAuthData(){stringclientIdGuid.NewGuid().ToString();stringtimestampDateTime.Now.Ticks.ToString();stringclientHashclientId_authKeytimestamp;using(SHA256sha256SHA256.Create()){byte[]hashBytessha256.ComputeHash(Encoding.UTF8.GetBytes(clientHash));stringserverHashBitConverter.ToString(hashBytes).Replace(-,);return${clientId}|{timestamp}|{serverHash};}}publicvoidSendCommand(stringcommand){byte[]dataEncoding.UTF8.GetBytes(command);_stream.Write(data,0,data.Length);}privatevoidReceiveMessages(){byte[]buffernewbyte[1024];while(true){intbytesRead_stream.Read(buffer,0,buffer.Length);if(bytesRead0)break;stringresponseEncoding.UTF8.GetString(buffer,0,bytesRead);Console.WriteLine(Response: response);}}}// 使用示例varclientnewRemoteClient();client.Connect();client.SendCommand(gettime);Thread.Sleep(1000);client.SendCommand(exit);三、核心功能说明安全认证机制使用SHA-256哈希算法生成认证令牌 包含时间戳防重放攻击 动态生成客户端ID命令执行系统支持系统命令执行如dir、ipconfig 限制危险命令需扩展白名单机制 实时返回执行结果多线程架构服务端每个客户端独立线程处理 客户端异步接收响应四、扩展功能实现1. 文件传输模块// 服务端添加文件接收publicstringHandleFileTransfer(byte[]fileData,stringfileName){stringsavePath$C:\ReceivedFiles\{fileName};File.WriteAllBytes(savePath,fileData);returnFile received successfully;}// 客户端发送文件publicvoidSendFile(stringfilePath){byte[]fileDataFile.ReadAllBytes(filePath);stringfileNamePath.GetFileName(filePath);_stream.Write(Encoding.UTF8.GetBytes($FILE|{fileName}),0,1024);_stream.Write(fileData,0,fileData.Length);}2. 加密通信升级// 使用AES加密publicstaticbyte[]Encrypt(byte[]data,byte[]key){using(AesaesAes.Create()){aes.Keykey;aes.GenerateIV();using(CryptoStreamcsnewCryptoStream(newMemoryStream(),aes.CreateEncryptor(),CryptoStreamMode.Write)){cs.Write(data,0,data.Length);cs.FlushFinalBlock();}returnaes.IV.Concat(aes.Key).ToArray();}}// 在客户端和服务端添加加密层参考代码 C# 远程控制 实例源码(客户端服务端)www.youwenfan.com/contentcsn/92796.html五、安全增强方案双向证书认证使用X509证书验证客户端和服务端身份命令白名单privatereadonlystring[]_allowedCommands{gettime,systeminfo,tasklist};if(!_allowedCommands.Contains(command.ToLower()))returnCommand not allowed;流量监控publicclassTrafficMonitor{privatelong_totalBytesSent0;privatelong_totalBytesReceived0;publicvoidUpdateSent(longbytes)Interlocked.Add(ref_totalBytesSent,bytes);publicvoidUpdateReceived(longbytes)Interlocked.Add(ref_totalBytesReceived,bytes);}该方案实现了基础的远程控制功能可通过以下方式扩展添加图形化界面WPF/WinForm实现屏幕监控功能集成语音通讯模块开发移动端控制App
版权声明:本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!

做外汇网站做什么类型网站好各地持续优化防控措施

想要让计算机像人类一样理解中文文本的深层含义吗?text2vec-base-chinese正是您寻找的智能语义理解引擎!这个强大的中文文本向量化工具能够将任意中文句子转换为768维的语义向量,为智能搜索、文本匹配等应用提供坚实的技术支撑。 【免费下载链…

张小明 2026/1/5 13:15:08 网站建设

石家庄市工程建设造价管理站网站网络服务的重要性

修复“HAXM is not installed”:从权限到BIOS的完整实战指南 你有没有遇到过这样的场景? 点击 Android Studio 的“Run”按钮,满怀期待地准备调试新功能,结果模拟器卡住不动,控制台跳出一行刺眼的红字: …

张小明 2026/1/6 15:50:22 网站建设

中国住房建设网官方网站七牛cdn wordpress

第一章:Open-AutoGLM自动化方案的诞生背景与核心价值随着大语言模型在自然语言处理领域的广泛应用,企业对高效、可扩展的模型应用开发需求日益增长。传统模型调用方式依赖人工编写提示词、设计流程和管理上下文,不仅效率低下,还难…

张小明 2026/1/6 18:51:11 网站建设

网站建设什么qq营销网站源码

TypeScript 中的对象详解 在 TypeScript 中,对象 是最常见的数据结构之一。TypeScript 通过强大的类型系统来描述对象的形状(shape),确保对象属性存在、类型正确,从而大幅减少运行时错误。 1. 对象字面量与类型推断 …

张小明 2026/1/5 23:51:14 网站建设

教育培训门户网站模板下载78模板网免费模板

(1)实验平台:普中STM32F103朱雀、玄武开发板 我们知道 STM32F1 内部含有非常多的通信接口, 这一章我们就来学习下USART 串口通信。 本章要实现的功能是: STM32F1 通过 USART1 实现与 PC 机对话, STM32F1 的 USART1 收到 PC 机发来…

张小明 2026/1/6 17:20:06 网站建设

工信部网站icp备案企业网站设计话术

LobeChat模型水印技术应用探索 在AI生成内容(AIGC)日益泛滥的今天,一段看似真实的文本、图像或语音,可能并非出自人类之手。企业用大模型撰写报告,用户借开源模型创作文章,平台通过代理接口调用远程服务—…

张小明 2026/1/7 3:13:49 网站建设