public static void EXEBootstrapper_StartOmniEve() { try { _exeBootStrapper = new EXEBootStrapper(); EXEBootStrapper.StartOmniEve(); } catch (Exception ex) { Logging.Log("OmniEveLoader", "exception [" + ex + "]", Logging.White); } finally { //while (true) //{ // Thread.Sleep(50); //} Logging.Log("OmniEveLoader", "done", Logging.White); } }
public void Run(RemoteHooking.IContext InContext, string omniEveLoaderParameters, string logFileDirectory, string logFileName) { try { _OmniEveLoaderStarted = DateTime.UtcNow; if (string.IsNullOrEmpty(logFileDirectory) == false) { Logging.ConsoleLogPath = logFileDirectory; } if (string.IsNullOrEmpty(logFileName) == false) { Logging.ConsoleLogFile = logFileName; } if (string.IsNullOrEmpty(logFileDirectory) == false && string.IsNullOrEmpty(logFileName) == false) { Logging.SaveConsoleLog = true; } Logging.Log("OmniEveLoader", "OmniEveLoader has started", Logging.White); int i = 0; Logging.Log("OmniEveLoader", "OmniEveLoader Parameters we were passed [" + i + "] - [" + omniEveLoaderParameters + "]", Logging.White); while (true) { if (PrepareToLoadPreLoginSettingsFromINI(omniEveLoaderParameters)) { if (DateTime.UtcNow < _OmniEveLoaderStarted.AddSeconds(5) || _RestartOmniEveIfClosed) { Logging.Log("OmniEveLoader", "Starting OmniEve", Logging.White); EXEBootstrapper_StartOmniEve(); } while (EXEBootStrapper.EnumAppDomains().Any(e => e.FriendlyName == Main._appDomainNameToUse)) { try { System.Threading.Thread.Sleep(30000); if (_DebugAppDomains) { IEnumerable <AppDomain> CurrentlyExistingAppdomains = EXEBootStrapper.EnumAppDomains().ToList(); if (CurrentlyExistingAppdomains != null && CurrentlyExistingAppdomains.Any()) { int intAppdomain = 0; foreach (AppDomain _appdomain in EXEBootStrapper.EnumAppDomains()) { intAppdomain++; Logging.Log("OmniEveLoader", "[" + intAppdomain + "] AppDomain [" + _appdomain.FriendlyName + "]", Logging.White); } } else { Logging.Log("OmniEveLoader", "No AppDomains found.", Logging.White); } } } catch (Exception ex) { Logging.Log("OmniEveLoader", "exception [" + ex + "]", Logging.White); } } Logging.Log("OmniEveLoader", "The AppDomain [" + Main._appDomainNameToUse + "] was closed. Note: _RestartOmniEveIfClosed is [" + _RestartOmniEveIfClosed + "]", Logging.White); _lastAppDomainWasClosed = DateTime.UtcNow; while (DateTime.UtcNow < _lastAppDomainWasClosed.AddSeconds(30)) //wait for 30 seconds { if (_RestartOmniEveIfClosed) { Logging.Log("OmniEveLoader", "Waiting another [" + Math.Round(_lastAppDomainWasClosed.AddSeconds(30).Subtract(DateTime.UtcNow).TotalSeconds, 0) + "] sec before restarting OmniEve", Logging.White); } System.Threading.Thread.Sleep(2000); } } else { Logging.Log("OmniEveLoader", "unable to load settings from ini, halting]", Logging.White); } } //Logging.Log("OmniEveLoader", "OmniEveLoader: done.", Logging.White); } catch (Exception ex) { Logging.Log("OmniEveLoader", "exception [" + ex + "]", Logging.White); } }