这个命令行 POC 展示了如何使用 C# 与 Microsoft Exchange (EWS) 交互,表明除了 Powershell 之外,还可以用其他工具实现。 是的,这是一个简单的 POC,用来展示如何做到这一点。它并非 100% 完善。如果你想展示你高超的 l33t C# 编码或红队技能,欢迎提交 pull request :) 本工具仅供教育目的。请勿用于邪恶或非法用途。
Required Inputs (Must be in order shown):
ReadEmailExchange.exe WEBDomain DomainName Password InternalDomainName DUMPItem
Example WEBDomain: webmail.domain.com
Example DomainName: User1
Example Password: SecretPassword
Example InternalDomainName: domain
Options for DUMPItem:
Inbox
Sent
Drafts
Deleted
Skype
Attachments (Will Download Atatchments from the Inbox, DeletedItems, and Sent Items folders)
SendEmail ToEmailAddress~Subject~Body(Body can be file path)~AttachmentLocalFilePath(optional)
All (All == will try to dump all the items above)(I would default to this if unsure)
Optional Inputs:
ReadEmailExchange.exe WEBDomain DomainName Password InternalDomainName DUMPItem NumberOfSearchResultsToReturn
Example NumberOfSearchResultsToReturn (will return a maximum of the number,default 10): 10
Note: NumberOfSearchResultsToReturn must be a int/whole number
Optional Inputs:
ReadEmailExchange.exe WEBDomain DomainName Password InternalDomainName DUMPItem NumberOfSearchResultsToReturn OutputFileNameOrPath
Example OutputFileNameOrPath: C:\file.csv
Note: Program needs permission to write to location
Microsoft.Exchange.WebServices
它是 C# 写的,因此在启用了 AMSI 的现代系统上,AMSI 很可能发挥作用
可以向磁盘写入文本文件
使用默认的 .NET 用户代理字符串(例如:... .NET CLR ...)
运行时,该 .NET 可执行文件可能会在用户账户的文件夹结构中创建以它命名的临时文件
应用的 GUID
如果审查代码,还会发现更多机会