示例#1
0
        public void Test()
        {
            for (int i = 0; i < testfiles.Length; i++)
            {
                string  location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ntfs_gpt", testfiles[i]);
                IFilter filter   = new LZip();
                filter.Open(location);
                IMediaImage image = new Vdi();
                Assert.AreEqual(true, image.Open(filter), testfiles[i]);
                Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]);
                Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]);
                List <Partition> partitions = Core.Partitions.GetAll(image);
                IFilesystem      fs         = new NTFS();
                int part = -1;
                for (int j = 0; j < partitions.Count; j++)
                {
                    if (partitions[j].Type == "Microsoft Basic data")
                    {
                        part = j;
                        break;
                    }
                }

                Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}");
                Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
                fs.GetInformation(image, partitions[part], out _, null);
                Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]);
                Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]);
                Assert.AreEqual("NTFS", fs.XmlFsType.Type, testfiles[i]);
                Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]);
                Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]);
                Assert.AreEqual(oemid[i], fs.XmlFsType.SystemIdentifier, testfiles[i]);
            }
        }
示例#2
0
        public void Test()
        {
            for (int i = 0; i < testfiles.Length; i++)
            {
                string  location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ext2", testfiles[i]);
                IFilter filter   = new LZip();
                filter.Open(location);
                IMediaImage image = new Vdi();
                Assert.AreEqual(true, image.Open(filter), testfiles[i]);
                Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]);
                Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]);
                IPartition parts = new MBR();
                Assert.AreEqual(true, parts.GetInformation(image, out List <Partition> partitions, 0), testfiles[i]);
                IFilesystem fs   = new ext2FS();
                int         part = -1;
                for (int j = 0; j < partitions.Count; j++)
                {
                    if (partitions[j].Type == "0x83")
                    {
                        part = j;
                        break;
                    }
                }

                Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}");
                Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
                fs.GetInformation(image, partitions[part], out _, null);
                Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]);
                Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]);
                Assert.AreEqual(extversion[i], fs.XmlFsType.Type, testfiles[i]);
                Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]);
                Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]);
            }
        }
示例#3
0
 public void Test()
 {
     for (int i = 0; i < testfiles.Length; i++)
     {
         string  location = Path.Combine(Consts.TestFilesRoot, "partitions", "rdb", testfiles[i]);
         IFilter filter   = new LZip();
         filter.Open(location);
         IMediaImage image = new Vdi();
         Assert.AreEqual(true, image.Open(filter), testfiles[i]);
         List <Partition> partitions = Core.Partitions.GetAll(image);
         Assert.AreEqual(wanted[i].Length, partitions.Count, testfiles[i]);
         for (int j = 0; j < partitions.Count; j++)
         {
             // Too chatty
             //Assert.AreEqual(wanted[i][j].PartitionDescription, partitions[j].PartitionDescription, testfiles[i]);
             Assert.AreEqual(wanted[i][j].Size, partitions[j].Size, testfiles[i]);
             Assert.AreEqual(wanted[i][j].Name, partitions[j].Name, testfiles[i]);
             Assert.AreEqual(wanted[i][j].Type, partitions[j].Type, testfiles[i]);
             Assert.AreEqual(wanted[i][j].Offset, partitions[j].Offset, testfiles[i]);
             Assert.AreEqual(wanted[i][j].Length, partitions[j].Length, testfiles[i]);
             Assert.AreEqual(wanted[i][j].Sequence, partitions[j].Sequence, testfiles[i]);
             Assert.AreEqual(wanted[i][j].Start, partitions[j].Start, testfiles[i]);
         }
     }
 }
示例#4
0
        public void Test()
        {
            for (int i = 0; i < testfiles.Length; i++)
            {
                string  location = Path.Combine(Consts.TestFilesRoot, "filesystems", "qnx4_mbr", testfiles[i]);
                IFilter filter   = new LZip();
                filter.Open(location);
                IMediaImage image = new Vdi();
                Assert.AreEqual(true, image.Open(filter), testfiles[i]);
                Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]);
                Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]);
                List <Partition> partitions = Core.Partitions.GetAll(image);
                IFilesystem      fs         = new QNX4();
                int part = -1;
                for (int j = 0; j < partitions.Count; j++)
                {
                    if (partitions[j].Type == "0x4D")
                    {
                        part = j;
                        break;
                    }
                }

                Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}");
                Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
                fs.GetInformation(image, partitions[part], out _, null);
                Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]);
                Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]);
                Assert.AreEqual("QNX4 filesystem", fs.XmlFsType.Type, testfiles[i]);
            }
        }
示例#5
0
 public void Test()
 {
     for (int i = 0; i < testfiles.Length; i++)
     {
         string  location = Path.Combine(Consts.TestFilesRoot, "filesystems", "zfs", testfiles[i]);
         IFilter filter   = new LZip();
         filter.Open(location);
         IMediaImage image = new Vdi();
         Assert.AreEqual(true, image.Open(filter), testfiles[i]);
         Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]);
         Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]);
         IFilesystem fs        = new ZFS();
         Partition   wholePart = new Partition
         {
             Name   = "Whole device",
             Length = image.Info.Sectors,
             Size   = image.Info.Sectors * image.Info.SectorSize
         };
         Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]);
         fs.GetInformation(image, wholePart, out _, null);
         Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]);
         Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]);
         Assert.AreEqual("ZFS filesystem", fs.XmlFsType.Type, testfiles[i]);
         Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]);
         Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]);
     }
 }
示例#6
0
        public void Test()
        {
            for (int i = 0; i < _testFiles.Length; i++)
            {
                string  location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "HAMMER (MBR)", _testFiles[i]);
                IFilter filter   = new LZip();
                filter.Open(location);
                IMediaImage image = new Vdi();
                Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
                Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
                Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
                List <Partition> partitions = Core.Partitions.GetAll(image);
                IFilesystem      fs         = new HAMMER();
                int part = -1;

                for (int j = 0; j < partitions.Count; j++)
                {
                    if (partitions[j].Type == "Hammer")
                    {
                        part = j;

                        break;
                    }
                }

                Assert.AreNotEqual(-1, part, $"Partition not found on {_testFiles[i]}");
                Assert.AreEqual(true, fs.Identify(image, partitions[part]), _testFiles[i]);
                fs.GetInformation(image, partitions[part], out _, null);
                Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
                Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
                Assert.AreEqual("HAMMER", fs.XmlFsType.Type, _testFiles[i]);
                Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
                Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
            }
        }
示例#7
0
        public void Test()
        {
            for (int i = 0; i < testfiles.Length; i++)
            {
                string  location = Path.Combine(Consts.TestFilesRoot, "filesystems", "ufs_mbr", testfiles[i]);
                IFilter filter   = new LZip();
                filter.Open(location);
                IMediaImage image = new Vdi();
                Assert.AreEqual(true, image.Open(filter), testfiles[i]);
                Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]);
                Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]);
                List <Partition> partitions = Core.Partitions.GetAll(image);
                IFilesystem      fs         = new FFSPlugin();
                int part = -1;
                for (int j = 0; j < partitions.Count; j++)
                {
                    if (partitions[j].Type == "0x63" || partitions[j].Type == "0xA8" || partitions[j].Type == "0xA5" ||
                        partitions[j].Type == "0xA9" || partitions[j].Type == "0x82" || partitions[j].Type == "0x83" ||
                        partitions[j].Type == "4.2BSD Fast File System" || partitions[j].Type == "Sun boot")
                    {
                        part = j;
                        break;
                    }
                }

                Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}");
                Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
                fs.GetInformation(image, partitions[part], out _, null);
                Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]);
                Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]);
                Assert.AreEqual(type[i], fs.XmlFsType.Type, testfiles[i]);
                Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]);
                Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]);
            }
        }
示例#8
0
 public void Test()
 {
     for (int i = 0; i < testfiles.Length; i++)
     {
         string  location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hpfs", testfiles[i]);
         IFilter filter   = new LZip();
         filter.Open(location);
         IMediaImage image = new Vdi();
         Assert.AreEqual(true, image.Open(filter), testfiles[i]);
         Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]);
         Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]);
         List <Partition> partitions = Core.Partitions.GetAll(image);
         IFilesystem      fs         = new HPFS();
         Assert.AreEqual(true, fs.Identify(image, partitions[0]), testfiles[i]);
         fs.GetInformation(image, partitions[0], out _, null);
         Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]);
         Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]);
         Assert.AreEqual("HPFS", fs.XmlFsType.Type, testfiles[i]);
         Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]);
         Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]);
         Assert.AreEqual(oemid[i], fs.XmlFsType.SystemIdentifier, testfiles[i]);
     }
 }