public CoverletConsoleUtil( IProcessUtil processUtil, ILogger logger, [Import(typeof(ICoverletConsoleDotnetToolsGlobalExecutor))] ICoverletConsoleExecutor globalExecutor, [Import(typeof(ICoverletConsoleCustomPathExecutor))] ICoverletConsoleExecutor customPathExecutor, [Import(typeof(ICoverletConsoleDotnetToolsLocalExecutor))] ICoverletConsoleExecutor localExecutor, IFCCCoverletConsoleExecutor fccExecutor ) { this.processUtil = processUtil; this.logger = logger; executors = new List <ICoverletConsoleExecutor> { localExecutor, customPathExecutor, globalExecutor, fccExecutor }; this.fccExecutor = fccExecutor; }
public FCCEngine( ICoverletUtil coverletUtil, IOpenCoverUtil openCoverUtil, ICoberturaUtil coberturaUtil, IMsTestPlatformUtil msTestPlatformUtil, IReportGeneratorUtil reportGeneratorUtil, IProcessUtil processUtil, IAppOptionsProvider appOptionsProvider, ILogger logger, IAppDataFolder appDataFolder, [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider ) { this.coverletUtil = coverletUtil; this.openCoverUtil = openCoverUtil; this.coberturaUtil = coberturaUtil; this.msTestPlatformUtil = msTestPlatformUtil; this.reportGeneratorUtil = reportGeneratorUtil; this.processUtil = processUtil; this.appOptionsProvider = appOptionsProvider; this.logger = logger; this.appDataFolder = appDataFolder; this.serviceProvider = serviceProvider; colorThemeService = serviceProvider.GetService(typeof(SVsColorThemeService)); }
/// <summary> /// Constructor for AuditEvent /// The constructor runs the rule prerequisites /// </summary> protected AuditEventGeneratorBase(IProcessUtil processUtil) { _processUtil = processUtil; foreach (string rule in AuditRulesPrerequisites) { string command = $"sudo auditctl {rule}"; try { _processUtil.ExecuteBashShellCommand(command); } catch (CommandExecutionFailedException ex) { if (ex.Error == AuditctlRuleAlreadyDefinedText) { SimpleLogger.Debug("rule already defined: " + command); } else { throw; } } } //establish checkpoint ExecuteAusearchWithFallback(); }
/// <inheritdoc /> public FirewallConfigurationSnapshotGenerator(IProcessUtil processUtil) { _processUtil = processUtil; string content = _processUtil.ExecuteBashShellCommand(IpTablesExistCommand); _isIptablesExist = !(string.IsNullOrEmpty(content)); }
/// <summary> /// Execute powershell commands /// </summary> /// <param name="processUtil">process utility instnace</param> /// <param name="cmd">Command to execute</param> /// <param name="errorHandler">Error handler to be called in case of an error while executing the command</param> /// <param name="acceptableExitCodes">Exit codes that considerd as OK</param> /// <returns>Command output</returns> public static string ExecutePowershellCommand(this IProcessUtil processUtil, string cmd, ErrorHandler errorHandler = null, IEnumerable <int> acceptableExitCodes = null) { CultureInfo currentCulture = Thread.CurrentThread.CurrentCulture; string args = $"-Command \"[System.Threading.Thread]::CurrentThread.CurrentCulture = [cultureinfo]::GetCultureInfo('{currentCulture}');{cmd}\""; return(processUtil.ExecuteProcess(@"PowerShell", args, errorHandler, acceptableExitCodes)); }
/// <inheritdoc /> public ProcessCreationEventGenerator(IProcessUtil processUtil) : base(processUtil) { executableHash = new Dictionary <string, string>(); string searchResultsString = processUtil.ExecuteBashShellCommand(searchIntegrityRuleCommand); IEnumerable <string> searchResults = searchResultsString.Split("----", StringSplitOptions.RemoveEmptyEntries); IEnumerable <AuditEvent> auditEvents = searchResults.Select(AuditEvent.ParseFromAusearchLine); foreach (AuditEvent auditEvent in auditEvents) { updateExecutablesDictonary(auditEvent); } }
public OpenCoverUtil( IMsTestPlatformUtil msTestPlatformUtil, IProcessUtil processUtil, ILogger logger, IToolFolder toolFolder, IToolZipProvider toolZipProvider) { this.msTestPlatformUtil = msTestPlatformUtil; this.processUtil = processUtil; this.logger = logger; this.toolFolder = toolFolder; this.toolZipProvider = toolZipProvider; }
public ReportGeneratorUtil( IAssemblyUtil assemblyUtil, IProcessUtil processUtil, ILogger logger, IToolFolder toolFolder, IToolZipProvider toolZipProvider ) { this.assemblyUtil = assemblyUtil; this.processUtil = processUtil; this.logger = logger; this.toolFolder = toolFolder; this.toolZipProvider = toolZipProvider; }
/// <inheritdoc /> public ETWEventGeneratorBase(IProcessUtil processUtil, IWmiUtils wmiUtils) { _wmiUtils = wmiUtils; foreach (ETWEventType etwEvent in ETWEvents) { _lastRetrievedEventTimeStamps[etwEvent] = ManagementDateTimeConverter.ToDmtfDateTime(DateTime.Now); } foreach (string command in PrerequisiteCommands) { processUtil.ExecuteWindowsCommand(command); } }
public CoverletDataCollectorUtil( IFileUtil fileUtil, IRunSettingsCoverletConfigurationFactory runSettingsCoverletConfigurationFactory, ILogger logger, IProcessUtil processUtil, IDataCollectorSettingsBuilderFactory dataCollectorSettingsBuilderFactory, ICoverletDataCollectorGeneratedCobertura coverletDataCollectorGeneratedCobertura, IProcessResponseProcessor processResponseProcessor, IToolZipProvider toolZipProvider, IToolFolder toolFolder ) { this.fileUtil = fileUtil; this.runSettingsCoverletConfigurationFactory = runSettingsCoverletConfigurationFactory; this.logger = logger; this.processUtil = processUtil; this.dataCollectorSettingsBuilderFactory = dataCollectorSettingsBuilderFactory; this.coverletDataCollectorGeneratedCobertura = coverletDataCollectorGeneratedCobertura; this.processResponseProcessor = processResponseProcessor; this.toolZipProvider = toolZipProvider; this.toolFolder = toolFolder; }
/// <summary> /// Ctor - creates a new event generator /// </summary> public LocalUsersSnapshotGenerator(IProcessUtil processUtil) { _processUtil = processUtil; }
/// <summary> /// Ctor - creates a new event generator /// </summary> public LoginEventGenerator(IWmiUtils wmiUtils, IProcessUtil processUtil) : base(processUtil, wmiUtils) { }
/// <summary> /// Ctor - creates a new event generator /// </summary> public ProcessTerminateEventGenerator(IProcessUtil processUtil, IWmiUtils wmiUtils) : base(processUtil, wmiUtils) { }
/// <summary> /// Ctor - creates a new event generator /// </summary> public BaselineEventGenerator(IProcessUtil processUtil) { _processUtil = processUtil; }
/// <inheritdoc /> public OutboundConnEventGenerator(IProcessUtil processUtil) : base(processUtil) { }
/// <summary> /// Execute shell (bin/bash) commands /// </summary> /// <param name="processUtil">process utility instnace</param> /// <param name="cmd">Command to execute</param> /// <param name="errorHandler">Error handler to be called in case of an error while executing the command</param> /// <param name="acceptableExitCodes">Exit codes that considerd as OK</param> /// <returns>Command output</returns> public static string ExecuteWindowsCommand(this IProcessUtil processUtil, string cmd, ErrorHandler errorHandler = null, IEnumerable <int> acceptableExitCodes = null) { string args = $"/C \"{cmd}\""; return(processUtil.ExecuteProcess(@"C:\Windows\System32\cmd.exe", args, errorHandler, acceptableExitCodes)); }
/// <inheritdoc /> public UserLoginEventGenerator(IProcessUtil processUtil) : base(processUtil) { }
/// <summary> /// Ctor - creates a new event generator /// </summary> public ConnectionEventGenerator(IProcessUtil processUtil, IWmiUtils wmiUtils) : base(processUtil, wmiUtils) { }
/// <inheritdoc /> protected ConnectionsEventGeneratorBase(IProcessUtil processUtil) : base(processUtil) { }
/// <summary> /// Ctor - creates a new event generator /// </summary> public ListeningPortsEventGenerator(IProcessUtil processUtil) { _processUtil = processUtil; }
/// <summary> /// Ctor - creates a new event generator /// </summary> public LocalusersEventGenerator(IWmiUtils wmiUtils, IProcessUtil processUtil) { _wmiUtils = wmiUtils; _processUtil = processUtil; }
/// <summary> /// Execute shell (bin/bash) commands /// </summary> /// <param name="processUtil">process utility instnace</param> /// <param name="cmd">Command to execute</param> /// <param name="errorHandler">Error handler to be called in case of an error while executing the command</param> /// <param name="acceptableExitCodes">Exit codes that considerd as OK</param> /// <returns>Command output</returns> public static string ExecuteBashShellCommand(this IProcessUtil processUtil, string cmd, ErrorHandler errorHandler = null, IEnumerable <int> acceptableExitCodes = null) { string args = $"-c \"{cmd}\""; return(processUtil.ExecuteProcess("/bin/bash", args, errorHandler, acceptableExitCodes)); }
/// <summary> /// Ctor - creates a new event generator /// </summary> public NetstatEventGenerator(IProcessUtil processUtil) { _processUtil = processUtil; }
/// <inheritdoc /> public override AuditEventGeneratorBase CreateInstance(IProcessUtil processUtil) { return(new ProcessCreationEventGenerator(processUtil)); }
/// <summary> /// Delegate for creating a new instance of derived type. /// derived type must be initialized with the given process util /// </summary> /// <param name="processUtil"></param> /// <returns></returns> public abstract AuditEventGeneratorBase CreateInstance(IProcessUtil processUtil);
private WmiUtils(IProcessUtil processUtils) { _processUtils = processUtils; }
/// <inheritdoc /> public ProcessCreationEventGenerator(IProcessUtil processUtil) : base(processUtil) { }
/// <inheritdoc /> public override AuditEventGeneratorBase CreateInstance(IProcessUtil processUtil) { SetupAusearchReturnValue(ProcessEvent); return(new ProcessCreationEventGenerator(processUtil)); }