public async Task <bool> ValidateThisMachine() { if (Credentials == null) { return(Warn("Credentials object is NULL.")); } foreach (var macAdress in MacAddresses.List()) { var dto = await GetPingByMacAddress(macAdress); if (Credentials.WasRejected) { return(Warn("Server rejected the credentials.")); } if (dto == null) { Warn($"Unregisted MAC address: {macAdress}"); continue; } PingNode = await AssemblePingNode(dto, macAdress); return(true); } return(Warn("No valid MAC addresses found.")); }
public override int GetHashCode() { unchecked { var hashCode = AgentID; hashCode = (hashCode * 397) ^ (MachineID != null ? MachineID.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (DeviceGuid != null ? DeviceGuid.GetHashCode() : 0); hashCode = (hashCode * 397) ^ CustomerID; hashCode = (hashCode * 397) ^ (CustomerName != null ? CustomerName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ FolderID.GetHashCode(); hashCode = (hashCode * 397) ^ (AgentName != null ? AgentName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (SystemName != null ? SystemName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (MachineName != null ? MachineName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (DomainName != null ? DomainName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (CurrentLoggedUsers != null ? CurrentLoggedUsers.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ComputerDescription != null ? ComputerDescription.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Monitored.GetHashCode(); hashCode = (hashCode * 397) ^ LastPatchManagementReceived.GetHashCode(); hashCode = (hashCode * 397) ^ (AgentVersion != null ? AgentVersion.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Favorite.GetHashCode(); hashCode = (hashCode * 397) ^ ThresholdID.GetHashCode(); hashCode = (hashCode * 397) ^ MonitoredAgentID.GetHashCode(); hashCode = (hashCode * 397) ^ Created.GetHashCode(); hashCode = (hashCode * 397) ^ Modified.GetHashCode(); hashCode = (hashCode * 397) ^ Online.GetHashCode(); hashCode = (hashCode * 397) ^ (ReportedFromIP != null ? ReportedFromIP.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (AppViewUrl != null ? AppViewUrl.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Motherboard != null ? Motherboard.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Processor != null ? Processor.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Memory.GetHashCode(); hashCode = (hashCode * 397) ^ (Display != null ? Display.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Sound != null ? Sound.GetHashCode() : 0); hashCode = (hashCode * 397) ^ ProcessorCoresCount.GetHashCode(); hashCode = (hashCode * 397) ^ (SystemDrive != null ? SystemDrive.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ProcessorClock != null ? ProcessorClock.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Vendor != null ? Vendor.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (VendorSerialNumber != null ? VendorSerialNumber.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (VendorBrandModel != null ? VendorBrandModel.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ProductName != null ? ProductName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (OS != null ? OS.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (OSType != null ? OSType.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (OSVersion != null ? OSVersion.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (OSBuild != null ? OSBuild.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (WindowsSerialNumber != null ? WindowsSerialNumber.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Office != null ? Office.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (OfficeSP != null ? OfficeSP.GetHashCode() : 0); hashCode = (hashCode * 397) ^ OfficeOEM.GetHashCode(); hashCode = (hashCode * 397) ^ (OfficeSerialNumber != null ? OfficeSerialNumber.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (OfficeFullVersion != null ? OfficeFullVersion.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (LastLoginUser != null ? LastLoginUser.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (HardwareDisks?.Sum(x => x.GetHashCode()) ?? 0); hashCode = (hashCode * 397) ^ (MacAddresses?.Sum(x => x.GetHashCode()) ?? 0); hashCode = (hashCode * 397) ^ (IpAddresses?.Sum(x => x.GetHashCode()) ?? 0); return(hashCode); } }
internal string GetMacAndPrivateIPs() { var list = MacAddresses.List(); for (int i = 0; i < list.Count; i++) { list[i] += " : " + PrivateIP.ForMAC(list[i]); } return(string.Join(L.f, list)); }
public async Task ProcessMacScanResults(List <SnmpResult <int, string> > results) { foreach (var snmpResult in results) { var monitoredPort = await EnsureMonitoredPort(snmpResult.SnmpTarget, snmpResult.Identifier); if (monitoredPort.SkipMacAddressScan) { continue; } var existing = await MacAddresses.Query().FirstOrDefaultAsync(mac => mac.Mac == snmpResult.Result); if (existing == null) { existing = new MacAddress { Mac = snmpResult.Result }; MacAddresses.Insert(existing); } var mapping = await MacPortMappings.Query() .FirstOrDefaultAsync(map => map.Mac == snmpResult.Result && map.PortNumber == snmpResult.Identifier); if (mapping == null) { mapping = new MacPortMapping { Mac = snmpResult.Result, PortNumber = snmpResult.Identifier, SnmpIpAddress = snmpResult.SnmpTarget.IpAddress, LastSeen = DateTime.Now }; MacPortMappings.Insert(mapping); } else { mapping.LastSeen = DateTime.Now; MacPortMappings.Update(mapping); } } await Context.SaveAsync(); }
private string GetFutureLicenseKey() { var rCfg = Repo1Cfg.Parse(ConfigKey); if (rCfg == null) { return(null); } var list = MacAddresses.List(); for (int i = 0; i < list.Count; i++) { list[i] = rCfg.GetLicenseKey(list[i]); } return(string.Join(L.f, list)); }
public void CollectCrowd() { UniqueMacCount = 0; ChairsOccupied = 0; MacAddresses.Clear(); foreach (WiFiTracker wiFiTracker in WiFiTrackers) { if (wiFiTracker.ComPort != null && wiFiTracker.ComPort != "") { MacAddresses.AddRange(wiFiTracker.Collect()); } } UniqueMacCount = (from x in MacAddresses select x).Distinct().Count(); if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { Chair.ReadChairOccupation(); } //foreach (PhysicalAddress mac in MacAddresses) //{ // Console.WriteLine(mac.ToString()); //} //Foreach I2C slave (stoelensysteem) }
public LicenseChecker() { this.macAddresses = MacAddresses.GetMacAddresses(); }
private string GetSessionKey() => (string.Join(",", MacAddresses.List()) + GetExePath() + ConfigKey).SHA1ForUTF8();