Пример #1
0
        public static void LogEncryptionPercentagesForEncryptingVolumes()
        {
            List <string> list = new List <string>();
            Exception     ex;
            List <string> encryptionPausedVolumes = BitlockerUtil.GetEncryptionPausedVolumes(out ex);

            if (ex == null && encryptionPausedVolumes != null && encryptionPausedVolumes.Count > 0)
            {
                list.AddRange(encryptionPausedVolumes);
            }
            if (encryptionPausedVolumes != null)
            {
                foreach (string text in encryptionPausedVolumes)
                {
                    if (BitlockerUtil.GetEncryptableVolume(text, out ex) == null)
                    {
                        ReplayCrimsonEvents.BitlockerEncryptableVolumeGetFailed.Log <string, string>(text, ex.Message);
                    }
                    else
                    {
                        string text2;
                        string text3;
                        bool   flag = BitlockerUtil.IsEncryptionPausedDueToBadBlocks(text, out ex, out text2, out text3);
                        if (flag)
                        {
                            ReplayCrimsonEvents.EncryptionPausedDueToBadBlocks.Log <string, string, string, string>(text, ex.Message, text2, text3);
                        }
                    }
                }
            }
            List <string> encryptingVolumes = BitlockerUtil.GetEncryptingVolumes(out ex);

            if (ex == null && encryptingVolumes != null && encryptingVolumes.Count > 0)
            {
                list.AddRange(encryptingVolumes);
            }
            foreach (string text4 in list)
            {
                ManagementObject encryptableVolume = BitlockerUtil.GetEncryptableVolume(text4, out ex);
                if (encryptableVolume == null)
                {
                    ReplayCrimsonEvents.BitlockerEncryptableVolumeGetFailed.Log <string, string>(text4, ex.Message);
                }
                else
                {
                    int num;
                    int bitlockerEncryptionPercentage = BitlockerUtil.GetBitlockerEncryptionPercentage(encryptableVolume, out num, out ex);
                    if (ex == null)
                    {
                        ReplayCrimsonEvents.BitlockerEncryptionPercentage.Log <string, int>(text4, bitlockerEncryptionPercentage);
                    }
                }
            }
        }
Пример #2
0
        // Token: 0x060015A9 RID: 5545 RVA: 0x0005610C File Offset: 0x0005430C
        public VolumeSpareStatus GetSpareStatus(out Exception exception)
        {
            exception = null;
            ExchangeVolume.Tracer.TraceDebug <MountedFolderPath>((long)this.GetHashCode(), "ExchangeVolume.GetSpareStatus(): Computing status of volume '{0}'.", this.VolumeName);
            if (!this.IsValid)
            {
                ExchangeVolume.Tracer.TraceError <DatabaseVolumeInfoException>((long)this.GetHashCode(), "ExchangeVolume.GetSpareStatus(): Returning Error because the ExchangeVolume instance is invalid. Error: {0}", this.LastException);
                exception = this.LastException;
                return(VolumeSpareStatus.Error);
            }
            if (!this.IsExchangeVolume || !this.IsAvailableAsSpare || this.DatabaseMountPoints.Length != 0)
            {
                ExchangeVolume.Tracer.TraceDebug <MountedFolderPath>((long)this.GetHashCode(), "ExchangeVolume.GetSpareStatus(): Returning Volume '{0}' is NotUsableAsSpare.", this.VolumeName);
                return(VolumeSpareStatus.NotUsableAsSpare);
            }
            ExchangeVolume.Tracer.TraceDebug((long)this.GetHashCode(), "ExchangeVolume.GetSpareStatus(): Found a potential spare volume...");
            MountedFolderPath exchangeVolumeMountPoint = this.ExchangeVolumeMountPoint;

            if (MountPointUtil.IsDirectoryNonExistentOrEmpty(exchangeVolumeMountPoint.Path, out exception))
            {
                ExchangeVolume.Tracer.TraceDebug <MountedFolderPath>((long)this.GetHashCode(), "ExchangeVolume.GetSpareStatus(): Returning Volume '{0}' is EmptySpare.", this.VolumeName);
                bool flag = BitlockerUtil.IsVolumeMountedOnVirtualDisk(this.VolumeName.Path, out exception);
                if (exception != null)
                {
                    ExchangeVolume.Tracer.TraceDebug <MountedFolderPath, Exception>((long)this.GetHashCode(), "ExchangeVolume.GetSpareStatus(): Exception finding whether Volume '{0}' is mounted on a virtual disk or not. Reason {1}", this.VolumeName, exception);
                }
                if (!flag)
                {
                    bool flag2 = false;
                    bool flag3 = false;
                    exception = BitlockerUtil.IsVolumeEncryptedOrEncrypting(this.VolumeName.Path, out flag2, out flag3);
                    if (exception != null)
                    {
                        ExchangeVolume.Tracer.TraceDebug <MountedFolderPath, Exception>((long)this.GetHashCode(), "ExchangeVolume.GetSpareStatus(): Exception finding whether Volume '{0}' is encrypting or not. Reason {1}", this.VolumeName, exception);
                    }
                    else
                    {
                        if (flag2)
                        {
                            return(VolumeSpareStatus.EncryptingEmptySpare);
                        }
                        if (flag3)
                        {
                            return(VolumeSpareStatus.EncryptedEmptySpare);
                        }
                        string arg;
                        string arg2;
                        bool   flag4 = BitlockerUtil.IsEncryptionPausedDueToBadBlocks(this.VolumeName.Path, out exception, out arg, out arg2);
                        if (exception != null)
                        {
                            ExchangeVolume.Tracer.TraceDebug <MountedFolderPath, Exception>((long)this.GetHashCode(), "ExchangeVolume.GetSpareStatus(): Exception finding whether Volume '{0}' has encryption paused due to bad blocks. Reason {1}", this.VolumeName, exception);
                            return(VolumeSpareStatus.Error);
                        }
                        if (flag4)
                        {
                            ExchangeVolume.Tracer.TraceDebug <MountedFolderPath, string, string>((long)this.GetHashCode(), "ExchangeVolume.GetSpareStatus(): Returning Volume '{0}' is Qurantined due to encryption paused due to bad blocks. Mount point {1}. Event Xml {2}", this.VolumeName, arg, arg2);
                            return(VolumeSpareStatus.Quarantined);
                        }
                    }
                }
                else
                {
                    ExchangeVolume.Tracer.TraceDebug <MountedFolderPath>((long)this.GetHashCode(), "ExchangeVolume.GetSpareStatus(): Volume mounted on virtual disk. Not attempting to find bitlocker spare status", this.VolumeName);
                }
                return(VolumeSpareStatus.UnEncryptedEmptySpare);
            }
            int num = 0;

            if (exception == null || FileOperations.IsCorruptedIOException((IOException)exception, out num))
            {
                ExchangeVolume.Tracer.TraceDebug <MountedFolderPath, string>((long)this.GetHashCode(), "ExchangeVolume.GetSpareStatus(): Returning Volume '{0}' is Quarantined because it has some files/directories under mountPath '{1}'.", this.VolumeName, exchangeVolumeMountPoint.Path);
                return(VolumeSpareStatus.Quarantined);
            }
            ExchangeVolume.Tracer.TraceError <string, Exception>((long)this.GetHashCode(), "ExchangeVolume.GetSpareStatus(): Returning Error because IsDirectoryNonExistentOrEmpty() returned exception for mountPath '{0}'. Exception: {1}", exchangeVolumeMountPoint.Path, exception);
            return(VolumeSpareStatus.Error);
        }