218 lines
5.9 KiB
C#
218 lines
5.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
using System.Management.Automation;
|
|
using System.Management.Automation.Provider;
|
|
using Intel.Management.Mei;
|
|
using Intel.Management.Wsman;
|
|
using Intel.Management.PSModule.Amt;
|
|
|
|
namespace Intel.Management.PSModule.Heci
|
|
{
|
|
class EtcService : DriveContainer
|
|
{
|
|
|
|
public EtcService(DriveItem parent)
|
|
: base("Etc", parent)
|
|
{
|
|
}
|
|
|
|
public override void GetChildItems(ChildWriter writer)
|
|
{
|
|
|
|
writer.Add(new CodeVersions(this));
|
|
writer.Add(new Protocols(this));
|
|
|
|
}
|
|
|
|
public override object GetReturnObject()
|
|
{
|
|
return new NameValuePairItem(Name, Value);
|
|
}
|
|
|
|
|
|
class CodeVersions : DriveContainer
|
|
{
|
|
|
|
public CodeVersions( DriveItem parent)
|
|
: base("CodeVersions", parent)
|
|
{
|
|
}
|
|
|
|
public override void GetChildItems(ChildWriter writer)
|
|
{
|
|
HECIClass heci = ((HeciRoot)GetRoot()).Heci;
|
|
heci.Init();
|
|
|
|
|
|
try
|
|
{
|
|
string boisString;
|
|
HECIClass.AMT_VERSION_TYPE[] verTypes;
|
|
if (heci.GetCodeVersions(out boisString, out verTypes))
|
|
{
|
|
writer.Add(new DriveEntry("BIOSVersion", boisString, this));
|
|
foreach (HECIClass.AMT_VERSION_TYPE verType in verTypes)
|
|
{
|
|
switch (verType.Description.Text)
|
|
{
|
|
case "AMT":
|
|
case "AMTApps":
|
|
case "Netstack":
|
|
case "Recovery Version":
|
|
case "Flash":
|
|
|
|
writer.Add(new DriveEntry(verType.Description.Text,
|
|
new MeVersionInfo(verType.Version.Text), this));
|
|
break;
|
|
default:
|
|
writer.Add(new DriveEntry(verType.Description.Text,
|
|
verType.Version.Text, this));
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
heci.DeInit();
|
|
}
|
|
}
|
|
|
|
public override object GetReturnObject()
|
|
{
|
|
return new NameValuePairItem(Name, Value);
|
|
}
|
|
|
|
} // EtcService
|
|
|
|
|
|
class RootHashItem : DriveEntry
|
|
{
|
|
public RootHashItem(string name, string value, DriveItem parent)
|
|
: base(name, value, parent)
|
|
{
|
|
}
|
|
|
|
public override object GetReturnObject()
|
|
{
|
|
return new HashItem(_name, _value.ToString());
|
|
}
|
|
}
|
|
|
|
class RootHashes : DriveContainer
|
|
{
|
|
|
|
public RootHashes(DriveItem parent)
|
|
: base("Hashes", parent)
|
|
{
|
|
|
|
}
|
|
|
|
public override void GetChildItems(ChildWriter writer)
|
|
{
|
|
HECIClass heci = ((HeciRoot)GetRoot()).Heci;
|
|
heci.Init();
|
|
try
|
|
{
|
|
HECIClass.HashEntry[] hashes;
|
|
if (heci.GetCertHashes(out hashes))
|
|
{
|
|
foreach (HECIClass.HashEntry entry in hashes)
|
|
{
|
|
writer.Add(new RootHashItem(entry.Thumbprint, entry.Name,this));
|
|
}
|
|
}
|
|
|
|
}
|
|
finally
|
|
{
|
|
heci.DeInit();
|
|
}
|
|
}
|
|
|
|
public override object GetReturnObject()
|
|
{
|
|
return new NameValuePairItem(Name, Value);
|
|
}
|
|
}
|
|
|
|
class DigestFolder : DriveContainer
|
|
{
|
|
public DigestFolder(DriveItem parent)
|
|
: base("Digest", parent)
|
|
{
|
|
|
|
}
|
|
|
|
public override void GetChildItems(ChildWriter writer)
|
|
{
|
|
|
|
IWsmanConnection conn = ((HeciRoot)GetRoot()).Connection;
|
|
|
|
IManagedReference refToSettings= conn.NewReference("SELECT * FROM AMT_GeneralSettings");
|
|
IManagedInstance settingsObj = refToSettings.Get();
|
|
|
|
|
|
writer.Add(new DriveEntry("Realm",settingsObj.GetProperty("DigestRealm").ToString(),this));
|
|
|
|
}
|
|
|
|
|
|
public override object GetReturnObject()
|
|
{
|
|
return new NameValuePairItem(Name, Value);
|
|
}
|
|
|
|
}
|
|
|
|
class TlsFolder : DriveContainer
|
|
{
|
|
public TlsFolder( DriveItem parent)
|
|
: base("TLS", parent)
|
|
{
|
|
}
|
|
|
|
public override void GetChildItems(ChildWriter writer)
|
|
{
|
|
writer.Add(new RootHashes( this));
|
|
|
|
}
|
|
|
|
|
|
public override object GetReturnObject()
|
|
{
|
|
return new NameValuePairItem(Name, Value);
|
|
}
|
|
|
|
}
|
|
|
|
class Protocols : DriveContainer
|
|
{
|
|
|
|
public Protocols(DriveItem parent)
|
|
: base("Protocols", parent)
|
|
{
|
|
}
|
|
|
|
public override void GetChildItems(ChildWriter writer)
|
|
{
|
|
writer.Add(new DigestFolder(this));
|
|
writer.Add(new TlsFolder(this));
|
|
}
|
|
|
|
public override object GetReturnObject()
|
|
{
|
|
return new NameValuePairItem(Name, Value);
|
|
}
|
|
}//end protocols
|
|
|
|
|
|
|
|
|
|
|
|
} // class
|
|
}//namespace
|