Exemplo n.º 1
0
        internal InjectionManager(InjectionMethod injectionMethod, string processName, string dllPath)
        {
            _injectionContext = new InjectionContext();

            _injectionWrapper = new InjectionWrapper(injectionMethod, processName, dllPath);

            _injectionExtensionCache = new Dictionary <string, IInjectionExtension>
            {
                { "EjectDll", new EjectDll(_injectionWrapper) },
                { "HideDllFromPeb", new HideDllFromPeb(_injectionWrapper) },
                { "RandomiseDllHeaders", new RandomiseDllHeaders(_injectionWrapper) }
            };

            var injectionMethodType = Type.GetType(string.Concat("Bleak.Injection.Methods.", injectionMethod.ToString()));

            _injectionMethod = (IInjectionMethod)Activator.CreateInstance(injectionMethodType, _injectionWrapper);

            // Ensure the architecture of the DLL is valid

            ValidationHandler.ValidateDllArchitecture(_injectionWrapper);
        }
Exemplo n.º 2
0
        internal InjectionManager(InjectionMethod injectionMethod, string processName, byte[] dllBytes)
        {
            _injectionContext = new InjectionContext();

            _injectionWrapper = new InjectionWrapper(injectionMethod, processName, dllBytes);

            _injectionExtensionCache = new Dictionary <string, IInjectionExtension>
            {
                { nameof(EjectDll), new EjectDll(_injectionWrapper) },
                { nameof(HideDllFromPeb), new HideDllFromPeb(_injectionWrapper) },
                { nameof(RandomiseDllHeaders), new RandomiseDllHeaders(_injectionWrapper) }
            };

            var injectionMethodType = Type.GetType("Bleak.Injection.Methods." + injectionMethod);

            _injectionMethod = (IInjectionMethod)Activator.CreateInstance(injectionMethodType, _injectionWrapper);

            // Ensure the architecture of the DLL is valid

            ValidationHandler.ValidateDllArchitecture(_injectionWrapper);
        }