예제 #1
1
        public static bool ResetPassword(PSTFile pst)
        {
            var pc = new PropertyContext(SpecialNIDs.NID_MESSAGE_STORE, pst);
            var offset = pc.BTH.Root.BlankPassword(pst);

            return false;
        }
예제 #2
0
        public PSTHeader(PSTFile pst)
        {
            using(var mmfView = pst.PSTMMF.CreateViewAccessor(0, 684))
            {
                var temp = new byte[4];
                mmfView.ReadArray(0, temp, 0, 4);
                this.DWMagic = Encoding.Default.GetString(temp);

                var ver = mmfView.ReadInt16(10);

                this.IsANSI = ver == 14 || ver == 15 ? true : (ver == 23 ? (bool?)false : null);

                if (this.IsANSI != null && this.IsANSI.Value)
                {

                } else if (this.IsUNICODE != null && this.IsUNICODE.Value)
                {
                    //root.PSTSize = ByteReverse.ReverseULong(root.PSTSize);
                    var sentinel = mmfView.ReadByte(512);
                    var cryptMethod = (uint) mmfView.ReadByte(513);

                    this.EncodingAlgotihm = (BlockEncoding) cryptMethod;

                    var bytes = new byte[16];
                    mmfView.ReadArray(216, bytes, 0, 16);
                    var nbt_bref = new BREF(bytes);

                    mmfView.ReadArray(232, bytes, 0, 16);
                    var bbt_bref = new BREF(bytes);

                    this.NodeBT = new NDB.PSTBTree(nbt_bref, pst);
                    this.BlockBT = new NDB.PSTBTree(bbt_bref, pst);
                }
            }
        }
예제 #3
0
        public static bool ResetPassword(PSTFile pst)
        {
            var pc     = new PropertyContext(SpecialNIDs.NID_MESSAGE_STORE, pst);
            var offset = pc.BTH.Root.BlankPassword(pst);



            return(false);
        }
예제 #4
0
        public PSTHeader(PSTFile pst)
        {
            using (var mmfView = pst.PSTMMF.CreateViewAccessor(0, 684))
            {
                var dwMagicBuffer = new byte[4];
                mmfView.ReadArray(0, dwMagicBuffer, 0, 4);
                DWMagic = Encoding.Default.GetString(dwMagicBuffer);

                var ver = mmfView.ReadInt16(10);


                IsANSI    = ver == 14 || ver == 15;
                IsUNICODE = ver == 23;

                if (IsUNICODE)
                {
                    var fileSizeBuffer = new byte[8];
                    mmfView.ReadArray(184, fileSizeBuffer, 0, 8);
                    var fileSizeBytes = BitConverter.ToUInt64(fileSizeBuffer, 0);
                    Root = new PSTRoot(fileSizeBytes);

                    var sentinel    = mmfView.ReadByte(512);
                    var cryptMethod = (uint)mmfView.ReadByte(513);

                    EncodingAlgotihm = (BlockEncoding)cryptMethod;

                    var bytes = new byte[16];
                    mmfView.ReadArray(216, bytes, 0, 16);
                    var nbt_bref = new BREF(bytes);

                    mmfView.ReadArray(232, bytes, 0, 16);
                    var bbt_bref = new BREF(bytes);

                    NodeBT  = new NodeDatabaseLayer.PSTBTree(nbt_bref, pst);
                    BlockBT = new NodeDatabaseLayer.PSTBTree(bbt_bref, pst);
                }
            }
        }
예제 #5
0
        public MailFolder(ulong nid, List <string> path, PSTFile pst)
        {
            _pst = pst;

            Path = path;
            var pcNID = ((nid >> 5) << 5) | 0x02;

            PC          = new PropertyContext(pcNID, pst);
            DisplayName = Encoding.Unicode.GetString(PC.Properties[MessageProperty.DisplayName].Data);


            PC.Properties.TryGetValue(MessageProperty.ContainerClass, out ExchangeProperty containerClassProperty);
            ContainerClass = containerClassProperty == null ? "" : Encoding.Unicode.GetString(containerClassProperty.Data);

            Path = new List <string>(path)
            {
                DisplayName
            };

            var heirachyNID = ((nid >> 5) << 5) | 0x0D;
            var contentsNID = ((nid >> 5) << 5) | 0x0E;
            var faiNID      = ((nid >> 5) << 5) | 0x0F;

            HeirachyTC = new TableContext(heirachyNID, pst);

            SubFolders = new List <MailFolder>();
            foreach (var row in HeirachyTC.ReverseRowIndex)
            {
                SubFolders.Add(new MailFolder(row.Value, Path, pst));
                //SubFolderEntryIDs.Add(row.);
            }

            ContentsTC = new TableContext(contentsNID, pst);


            FaiTC = new TableContext(faiNID, pst);
        }
예제 #6
0
        public PSTHeader(PSTFile pst)
        {
            using (var mmfView = pst.PSTMMF.CreateViewAccessor(0, 684))
            {
                var dwMagicBuffer = new byte[4];
                mmfView.ReadArray(0, dwMagicBuffer, 0, 4);
                DWMagic = Encoding.Default.GetString(dwMagicBuffer);

                var ver = mmfView.ReadInt16(10);
                Version = ver == 23 ? PstVersion.UNICODE : PstVersion.ANSI;
                if (Version == PstVersion.ANSI)
                {
                    throw new Exception("ANSI encoded PST not supported");
                }

                var rootBuffer = new byte[72];
                mmfView.ReadArray(180, rootBuffer, 0, rootBuffer.Length);

                Root = new PSTRoot(rootBuffer);

                var sentinel    = mmfView.ReadByte(512);
                var cryptMethod = (uint)mmfView.ReadByte(513);

                EncodingAlgotihm = (BlockEncoding)cryptMethod;

                var bytes = new byte[16];
                mmfView.ReadArray(216, bytes, 0, 16);
                var nbt_bref = new BREF(bytes);

                mmfView.ReadArray(232, bytes, 0, 16);
                var bbt_bref = new BREF(bytes);

                NodeBT  = new PSTBTree(nbt_bref, pst);
                BlockBT = new PSTBTree(bbt_bref, pst);
            }
        }
예제 #7
0
        public PSTHeader(PSTFile pst)
        {
            using (var mmfView = pst.PSTMMF.CreateViewAccessor(0, 684))
            {
                var temp = new byte[4];
                mmfView.ReadArray(0, temp, 0, 4);
                this.DWMagic = Encoding.Default.GetString(temp);

                var ver = mmfView.ReadInt16(10);


                this.IsANSI = ver == 14 || ver == 15 ? true : (ver == 23 ? (bool?)false : null);

                if (this.IsANSI != null && this.IsANSI.Value)
                {
                }
                else if (this.IsUNICODE != null && this.IsUNICODE.Value)
                {
                    //root.PSTSize = ByteReverse.ReverseULong(root.PSTSize);
                    var sentinel    = mmfView.ReadByte(512);
                    var cryptMethod = (uint)mmfView.ReadByte(513);

                    this.EncodingAlgotihm = (BlockEncoding)cryptMethod;

                    var bytes = new byte[16];
                    mmfView.ReadArray(216, bytes, 0, 16);
                    var nbt_bref = new BREF(bytes);

                    mmfView.ReadArray(232, bytes, 0, 16);
                    var bbt_bref = new BREF(bytes);

                    this.NodeBT  = new NDB.PSTBTree(nbt_bref, pst);
                    this.BlockBT = new NDB.PSTBTree(bbt_bref, pst);
                }
            }
        }
예제 #8
0
 public MailStore(PSTFile pst)
 {
     this._pc = new PropertyContext(SpecialNIDs.NID_MESSAGE_STORE, pst);
     this.RootFolder = new EntryID(this._pc.BTH.GetExchangeProperties()[0x35e0].Data);
 }
예제 #9
0
        static void Main(string[] args)
        {
            var sw = new Stopwatch();
            sw.Start();
            var pstPath = @"C:\test\[email protected]";
            var logPath = @"C:\test\nidlog.txt";
            var pstSize = new FileInfo(pstPath).Length*1.0/1024/1024;
            using (var file = new PSTFile(pstPath))
            {
                Console.WriteLine("Magic value: " + file.Header.DWMagic);
                Console.WriteLine("Is Ansi? " + file.Header.IsANSI);

                var stack = new Stack<MailFolder>();
                stack.Push(file.TopOfPST);
                var totalCount = 0;
                if (File.Exists(logPath))
                    File.Delete(logPath);
                using (var writer = new StreamWriter(logPath))
                {
                    while (stack.Count > 0)
                    {
                        var curFolder = stack.Pop();

                        foreach (var child in curFolder.SubFolders)
                            stack.Push(child);
                        var count = curFolder.ContentsTC.RowIndexBTH.Properties.Count;
                        totalCount += count;
                        Console.WriteLine(String.Join(" -> ", curFolder.Path) + " ({0} messages)", count);

                        foreach (var ipmItem in curFolder)
                        {
                            if (ipmItem is Message)
                            {
                                var message = ipmItem as Message;
                                Console.WriteLine(message.Subject);
                                Console.WriteLine(message.Imporance);
                                Console.WriteLine("Sender Name: " + message.SenderName);
                                if (message.From.Count > 0)
                                    Console.WriteLine("From: {0}",
                                                      String.Join("; ", message.From.Select(r => r.EmailAddress)));
                                if (message.To.Count > 0)
                                    Console.WriteLine("To: {0}",
                                                      String.Join("; ", message.To.Select(r => r.EmailAddress)));
                                if (message.CC.Count > 0)
                                    Console.WriteLine("CC: {0}",
                                                      String.Join("; ", message.CC.Select(r => r.EmailAddress)));
                                if (message.BCC.Count > 0)
                                    Console.WriteLine("BCC: {0}",
                                                      String.Join("; ", message.BCC.Select(r => r.EmailAddress)));

                                writer.WriteLine(ByteArrayToString(BitConverter.GetBytes(message.NID)));
                            }
                        }
                    }
                }
                sw.Stop();
                Console.WriteLine("{0} messages total", totalCount);
                Console.WriteLine("Parsed {0} ({2:0.00} MB) in {1} milliseconds", Path.GetFileName(pstPath),
                                  sw.ElapsedMilliseconds, pstSize);
                //file.Header.NodeBT.Root.GetOffset(1);
                Console.Read();
            }
        }
예제 #10
0
 public MailStore(PSTFile pst)
 {
     _pc        = new PropertyContext(SpecialNIDs.NID_MESSAGE_STORE, pst);
     RootFolder = new EntryID(_pc.BTH.GetExchangeProperties()[MessageProperty.RootFolder].Data);
 }
예제 #11
0
 public MailStore(PSTFile pst)
 {
     this._pc        = new PropertyContext(SpecialNIDs.NID_MESSAGE_STORE, pst);
     this.RootFolder = new EntryID(this._pc.BTH.GetExchangeProperties()[0x35e0].Data);
 }