Example #1
0
        /// <inheritdoc />
        protected override void ProcessRecord()
        {
            var networkCredential = Credential.GetNetworkCredential();
            var userName          = networkCredential.UserName;
            var userDomain        = networkCredential.Domain;
            var userPassword      = networkCredential.Password;

            var rdp = new RDP();

            rdp.Connect(ComputerName, userDomain, userName, userPassword);

            if (rdp.Connected)
            {
                var sessionState = new RdpSessionStateInfo(rdp)
                {
                    ComputerName = ComputerName,
                    UserName     = userDomain.Length > 0? $"{userDomain.Split('.')[0]}\\{userName}": userName
                };
                WriteObject(sessionState);
            }
            else
            {
                WriteError(
                    new ErrorRecord(
                        new InvalidOperationException($"Failed to connect to {ComputerName}"),
                        null,
                        ErrorCategory.ConnectionError, ComputerName));
            }
        }
Example #2
0
        private static string DigLikeThereIsNoTomorrow()
        {
            bool   isHighIntegrity = Utils.IsHighIntegrity();
            string findings        = "";

            findings += McAfee.Dig(isHighIntegrity);
            findings += GPP.Dig();
            findings += Unattended.Dig();
            findings += PSReadLine.Dig(isHighIntegrity);
            findings += AWS.Dig(isHighIntegrity);
            findings += Azure.Dig(isHighIntegrity);
            findings += GCP.Dig(isHighIntegrity);
            findings += RDP.Dig(isHighIntegrity);
            findings += PuTTY.Dig(isHighIntegrity);
            findings += SuperPuTTY.Dig(isHighIntegrity);
            findings += WinSCP.Dig(isHighIntegrity);
            findings += FileZilla.Dig(isHighIntegrity);
            findings += VNC.Dig(isHighIntegrity);
            findings += TeamViewer.Dig();
            findings += PulseSecure.Dig();

            if (string.IsNullOrEmpty(findings))
            {
                return("\nDid not find anything :(\n");
            }
            else
            {
                return(findings);
            }
        }
Example #3
0
 public RdpPaintUpdates(RDP rdp)
 {
     if (rdp == null)
     {
         throw new ArgumentNullException(nameof(rdp));
     }
     _rdp = rdp;
 }
Example #4
0
 static void ThreadProc(RDP rdp)
 {
     while (procRunning)
     {
         // rdp.CheckFileDescriptor();
         Thread.Sleep(10);
     }
 }
Example #5
0
        private void PointsInternal(IToolContext context, double x, double y, Modifier modifier)
        {
            CurrentState = State.Start;

            if (Settings?.Simplify ?? true)
            {
                List <PointShape> points  = _path.GetPoints().Distinct().ToList();
                List <Vector2>    vectors = points.Select(p => new Vector2((float)p.X, (float)p.Y)).ToList();
                int      count            = vectors.Count;
                RDP      rdp      = new RDP();
                BitArray accepted = rdp.DouglasPeucker(vectors, 0, count - 1, Settings?.Epsilon ?? 1.0);
                int      removed  = 0;
                for (int i = 0; i <= count - 1; ++i)
                {
                    if (!accepted[i])
                    {
                        points.RemoveAt(i - removed);
                        ++removed;
                    }
                }

                _figure.Shapes.Clear();
                _figure.MarkAsDirty(true);

                if (points.Count >= 2)
                {
                    for (int i = 0; i < points.Count - 1; i++)
                    {
                        var line = new LineShape()
                        {
                            StartPoint = points[i],
                            Point      = points[i + 1],
                            Style      = context.CurrentStyle
                        };
                        _figure.Shapes.Add(line);
                    }
                }
            }

            context.WorkingContainer.Shapes.Remove(_path);

            if (_path.Validate(true) == true)
            {
                context.CurrentContainer.Shapes.Add(_path);
            }

            _path          = null;
            _figure        = null;
            _previousPoint = null;
            _nextPoint     = null;

            Filters?.ForEach(f => f.Clear(context));

            context.Release?.Invoke();
            context.Invalidate?.Invoke();
        }
Example #6
0
        public void RDPConnectionTest()
        {
            string IP       = TestContext.Parameters["IP"];
            string userName = TestContext.Parameters["UserName"];
            string password = "******";


            RDPLib.RDP rdp = new RDP();
            Assert.AreEqual("1", rdp.RDPConnect(IP, userName, password));
        }
Example #7
0
 /**
  * Instantiate RDP and Thread
  */
 public RdpSource(ISource iSource)
 {
     port         = 3389;
     hostname     = "localhost";
     username     = "******";
     domain       = "";
     password     = "";
     rdp          = new RDP();
     this.iSource = iSource;
     thread       = new Thread(() => ThreadProc(rdp));
 }
 private void Websocket_MessageReceived(object sender, MessageReceivedEventArgs e)
 {
     Dispatcher.Invoke(() =>
     {
         var G1      = new TreeEntry();
         var C1      = new RDP();
         C1.EntryID  = 1;
         C1.ParentID = 0;
         C1.Name     = "G1";
         G1.Config   = C1;
         RootEntry.Children.Add(G1);
     });
 }
Example #9
0
        public object ProcessPacket(object sender, string packet)
        {
            var foldersAndConnections = new SendFoldersAndConnections();

            var config1 = new RDP();

            config1.EntryID  = 0;
            config1.ParentID = 0;
            config1.Name     = "FirstEntry";
            foldersAndConnections.configentries.Add(config1);

            return(foldersAndConnections);
        }
Example #10
0
        public MainWindow()
        {
            InitializeComponent();

            _rdp             = new RDP();
            _rdpPaintUpdates = new RdpPaintUpdates(_rdp);
            _rdp.ErrorInfo  += Rdp_ErrorInfo;
            _rdp.Terminated += Rdp_Terminated;

            _rdp.SetUpdateInterface(_rdpPaintUpdates);
            _rdp.SetPrimaryUpdateInterface(_rdpPaintUpdates);

            UpdateStatusLabel();
        }
Example #11
0
        void buildTreeRecDFS(TreeNode parentNode,RDP parentNodeData)
        {
            foreach (var item in repo)
            {
                if (parentNodeData.ID == item.parentID)
                {
                    TreeNode node = new TreeNode(item.serverName);
                    node.ImageIndex = 0;
                    node.SelectedImageIndex= 0;

                    parentNode.Nodes.Add(node);
                    buildTreeRecDFS(node, item);
                }
            }
        }
Example #12
0
            private static void OpenConnectionFinal(Connection.Info newConnectionInfo, Connection.Info.Force Force,
                                                    Form ConForm)
            {
                try
                {
                    if (newConnectionInfo.Hostname == "" &&
                        newConnectionInfo.Protocol != Protocols.IntApp)
                    {
                        MessageCollector.AddMessage(MessageClass.WarningMsg,
                                                    Language.strConnectionOpenFailedNoHostname);
                        return;
                    }

                    if (newConnectionInfo.PreExtApp != "")
                    {
                        ExternalTool extA = GetExtAppByName(newConnectionInfo.PreExtApp);
                        if (extA != null)
                        {
                            extA.Start(newConnectionInfo);
                        }
                    }

                    //TODO
                    if (!(((Force & Info.Force.DoNotJump) == Info.Force.DoNotJump) || !SwitchToOpenConnection(newConnectionInfo)))
                    {
                        return;
                    }
                    Base newProtocol;
                        // Create connection based on protocol type
                        switch (newConnectionInfo.Protocol)
                        {
                            case Protocols.RDP:
                                newProtocol = new RDP();
                                break;
                            case Protocols.VNC:
                                newProtocol = new VNC();
                                break;
                            case Protocols.SSH1:
                                newProtocol = new SSH1();
                                break;
                            case Protocols.SSH2:
                                newProtocol = new SSH2();
                                break;
                            case Protocols.Telnet:
                                newProtocol = new Telnet();
                                break;
                            case Protocols.Rlogin:
                                newProtocol = new Rlogin();
                                break;
                            case Protocols.Serial:
                                newProtocol = new Serial();
                                break;
                            case Protocols.RAW:
                                newProtocol = new RAW();
                                break;
                            case Protocols.HTTP:
                                newProtocol = new HTTP(newConnectionInfo.RenderingEngine);
                                break;
                            case Protocols.HTTPS:
                                newProtocol = new HTTPS(newConnectionInfo.RenderingEngine);
                                break;
                            case Protocols.TeamViewer:
                                newProtocol = new TeamViewer();
                                break;
                            case Protocols.RAdmin:
                                newProtocol = new RAdmin();
                                break;
                            case Protocols.ICA:
                                newProtocol = new ICA();
                                break;
                            case Protocols.IntApp:
                                newProtocol = new IntApp();
                                if (newConnectionInfo.ExtApp == "")
                                {
                                    throw (new Exception(Language.strNoExtAppDefined));
                                }
                                break;
                            default:
                                return;
                        }

                    string cPnl;
                    if (((newConnectionInfo.Panel == "") | ((Force & Connection.Info.Force.OverridePanel) == Connection.Info.Force.OverridePanel)) | Settings.Default.AlwaysShowPanelSelectionDlg)
                    {
                        var frmPnl = new frmChoosePanel();
                        if (frmPnl.ShowDialog() == DialogResult.OK)
                        {
                            cPnl = frmPnl.Panel;
                        }
                        else
                        {
                            return;
                        }
                    }
                    else
                    {
                        cPnl = newConnectionInfo.Panel;
                    }

                    Form cForm = ConForm ?? WindowList.FromString(cPnl);
                    
                    if (cForm == null)
                    {
                        cForm = AddPanel(cPnl);
                        cForm.Focus();
                    }
                    else
                    {
                        (cForm as UI.Window.Connection).Show(frmMain.Default.pnlDock);
                        (cForm as UI.Window.Connection).Focus();
                    }

                    Control cContainer = (cForm as UI.Window.Connection).AddConnectionTab(newConnectionInfo);

                    if (newConnectionInfo.Protocol == Protocols.IntApp)
                    {
                        if (GetExtAppByName(newConnectionInfo.ExtApp).Icon != null)
                        {
                            (cContainer as TabPage).Icon =
                                GetExtAppByName(newConnectionInfo.ExtApp).Icon;
                        }
                    }

                    newProtocol.Closed +=  (cForm as UI.Window.Connection).Prot_Event_Closed;
                    newProtocol.Connected += (cForm as UI.Window.Connection).Prot_Event_Connected;
                    newProtocol.Disconnected += Prot_Event_Disconnected;
                    newProtocol.Connected += Prot_Event_Connected;
                    newProtocol.Closed += Prot_Event_Closed;
                    newProtocol.ErrorOccured += Prot_Event_ErrorOccured;
                    (cForm as UI.Window.Connection).ResizeBegin += newProtocol.ResizeBegin;
                    (cForm as UI.Window.Connection).ResizeEnd += newProtocol.ResizeEnd;
                    (cForm as UI.Window.Connection).Resize += newProtocol.Resize;

                    newProtocol.InterfaceControl = new InterfaceControl(cContainer, newProtocol, newConnectionInfo);

                    newProtocol.Force = Force;

                    if (newProtocol.SetProps() == false)
                    {
                        newProtocol.Close();
                        return;
                    }

                    if (newProtocol.Connect() == false)
                    {
                        newProtocol.Close();
                        if (newProtocol is PuttyBase&&!ProblemFixer.IsPuTTYOk())
                        {
                            ProblemFixer.FixPuTTYProblem();
                        }
                        if (newProtocol is TeamViewer && !ProblemFixer.IsTeamViewerOk())
                        {
                            ProblemFixer.FixTVProblem();
                        }
                        if (newProtocol is RAdmin && !ProblemFixer.IsRAdminOk())
                        {
                            ProblemFixer.FixRAdminProblem();
                        }
                        return;
                    }

                    newConnectionInfo.OpenConnections.Add(newProtocol);

                    if (newConnectionInfo.IsQuicky == false)
                    {
                        if (newConnectionInfo.Protocol != Protocols.IntApp)
                        {
                            Node.SetNodeImage(newConnectionInfo.TreeNode, Enums.TreeImage.ConnectionOpen);
                        }
                        else
                        {
                            ExternalTool extApp = GetExtAppByName((string)newConnectionInfo.ExtApp);
                            if (extApp != null)
                            {
                                if (extApp.TryIntegrate)
                                {
                                    if (newConnectionInfo.TreeNode != null)
                                    {
                                        Node.SetNodeImage(newConnectionInfo.TreeNode,
                                                          Enums.TreeImage.ConnectionOpen);
                                    }
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageCollector.AddMessage(MessageClass.ErrorMsg,
                                                Language.strConnectionOpenFailed + Constants.vbNewLine +
                                                ex.Message);
                }
            }
Example #13
0
 static void Main(string[] args)
 {
     RDP w = new RDP();
 }
Example #14
0
 internal RdpSessionStateInfo(RDP rdp)
 {
     _rdp = rdp;
 }
Example #15
0
 /**
  * Instantiate RDP and Thread
  */
 public RdpClient()
 {
     rdp    = new RDP();
     thread = new Thread(() => ThreadProc(rdp));
 }