public static void RemoteConnect(MSTSCConfig cfg) { AxMSTSCLib.AxMsRdpClient4 rdpc = new AxMSTSCLib.AxMsRdpClient4(); rdpc.UserName = cfg.usrname; rdpc.AdvancedSettings2.ClearTextPassword = cfg.password; rdpc.Server = cfg.ServerIP; rdpc.AdvancedSettings2.RDPPort = int.Parse(cfg.PortNum); rdpc.Domain = "."; rdpc.Connect(); //////AxMSTSCLib.AxMsTscAxNotSafeForScripting remoteserver = new AxMSTSCLib.AxMsTscAxNotSafeForScripting(); //////// //////// RDP //////// //////remoteserver.UserName = cfg.usrname; //////remoteserver.Server = cfg.ServerIP; //////remoteserver.SecuredSettings.FullScreen = 1; //////remoteserver.AdvancedSettings.Compress = 1; //////MSTSCLib.IMsTscNonScriptable secured = (MSTSCLib.IMsTscNonScriptable)remoteserver.SecuredSettings; //////secured.ClearTextPassword = cfg.password; //////remoteserver.Connect(); }
static void CreateRDSKeyFile() { Console.WriteLine("Please enter server IP"); MSTSCConfig cfg = new MSTSCConfig(); cfg.ServerIP = Console.ReadLine(); Console.WriteLine("Please enter Port number"); cfg.PortNum = Console.ReadLine(); Console.WriteLine("Please enter username"); cfg.usrname = Console.ReadLine(); Console.WriteLine("Please enter password"); cfg.usrname = Console.ReadLine(); cfg.PortNum = DefaultSetup(cfg.PortNum, "3389"); cfg.ServerIP = DefaultSetup(cfg.ServerIP, "40.74.83.17"); cfg.usrname = DefaultSetup(cfg.usrname, ".\\superqiu"); cfg.password = DefaultSetup(cfg.password, "111111.aaaaaa"); string text = aes.SerializeToString(cfg); Console.WriteLine(text); Console.WriteLine(); Console.WriteLine(); string encrypt = aes.EncryptString(text); Console.WriteLine(encrypt); File.WriteAllText("..\\..\\P01.txt", encrypt); Console.WriteLine("p01 text created"); }
public static void ReadAndRemoteLogin() { WebClient webclientForIP = new WebClient(); // string IPdefine = File.ReadAllText("..\\..\\P01.txt"); string IPdefine = webclientForIP.DownloadString("https://raw.githubusercontent.com/arisosoftware/RemoteDesk/master/RemoteAccess/P01.txt"); string decoded = aes.DecryptString(IPdefine); Console.WriteLine(decoded); MSTSCConfig cfg = SerializeFromString(decoded) as MSTSCConfig; string file = File.ReadAllText("remoteserver.RDP"); file = file.Replace("ServerIP", cfg.ServerIP); File.WriteAllText("server.RDP", file); // Console.WriteLine("请 输入密码 111111.aaaaaa 或者 control -P 复制"); //// try again... //System.Diagnostics.Process proc = new System.Diagnostics.Process(); //proc.EnableRaisingEvents = false; //proc.StartInfo.FileName = "rundll32.exe"; //proc.StartInfo.Arguments = "shell32,OpenAs_RunDLL " + "remoteserver.RDP"; //proc.Start(); System.Diagnostics.Process shellProcess = new System.Diagnostics.Process(); shellProcess.StartInfo.FileName = "mstsc.exe"; shellProcess.StartInfo.Arguments = "server.RDP"; shellProcess.StartInfo.ErrorDialog = true; shellProcess.Start(); }