Skip to content

C# Tool to interact with MS Exchange based on MS docs

License

Notifications You must be signed in to change notification settings

ceramicskate0/SharpExchange

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SharpExchange

This command line POC that shows how C# can be used to interact with Microsoft Exchange (EWS). Showing that it can be done in other tooling other than Powershell. Yes this is a simple POC to show how it could be done. Its not 100%. You want to show off your l33t C# coder or red teamer skills open a pull request plz :) This is for educational purposes only. Dont use for evil or illegal things.

MS Documentation:

Like the work dont forget to hit that Star Button

            
            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
                

Dont use for evil or if not authorized to do so. This is for educational purposes only. Not an exploit.

3rd Party Depend:

If someone decides to use this (its already flagged by some A/V's on disk) here are some ideas for IOC:

  • Its C#, so AMSI is likely in play on modern systems where it is enabled

  • Can write text file to disk

  • Uses default .NET user agent string (For example: ... .NET CLR ...)

  • When Run the .NET exe could create the temp file in the user's account folder structure with its name.

  • GUID of app

  • Many more opportunites exist if code is reviewed

Credits:

  • Stackover flow
  • MS Docs

About

C# Tool to interact with MS Exchange based on MS docs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages