public async Task ComputerAvailability_IsComputerAvailable_BadOperatingSystem_ReturnsFalse()
        {
            var processor = new ComputerAvailability();
            var test      = await processor.IsComputerAvailable("test", "Linux Mint 1.0", "132682398326125518");

            Assert.False(test.Connectable);
            Assert.Equal(ComputerStatus.NonWindowsOS, test.Error);
        }
        public async Task ComputerAvailability_IsComputerAvailable_PortOpen_ReturnsTrue()
        {
            var processor = new ComputerAvailability(_truePortScanner);

            //Create a date 5 days ago
            var n = DateTime.Now.AddDays(-5) - new DateTime(1601, 01, 01, 0, 0, 0, DateTimeKind.Utc);

            var test = await processor.IsComputerAvailable("test", "Windows 10 Enterprise", n.Ticks.ToString());

            Assert.True(test.Connectable);
        }
        public async Task ComputerAvailability_IsComputerAvailable_PortClosed_ReturnsFalse()
        {
            var processor = new ComputerAvailability(_falsePortScanner);

            //Create a date 5 days ago
            var n = DateTime.Now.AddDays(-5) - new DateTime(1601, 01, 01, 0, 0, 0, DateTimeKind.Utc);

            var test = await processor.IsComputerAvailable("test", "Windows 10 Enterprise", n.Ticks.ToString());

            Assert.False(test.Connectable);
            Assert.Equal(ComputerStatus.PortNotOpen, test.Error);
        }
        public async Task ComputerAvailability_IsComputerAvailable_OldPwdLastSet_ReturnsFalse()
        {
            var processor = new ComputerAvailability();

            //Create a date 91 days ago. Our threshold for pwdlastset is 90 days
            var n = DateTime.Now.AddDays(-91) - new DateTime(1601, 01, 01, 0, 0, 0, DateTimeKind.Utc);

            var test = await processor.IsComputerAvailable("test", "Windows 10 Enterprise", n.Ticks.ToString());

            Assert.False(test.Connectable);
            Assert.Equal(ComputerStatus.OldPwd, test.Error);
        }
Exemple #5
0
 public ObjectProcessors(IContext context, ILogger log)
 {
     _context                  = context;
     _aclProcessor             = new ACLProcessor(context.LDAPUtils);
     _spnProcessor             = new SPNProcessors(context.LDAPUtils);
     _ldapPropertyProcessor    = new LDAPPropertyProcessor(context.LDAPUtils);
     _domainTrustProcessor     = new DomainTrustProcessor(context.LDAPUtils);
     _computerAvailability     = new ComputerAvailability(context.PortScanTimeout, skipPortScan: context.Flags.SkipPortScan, skipPasswordCheck: context.Flags.SkipPasswordAgeCheck);
     _computerSessionProcessor = new ComputerSessionProcessor(context.LDAPUtils);
     _groupProcessor           = new GroupProcessor(context.LDAPUtils);
     _containerProcessor       = new ContainerProcessor(context.LDAPUtils);
     _gpoLocalGroupProcessor   = new GPOLocalGroupProcessor(context.LDAPUtils);
     _methods                  = context.ResolvedCollectionMethods;
     _cancellationToken        = context.CancellationTokenSource.Token;
     _log = log;
 }