Esempio n. 1
0
        public async Task Analyze(DumpMetainfo dumpInfo, string dumpFilePath, string analysisWorkingDir)
        {
            try {
                dumpRepo.SetDumpStatus(dumpInfo.BundleId, dumpInfo.DumpId, DumpStatus.Analyzing);

                if (dumpInfo.DumpType == DumpType.WindowsDump)
                {
                    await AnalyzeWindows(dumpInfo, new DirectoryInfo(analysisWorkingDir), dumpFilePath);
                }
                else if (dumpInfo.DumpType == DumpType.LinuxCoreDump)
                {
                    await AnalyzeLinux(dumpInfo, new DirectoryInfo(analysisWorkingDir), dumpFilePath);
                }
                else
                {
                    throw new Exception("unknown dumptype. here be dragons");
                }
                dumpRepo.SetDumpStatus(dumpInfo.BundleId, dumpInfo.DumpId, DumpStatus.Finished);
            } catch (Exception e) {
                Console.WriteLine(e.Message);
                dumpRepo.SetDumpStatus(dumpInfo.BundleId, dumpInfo.DumpId, DumpStatus.Failed, e.ToString());
            } finally {
                if (settings.Value.DeleteDumpAfterAnalysis)
                {
                    dumpStorage.DeleteDumpFile(dumpInfo.BundleId, dumpInfo.DumpId);
                }
            }
        }
Esempio n. 2
0
        public async Task Analyze(DumpMetainfo dumpInfo, string dumpFilePath, string analysisWorkingDir)
        {
            try {
                dumpRepo.SetDumpStatus(dumpInfo.BundleId, dumpInfo.DumpId, DumpStatus.Analyzing);

                if (dumpInfo.DumpType == DumpType.WindowsDump)
                {
                    await AnalyzeWindows(dumpInfo, new DirectoryInfo(analysisWorkingDir), dumpFilePath);
                }
                else if (dumpInfo.DumpType == DumpType.LinuxCoreDump)
                {
                    await LinuxAnalyzationAsync(dumpInfo, new DirectoryInfo(analysisWorkingDir), dumpFilePath);
                }
                else
                {
                    throw new Exception("unknown dumptype. here be dragons");
                }
                dumpRepo.SetDumpStatus(dumpInfo.BundleId, dumpInfo.DumpId, DumpStatus.Finished);

                // Re-fetch dump info as it was updated
                dumpInfo = dumpRepo.Get(dumpInfo.BundleId, dumpInfo.DumpId);

                SDResult result = await dumpRepo.GetResult(dumpInfo.BundleId, dumpInfo.DumpId);

                if (result != null)
                {
                    var bundle = bundleRepo.Get(dumpInfo.BundleId);
                    await elasticSearch.PushResultAsync(result, bundle, dumpInfo);
                }
            } catch (Exception e) {
                Console.WriteLine(e.Message);
                dumpRepo.SetDumpStatus(dumpInfo.BundleId, dumpInfo.DumpId, DumpStatus.Failed, e.ToString());
            } finally {
                if (settings.Value.DeleteDumpAfterAnalysis)
                {
                    dumpStorage.DeleteDumpFile(dumpInfo.BundleId, dumpInfo.DumpId);
                }
                await notifications.NotifyDumpAnalysisFinished(dumpInfo);

                similarityService.ScheduleSimilarityAnalysis(dumpInfo, false, DateTime.Now - TimeSpan.FromDays(90));                 // last 90 days.
            }
        }
Esempio n. 3
0
        public async Task Analyze(DumpMetainfo dumpInfo, string dumpFilePath, string analysisWorkingDir)
        {
            try {
                dumpRepo.SetDumpStatus(dumpInfo.BundleId, dumpInfo.DumpId, DumpStatus.Analyzing);

                if (dumpInfo.DumpType == DumpType.WindowsDump)
                {
                    await AnalyzeWindows(dumpInfo, new DirectoryInfo(analysisWorkingDir), dumpFilePath);
                }
                else if (dumpInfo.DumpType == DumpType.LinuxCoreDump)
                {
                    await LinuxAnalyzationAsync(dumpInfo, new DirectoryInfo(analysisWorkingDir), dumpFilePath);
                }
                else
                {
                    throw new Exception("unknown dumptype. here be dragons");
                }
                dumpRepo.SetDumpStatus(dumpInfo.BundleId, dumpInfo.DumpId, DumpStatus.Finished);

                SDResult result = dumpRepo.GetResult(dumpInfo.BundleId, dumpInfo.DumpId, out string err);
                if (result != null)
                {
                    var bundle = bundleRepo.Get(dumpInfo.BundleId);
                    await elasticSearch.PushResultAsync(result, bundle, dumpInfo);
                }
            } catch (Exception e) {
                Console.WriteLine(e.Message);
                dumpRepo.SetDumpStatus(dumpInfo.BundleId, dumpInfo.DumpId, DumpStatus.Failed, e.ToString());
            } finally {
                if (settings.Value.DeleteDumpAfterAnalysis)
                {
                    dumpStorage.DeleteDumpFile(dumpInfo.BundleId, dumpInfo.DumpId);
                }
                await notifications.NotifyDumpAnalysisFinished(dumpInfo);
            }
        }