Ejemplo n.º 1
0
        public string getMails()
        {
            StringBuilder sb     = new StringBuilder();
            RDOFolder     folder = rdo.GetDefaultFolder(rdoDefaultFolders.olFolderInbox);

            string sSQL = "Select Subject from Folder WHERE Subject LIKE '%Your license order%'";
            //sSQL = "Select Subject from Folder where Subject<>''";

            RDOMail  item;
            RDOItems items = folder.Items;

            item = items.Find(sSQL);
            if (item == null)
            {
                sb.Append("no data found");
            }
            while (item != null)
            {
                sb.Append("===========================\r\n");
                sb.Append(item.ReceivedByName + ":");
                sb.Append(item.Subject + ":");
                if (item.Attachments.Count > 0)
                {
                    foreach (RDOAttachment a in item.Attachments)
                    {
                        sb.Append("\t" + a.FileName + "\r\n");
                    }
                }
                sb.Append("\r\n");

                item = items.FindNext();
            }

            return(sb.ToString());

            foreach (RDOMail m in folder.Items)
            {
                try
                {
                    sb.Append("===========================\r\n");
                    sb.Append(m.ReceivedByName + ":");
                    sb.Append(m.Subject + ":");
                    if (m.Attachments.Count > 0)
                    {
                        foreach (RDOAttachment a in m.Attachments)
                        {
                            sb.Append("\t" + a.FileName + "\r\n");
                        }
                    }
                    sb.Append("\r\n");
                }
                catch (Exception ex)
                {
                    helpers.addExceptionLog(m.ToString() + " is not an email");
                }
            }
            return(sb.ToString());
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
		public void UpdateTask()
		{
			SyncSem.WaitOne();

			if (syncEngine.SyncCanceled)
			{
				UpdateSem.Release();
				return;
			}

			syncEngine.CurrentTotal += MapAdded.Count + MapUpdated.Count;

			rdoSession = new RDOSessionClass();
			rdoSession.MAPIOBJECT = nsObject;
			rdoAddressBook = rdoSession.AddressBook;
			rdoAddressList = rdoAddressBook.GAL;
			rdoFld = rdoSession.GetDefaultFolder(rdoDefaultFolders.olFolderContacts);
			rdoItems = rdoFld.Items;

			foreach (Contact c in MapUpdated.Values)
			{
				if (owner != null)
				{
					Dispatcher.Invoke(new SyncProgressEventHandler(owner.Progress), this,
						"Updating " + "(" + syncEngine.CurrentItemNum + "/" + syncEngine.CurrentTotal + ")",
						syncEngine.CurrentItemNum, syncEngine.CurrentTotal);
					syncEngine.CurrentItemNum++;
				}

				RDOContactItem ctc = rdoItems[indexByFullname[c.FullName]] as RDOContactItem;
				FillProviderCreatedItem(c, ctc);
				ctc.Save();
			}

			foreach (Contact contact in MapAdded.Values)
			{
				if (owner != null)
				{
					Dispatcher.Invoke(new SyncProgressEventHandler(owner.Progress), this,
						"Updating " + "(" + syncEngine.CurrentItemNum + "/" + syncEngine.CurrentTotal + ")",
						syncEngine.CurrentItemNum, syncEngine.CurrentTotal);
					syncEngine.CurrentItemNum++;
				}

				if (contact.FullName != "")
				{
					RDOContactItem ctc = rdoItems.Add("IPM.Contact") as RDOContactItem;

					if (ctc != null)
						FillProviderCreatedItem(contact, ctc);

					ctc.Save();
				}
				else
				{
				}

				
			}

			UpdateSem.Release();
		}
Ejemplo n.º 4
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!");
        }
Ejemplo n.º 5
0
		public OutlookContactsProvider(IGUICallbacks host, SyncEngine syncEngine)
		{
			owner = host;

			outlookApp = new Microsoft.Office.Interop.Outlook.ApplicationClass();
			Microsoft.Office.Interop.Outlook.NameSpace ns = outlookApp .GetNamespace("MAPI");
			nsObject = ns.MAPIOBJECT;

			if (!IsRedemptionInstalled())
			{
				Process reg = new Process();
				reg.StartInfo.FileName = "regsvr32.exe";
				reg.StartInfo.Arguments = "/s Redemption.dll";
				reg.StartInfo.UseShellExecute = false;
				reg.StartInfo.CreateNoWindow = true;
				reg.StartInfo.RedirectStandardOutput = true;
				reg.Start();
				reg.WaitForExit();
				reg.Close();
			}
			else
			{
			}

			rdoSession = new RDOSessionClass();
			try
			{
				rdoSession.MAPIOBJECT = nsObject;
			}
			catch
			{
				Microsoft.Office.Interop.Outlook.MAPIFolder mf = outlookApp.Session.GetDefaultFolder(OlDefaultFolders.olFolderContacts);
				string pstPath = GetStorePath(mf.StoreID);
				//string pstPath = @"C:\Users\maxim\AppData\Local\Microsoft\Outlook\Outlook.pst";
				rdoSession.LogonPstStore(pstPath, 1, "", "", 0);
			}
			
			rdoAddressBook = rdoSession.AddressBook;
			rdoAddressList = rdoAddressBook.GAL;
			rdoFld = rdoSession.GetDefaultFolder(rdoDefaultFolders.olFolderContacts);
			rdoItems = rdoFld.Items;

			this.syncEngine = syncEngine;
		}