Ejemplo n.º 1
0
    private void Connect()
    {
        string key = Settings.Default.key;

        byte[] bKey = key.Length > 0 ? CryptoAes.KeyToBytes(key, 32) : null; //256-bits
        byte[] bIv  = CryptoAes.KeyToBytes(key, 16);

        string username = Settings.Default.rdp_user;
        string password = CryptoAes.DecryptB64(Settings.Default.rdp_pass, bKey, bIv).Substring(1);

        mstsc.Server   = target;
        mstsc.UserName = username;
        IMsTscNonScriptable sec = (IMsTscNonScriptable)mstsc.GetOcx();

        sec.ClearTextPassword = password;

        mstsc.DesktopWidth  = this.ClientSize.Width;
        mstsc.DesktopHeight = this.ClientSize.Height;
        try {
            mstsc.Connect();
        } catch { }
    }
Ejemplo n.º 2
0
        public void LoadSettings()
        {
            int index = Settings.Default.ip_index;

            if (index > -1)
            {
                cmbListennerIp.SelectedIndex = index;
            }

            txtListennerPort.Value = Settings.Default.port;
            txtKey.Text            = Settings.Default.key;

            key  = txtKey.Text;
            bKey = key.Length > 0 ? CryptoAes.KeyToBytes(key, 32) : null; //256-bits
            bIv  = CryptoAes.KeyToBytes(key, 16);                         //128-bits

            srv_stamp.chkEnable.Checked = Settings.Default.stamp_enable;

            srv_uvnc.chkEnable.Checked = Settings.Default.uvnc_enable;
            srv_uvnc.txtExe.Text       = Settings.Default.uvnc_exe;
            srv_uvnc.txtParam.Text     = Settings.Default.uvnc_para;
            srv_uvnc.txtPassword.Text  = CryptoAes.DecryptB64(Settings.Default.uvnc_pass, bKey, bIv);

            if (srv_uvnc.txtPassword.Text.Length > 0) //remove salt
            {
                srv_uvnc.txtPassword.Text = srv_uvnc.txtPassword.Text.Substring(1);
            }


            srv_rdp.chkEnable.Checked = Settings.Default.mstsc_enable;
            srv_rdp.txtExe.Text       = Settings.Default.mstsc_exe;
            srv_rdp.txtParam.Text     = Settings.Default.mstsc_para;
            srv_rdp.txtUsername.Text  = Settings.Default.rdp_user;
            srv_rdp.txtPassword.Text  = CryptoAes.DecryptB64(Settings.Default.rdp_pass, bKey, bIv);

            if (srv_rdp.txtPassword.Text.Length > 0) //remove salt
            {
                srv_rdp.txtPassword.Text = srv_rdp.txtPassword.Text.Substring(1);
            }

            srv_pse.txtExe.Text      = Settings.Default.pse_exe;
            srv_pse.txtParam.Text    = Settings.Default.pse_para;
            srv_pse.txtUsername.Text = Settings.Default.pse_user;
            srv_pse.txtPassword.Text = CryptoAes.DecryptB64(Settings.Default.pse_pass, bKey, bIv);

            if (srv_pse.txtPassword.Text.Length > 0) //remove salt
            {
                srv_pse.txtPassword.Text = srv_pse.txtPassword.Text.Substring(1);
            }


            srv_winbox.txtExe.Text      = Settings.Default.winbox_exe;
            srv_winbox.txtParam.Text    = Settings.Default.winbox_para;
            srv_winbox.txtUsername.Text = Settings.Default.winbox_user;
            srv_winbox.txtPassword.Text = CryptoAes.DecryptB64(Settings.Default.winbox_pass, bKey, bIv);

            if (srv_winbox.txtPassword.Text.Length > 0) //remove salt
            {
                srv_winbox.txtPassword.Text = srv_winbox.txtPassword.Text.Substring(1);
            }


            chkOverrideWinRdpClient.Checked = Settings.Default.rdp_native_client;
        }