public void StartReporterThread() { var settings = new Settings(new SettingsReader("ActivityLogger.ini")); ActivityReport = new ActivityReport(); _activityLogger = ActivityLogger.Instance(ActivityReport, settings); var mouseClickLogger = MouseClickLogger.Instance(); var mouseClickReporter = MouseClickReporter.Instance(_activityLogger); mouseClickReporter.Subscribe(mouseClickLogger); var keyLogger = KeyLogger.Instance(); var keyReporter = KeyReporter.Instance(_activityLogger); keyReporter.Subscribe(keyLogger); Task.Factory.StartNew(() => { var activityReporter = new ActivityReporter(_activityReceiver); activityReporter.Subscribe(_activityLogger); var mouseLogger = new MouseLogger(); var mouseReporter = new MouseReporter(_activityLogger); mouseReporter.Subscribe(mouseLogger); var processLogger = new ProcessLogger(); var processReporter = new ProcessReporter(_activityLogger); processReporter.Subscribe(processLogger); var timeLogger = new TimeLogger(); var timeReporter = new TimeReporter(_activityLogger); timeReporter.Subscribe(timeLogger); var activityTypeLogger = new ActivityTypeLogger(settings); var activityTypeReporter = new ActivityTypeReporter(_activityLogger); activityTypeReporter.Subscribe(activityTypeLogger); while (true) { Thread.Sleep(1000); // KeyLogger & MouseClickLogger will log when keystrokes/clicks are // recorded, so no need to tell it to log here. mouseLogger.Log(); processLogger.Log(); timeLogger.Log(); activityTypeLogger.DetermineActivityType( processReporter.ProcessReport, mouseReporter.MouseReport, MouseClickReporter.Instance().MouseClickReport, KeyReporter.Instance().KeyReport); activityTypeLogger.Log(); _activityLogger.Log(); } }); }
/// <summary> /// Expected arguments: /// - args[0]: process to run under the sandbox /// - args[1..n]: optional arguments that are passed to the process 'as is' /// </summary> public static int Main(string[] args) { if (args.Length < 1) { PrintUsage(); return(1); } var tool = args[0]; var arguments = string.Join(" ", args.Skip(1)); var processReporter = new ProcessReporter(); var reportedProcesses = processReporter.RunProcessAndReport(tool, arguments); PrintProcesses(tool, reportedProcesses); return(0); }