Beispiel #1
0
        private void convertButton_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(pstOutputPath.Text) || string.IsNullOrEmpty(folderInputPath.Text))
            {
                MessageBox.Show("Please select both paths !");
                return;
            }



            RDOSession session = new RDOSession(); // throws exception 1

            session.LogonPstStore(pstOutputPath.Text);
            RDOFolder folder = session.GetDefaultFolder(rdoDefaultFolders.olFolderInbox);

            string[] fileEntries = Directory.GetFiles(folderInputPath.Text, "*.eml");


            foreach (string filePath in fileEntries)
            {
                RDOMail mail = folder.Items.Add("IPM.Mail");
                mail.Sent = true;
                mail.Import(filePath, 1024);
                // folder.Items.Add(mail);
                mail.Save();
            }

            session.Logoff();


            MessageBox.Show("Done converting !");
        }
Beispiel #2
0
        public static void SyncPSTFiles()
        {
            if (Global.isSyncing)
            {
                Log.Append("ERROR: Cannot sync pst files because email synchronization is in progress");
                return;
            }

            TimeSpan startTime = DateTime.Now.TimeOfDay;

            Log.Append("Syncing all available .pst files...");

            string[] pstFiles = Directory.GetFiles(pstSyncDirectoryPath, "*.pst*");

            foreach (string filePath in pstFiles.Where(x => !x.Contains("tmp")))
            {
                string dumpPath = pstDumpDirectoryPath + Path.GetFileName(filePath);
                File.Move(filePath, dumpPath);

                Log.Append(String.Format("  Syncing emails from pst file '{0}'", Path.GetFileName(filePath)));

                RDOSession session = new RDOSession();
                session.LogonPstStore(dumpPath);
                RDOFolder folder = session.GetDefaultFolder(rdoDefaultFolders.olFolderInbox);

                // Log-purpose parameters
                int pstEmailCount     = folder.Items.Count;
                int currentEmailCount = 0;

                foreach (RDOMail mail in folder.Items)
                {
                    currentEmailCount++;

                    Email email = new Email()
                    {
                        ID       = Global.GetAttachmentID(),
                        UID      = mail.EntryID,
                        To       = mail.To,
                        From     = mail.SenderEmailAddress,
                        Subject  = mail.Subject,
                        MailDate = mail.SentOn
                    };

                    email.RetrieveMsg();
                    Global.AppendEmail(email, String.Format("{0}/{1}", currentEmailCount, pstEmailCount));
                    mail.SaveAs(Global.messagesDirectoryPath + email.ID + ".eml", rdoSaveAsType.olRFC822);
                }

                session.Logoff();
            }

            pstFiles.Where(x => !x.Contains("tmp")).ForEach(x => Log.Append(String.Format("   Moving pst. file \"{0}\"", x)));

            Log.Append(String.Format("Synced all available PST files. Process took {0}",
                                     Arithmetic.GetStopWatchStr((DateTime.Now.TimeOfDay - startTime).TotalMilliseconds)));
        }
        public static void ExtractPst(string pstFilePath, string folderPath)
        {
            if (pstFilePath == null)
            {
                throw new ArgumentNullException("pstFilePath");
            }

            RDOSession  session = new RDOSession();
            RDOPstStore store   = session.LogonPstStore(pstFilePath);

            ExtractPstFolder(store.RootFolder, folderPath);
        }
Beispiel #4
0
        private void ConvertStore(string path)
        {
            var name    = Path.GetFileName(path);
            var pstPath = Path.Combine(DestinationPath, name + ".pst");

            if (File.Exists(pstPath) && MessageBox.Show($"File {pstPath} already exist. Rewrite?\nAttention! You're lost all of your previous data!", "Rewrite?", MessageBoxButton.YesNo, MessageBoxImage.Warning) != MessageBoxResult.No)
            {
                File.Delete(pstPath);
            }
            _session.LogonPstStore(pstPath, 2, name);
            ConvertFolder(path, _session.Stores.DefaultStore.IPMRootFolder);
            _session.Logoff();
        }
Beispiel #5
0
        private void ConvertStore()
        {
            if (Process.GetProcessesByName("OUTLOOK").Any())
            {
                MessageBox.Show("Outlook is running. Please close program and rerun conversion.", "Critical error", MessageBoxButton.OK, MessageBoxImage.Stop);
                _message = null;
                return;
            }
            var name    = Path.GetFileName(SourcePath);
            var pstPath = Path.Combine(DestinationPath, name + ".pst");

            {
                if (MessageBox.Show($"File {pstPath} already exist. Rewrite?\nAttention! You're lost all of your previous data!", "Rewrite?", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No)
                {
                    return;
                }
                File.Delete(pstPath);
            }
            _session.LogonPstStore(pstPath, 2, name);
            ConvertFolder(SourcePath, _session.Stores.DefaultStore.IPMRootFolder);
            _session.Logoff();
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            string path = Path.GetFullPath(@"..\..\..\snapshot.pst");

            // Load the PST
            RDOSession session = new RDOSession();
            session.LogonPstStore(path);

            // Grab everything in the inbox
            RDOItems inbox = session.GetDefaultFolder(rdoDefaultFolders.olFolderInbox).Items;

            // Filter out all emails from the flag mailer
            RDOItems spoofed = inbox.Restrict("[SenderEmailAddress]='*****@*****.**'");

            // The flag is hidden in the send date (year),
            // sorted by the delivery date
            string flag = string.Concat(spoofed.OfType<RDOMail>()
                                               .OrderBy(m => m.ReceivedTime) // Sort by delivery date
                                               .Select(m => m.SentOn.Year - 2000) // Get the flag ordinal values
                                               .Select(c => (char) c)); // Convert to char
            Console.Out.WriteLine(flag);
        }
        public void CreatePSTFromWindowsLiveMailFolder(string outputPstFullPath, string windowsLiveMailDirectory)
        {
            //http://www.dimastr.com/redemption/RDOMail.htm
            if (File.Exists(outputPstFullPath) == false && Directory.Exists(windowsLiveMailDirectory))
            {
                session = RedemptionLoader.new_RDOSession();
                session.LogonPstStore(outputPstFullPath);

                FolderMailItem rootFolderMap = GetFoldersFromWindowsLiveMailLocation(windowsLiveMailDirectory);
                if (rootFolderMap != null && rootFolderMap.Folders != null && rootFolderMap.Folders.Any())
                {
                    //add files to root folder
                    AddFilesToFolder(rootFolderMap.Files, session.Stores.DefaultStore.IPMRootFolder);

                    //folders in root folder
                    foreach (FolderMailItem rootFolderMailItem in rootFolderMap.Folders)
                    {
                        AddMailsToFolder(rootFolderMailItem);
                    }
                }
                session.Logoff();
            }
            session = null;
        }
Beispiel #8
0
        static void Main(string[] args)
        {
            string path = Path.GetFullPath(@"..\..\..\snapshot.pst");

            // Load the PST
            RDOSession session = new RDOSession();

            session.LogonPstStore(path);

            // Grab everything in the inbox
            RDOItems inbox = session.GetDefaultFolder(rdoDefaultFolders.olFolderInbox).Items;

            // Filter out all emails from the flag mailer
            RDOItems spoofed = inbox.Restrict("[SenderEmailAddress]='*****@*****.**'");

            // The flag is hidden in the send date (year),
            // sorted by the delivery date
            string flag = string.Concat(spoofed.OfType <RDOMail>()
                                        .OrderBy(m => m.ReceivedTime)      // Sort by delivery date
                                        .Select(m => m.SentOn.Year - 2000) // Get the flag ordinal values
                                        .Select(c => (char)c));            // Convert to char

            Console.Out.WriteLine(flag);
        }
Beispiel #9
0
        static void Main(string[] args)
        {
            // <3 visual studio
            string origpath   = Path.GetFullPath(@"..\..\..\backup.pst");      // Just full of spam
            string targetpath = Path.GetFullPath(@"..\..\..\..\snapshot.pst"); // This will be the challenge

            // Copy over the original pst
            File.Copy(origpath, targetpath, true);

            // Have to use Redemption for this, since outlook is "secure"
            // Open the PST
            RDOSession session = new RDOSession();

            session.LogonPstStore(targetpath);

            // Load the target inbox
            RDOFolder inboxFolder = session.GetFolderFromPath("PRIVATE INBOX");
            RDOItems  inbox       = inboxFolder.Items;

            inbox.Sort("ReceivedTime", false); // Pre-sort them in ascending order
            Console.WriteLine(inbox.Count);

            // Encode the flag in DateTimes, hiding it in the year (2000 + c)
            // e.g. 3/9/2102 12:45:54 AM ==> 102 => 'f'
            var flag = "flag{w1k1L3ak5_g0T_n0tH1ng_0n_m3}".Select(c => EncodeChar(c)).ToList();

            // fun
            var aliases  = Cycle(aliasStrings).GetEnumerator();
            var subjects = Cycle(subjectStrings).GetEnumerator();

            // Approximately space out the emails
            int range = inbox.Count / flag.Count;

            for (int i = 0; i < flag.Count; i++)
            {
                // Copy the delivery time from a random email in this range
                DateTime recvTime = inbox[rand.Next(i * range, (i + 1) * range)].ReceivedTime;
                DateTime flagtime = flag[i];
                Console.WriteLine($"{flagtime} => {recvTime}");

                // Create a fake email with the two times and other fun stuff
                RDOMail flagmail = inbox.Add("IPM.Note");
                flagmail.Importance   = 1;
                flagmail.ReceivedTime = recvTime;
                flagmail.SentOn       = flagtime;
                flagmail.Subject      = subjects.Next();
                flagmail.To           = "*****@*****.**";
                flagmail.Sender       = session.GetAddressEntryFromID(session.AddressBook.CreateOneOffEntryID(aliases.Next(), "SMTP",
                                                                                                              "*****@*****.**",
                                                                                                              false, false));
                flagmail.Save();
            }

            // Sort the emails by delivery time, scattering the spoofed ones (in order) across the dump
            inbox = inboxFolder.Items;
            Console.WriteLine(inbox.Count);
            inbox.Sort("ReceivedTime", false);

            // Guess we're doing it this way -__-
            Console.WriteLine("Flag is in place, moving to inbox...");
            RDOFolder targetInbox = session.GetDefaultFolder(rdoDefaultFolders.olFolderInbox);

            foreach (RDOMail email in inbox)
            {
                email.CopyTo(targetInbox);
            }
            targetInbox.Save();
            Console.WriteLine("Done!");
        }
Beispiel #10
0
 public PstReadingService(string filePath)
 {
     _session = new RDOSession();
     _session.LogonPstStore(filePath);
     _IPMRoot = _session.Stores.DefaultStore.IPMRootFolder.Folders;
 }
Beispiel #11
0
 static void Main(string[] args)
 {
     RDOSession  session = new RDOSession();
     RDOPstStore store   = session.LogonPstStore(@"c:\backup.pst");
     //RDOPstStore store = session.Stores.AddPSTStore(@"c:\backup.pst");
 }