OffensiveCSharp
OffensiveCSharp copied to clipboard
COMHunter update
- Changed from Trim to custom TrimEnd function in order to make program compatible with versions of .NET < 4.6
- Added ability to list method information using reflection. This method seems to work for internal windows COM classes. Ive seen it work occasionally on third party COM classes, but I'm not sure under what conditions. To-do: Include method signature information (the duplicate methods occasionally listed are a result of method overloading).
- Added -includesystem flag for searching system COM methods.
Some other proposed changes that might be added later:
- Ability to filter classes and methods based on search term.
- Ability to instantiate COM servers and list exposed methods via an -unsafe flag. Did not notice a difference on my test machine regarding instantiating the class vs using reflection only, but this could of been because the machine in question is a lab machine. Needs further testing.
Based on some testing I did, you can instantiate all COM classes in a safe manner by using Marshal.ReleaseCOMObject. This method will properly dispose the instantiated COM server objects, preventing a system crash. Note that doing this is operationally loud and not recommended. It's also slower than using reflection only. Decided to exclude this functionality from the pull request:
https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.marshal.releasecomobject?view=net-6.0