Giter Club home page Giter Club logo

Comments (3)

dafthack avatar dafthack commented on September 6, 2024

I have also attempted to use reflection to load the DLL as well but am getting an exception:

New-Object : Exception calling ".ctor" with "1" argument(s): "The type initializer for 'Microsoft.Exchange.WebServices.Data.ExchangeServiceBase' threw an exception."
At C:\temp\MailSniper.ps1:361 char:22
+ $service = New-Object <<<<  Microsoft.Exchange.WebServices.Data.ExchangeService($ServiceExchangeVersion)

from mailsniper.

dafthack avatar dafthack commented on September 6, 2024

I have implemented a temporary work around to delete the EWS DLL but I'm leaving the issue open because I want to get this to work completely in memory, and not write the DLL to disk.

To delete the DLL I had to kill the primary PowerShell process before trying to delete the file. To do this I started a new PowerShell process, had it sleep for 250 milliseconds, exit the main process, then have the new process delete the DLL.

Relevant code (at the end both Invoke-GlobalMailSearch and Invoke-SelfSearch):

#Removing EWS DLL
Start-Process -NoNewWindow powershell.exe -argument "-command Start-Sleep -m 250; Remove-Item $env:temp\ews.dll -Force"
exit

from mailsniper.

dafthack avatar dafthack commented on September 6, 2024

This issue has been fixed with PR #38.

With much help from @HarmJ0y and @mattifestation the Exchange Web
Services DLL has been patched to prevent it from erroring out when
loaded via Reflective Assembly. All of the modules that used to write
it to disk now load it in memory.

The Exchange Web Services DLL used by MailSniper was patched to remove the implicit call to GetExecutingAssembly().Location in Microsoft.Exchange.WebServices.Data.EwsUtilities.<.cctor>b__9() that's called by the ExchangeServiceBase constructor when building the user agent string.

from mailsniper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.