示例#1
0
        public static bool SetSSH(string host, string username, string password, string ipforward, string portfoward, ref Process refproc)
        {
            bool       flag;
            SshChecker sshChecker    = new SshChecker();
            string     directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);

            if (File.Exists(string.Concat(directoryName, "\\Bitviseprofile")))
            {
                Directory.CreateDirectory(string.Concat(directoryName, "\\Bitviseprofile"));
            }
            directoryName = (new Uri(directoryName)).LocalPath;
            string str = Path.Combine(string.Concat(directoryName, "\\Bitviseprofile"), string.Concat("_", portfoward, ".bscp"));

            sshcommand.createProfile(ipforward, portfoward, str);
            string  str1    = string.Concat(new string[] { " -profile=\"", str, "\" -host=", host, " -port=22 -user="******" -password="******" -openTerm=n -openSFTP=n -openRDP=n -loginOnStartup -menu=small" });
            string  str2    = string.Concat(AppDomain.CurrentDomain.BaseDirectory, "Bitvise SSH Client\\BvSsh.exe");
            Process process = Process.Start(str2, str1);

            refproc = process;
            while ((DateTime.Now - process.StartTime).Seconds < 1)
            {
                Thread.Sleep(100);
            }
            IntPtr intPtr = sshcommand.FindWindowInProcess(process, (string s) => s.StartsWith("Bitvise SSH Client"));

            while (intPtr == IntPtr.Zero)
            {
                intPtr = sshcommand.FindWindowInProcess(process, (string s) => s.StartsWith("Bitvise SSH Client"));
                Thread.Sleep(100);
            }
            if (sshcommand.threadAccept(intPtr))
            {
                refproc = process;
                flag    = true;
            }
            else
            {
                process.Kill();
                flag = false;
            }
            return(flag);
        }
示例#2
0
        // Token: 0x0600054D RID: 1357 RVA: 0x00032B88 File Offset: 0x00030D88
        public static bool SetSSH(string host, string username, string password, string ipforward, string portfoward, ref Process refproc)
        {
            SshChecker sshChecker = new SshChecker();
            //string text = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
            string text = Directory.GetCurrentDirectory();

            if (File.Exists(text + "\\Bitviseprofile"))
            {
                Directory.CreateDirectory(text + "\\Bitviseprofile");
            }
            text = new Uri(text).LocalPath;
            string text2 = Path.Combine(text + "\\Bitviseprofile", "_" + portfoward + ".bscp");

            sshcommand.createProfile(ipforward, portfoward, text2);
            string arguments = string.Concat(new string[]
            {
                " -profile=\"",
                text2,
                "\" -host=",
                host,
                " -port=22 -user="******" -password="******" -openTerm=n -openSFTP=n -openRDP=n -loginOnStartup -menu=small"
            });
            string  fileName = AppDomain.CurrentDomain.BaseDirectory + "Bitvise SSH Client\\BvSsh.exe";
            Process process  = Process.Start(fileName, arguments);

            refproc = process;
            while ((DateTime.Now - process.StartTime).TotalSeconds < 1.0)
            {
                Thread.Sleep(100);
            }
            IntPtr   intPtr = sshcommand.FindWindowInProcess(process, (string s) => s.StartsWith("Bitvise SSH Client"));
            DateTime now    = DateTime.Now;

            while (intPtr == IntPtr.Zero)
            {
                intPtr = sshcommand.FindWindowInProcess(process, (string s) => s.StartsWith("Bitvise SSH Client"));
                Thread.Sleep(100);
                bool flag2 = (DateTime.Now - now).TotalSeconds > 20.0;
                if (flag2)
                {
                    return(false);
                }
            }
            bool flag3 = !sshcommand.threadAccept(intPtr);

            if (flag3)
            {
                try
                {
                    process.Kill();
                }
                catch (Exception)
                {
                }
                return(false);
            }
            refproc = process;
            return(true);
        }
示例#3
0
        // Token: 0x060003FA RID: 1018 RVA: 0x00027C5C File Offset: 0x00025E5C
        public static bool SetSSH(string host, string username, string password, string ipforward, string portfoward, ref Process refproc)
        {
            SshChecker sshChecker = new SshChecker();
            string     text       = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
            bool       flag       = File.Exists(text + "\\Bitviseprofile");

            if (flag)
            {
                Directory.CreateDirectory(text + "\\Bitviseprofile");
            }
            text = new Uri(text).LocalPath;
            string text2 = Path.Combine(text + "\\Bitviseprofile", "_" + portfoward + ".bscp");

            sshcommand.createProfile(ipforward, portfoward, text2);
            string arguments = string.Concat(new string[]
            {
                " -profile=\"",
                text2,
                "\" -host=",
                host,
                " -port=22 -user="******" -password="******" -openTerm=n -openSFTP=n -openRDP=n -loginOnStartup -menu=small"
            });
            string  fileName = AppDomain.CurrentDomain.BaseDirectory + "Bitvise SSH Client\\BvSsh.exe";
            Process process  = Process.Start(fileName, arguments);

            refproc = process;
            while ((DateTime.Now - process.StartTime).Seconds < 1)
            {
                Thread.Sleep(100);
            }
            Process             arg_135_0 = process;
            Func <string, bool> arg_135_1;

            if ((arg_135_1 = sshcommand.< > c.< > 9__25_0) == null)
            {
                arg_135_1 = (sshcommand.< > c.< > 9__25_0 = new Func <string, bool>(sshcommand.< > c.< > 9. < SetSSH > b__25_0));
            }
            IntPtr intPtr = sshcommand.FindWindowInProcess(arg_135_0, arg_135_1);

            while (intPtr == IntPtr.Zero)
            {
                Process             arg_160_0 = process;
                Func <string, bool> arg_160_1;
                if ((arg_160_1 = sshcommand.< > c.< > 9__25_1) == null)
                {
                    arg_160_1 = (sshcommand.< > c.< > 9__25_1 = new Func <string, bool>(sshcommand.< > c.< > 9. < SetSSH > b__25_1));
                }
                intPtr = sshcommand.FindWindowInProcess(arg_160_0, arg_160_1);
                Thread.Sleep(100);
            }
            bool flag2 = !sshcommand.threadAccept(intPtr);
            bool result;

            if (flag2)
            {
                process.Kill();
                result = false;
            }
            else
            {
                refproc = process;
                result  = true;
            }
            return(result);
        }