Beispiel #1
0
 public static bool isIPXE(this DHCPMessage message)
 {
     try
     {
         return(message.Options
                .Where(x => x.OptionType == (TDHCPOption)77)
                .Cast <DHCPOptionGeneric>()
                .Select(x => Encoding.ASCII.GetString(x.Data))
                .Any(x => x.Equals("iPXE", StringComparison.InvariantCultureIgnoreCase)));
     }
     catch { return(false); }
 }
Beispiel #2
0
 public static byte GetArch(this DHCPMessage message)
 {
     try
     {
         return(message.Options
                .Where(x => x.OptionType == TDHCPOption.ClientSystemArchitectureType)
                .Cast <DHCPOptionGeneric>()
                .Select(x => x.Data[1])
                .First());
     }
     catch { return(0); }
 }
Beispiel #3
0
        public static string GetVendorClass(this DHCPMessage message)
        {
            var sb      = new StringBuilder();
            var strings = message.Options
                          .Where(x => x.OptionType == TDHCPOption.VendorClassIdentifier)
                          .Cast <DHCPOptionVendorClassIdentifier>()
                          .Select(x => Encoding.ASCII.GetString(x.Data));

            try
            {
                foreach (var s in strings)
                {
                    sb.AppendLine(s);
                }
            }
            catch { }
            return(sb.ToString());
        }
Beispiel #4
0
 public static bool isPXE(this DHCPMessage message) => GetVendorClass(message).Contains("PXEClient");
Beispiel #5
0
 public static bool isHTTP(this DHCPMessage message) => GetVendorClass(message).Contains("HTTPClient");