public IActionResult BundleCreated(string bundleId) { if (bundleRepo.ContainsBundle(bundleId)) { return(View(new BundleViewModel(bundleRepo.Get(bundleId), dumpRepo.Get(bundleId)))); } throw new NotImplementedException($"bundleid '{bundleId}' does not exist in repository"); }
private async Task <IEnumerable <DumpViewModel> > GetDumpListViewModels(string bundleId) { var bundleInfo = bundleRepo.Get(bundleId); if (relationshipRepo.IsPopulated) { return(await Task.WhenAll(dumpRepo.Get(bundleId).Select(async x => new DumpViewModel(x, new BundleViewModel(bundleInfo), new Similarities(await similarityService.GetSimilarities(x.Id)))))); } return(dumpRepo.Get(bundleId).Select(x => new DumpViewModel(x, new BundleViewModel(bundleInfo)))); }
public override async Task <AnalyzerState> AnalyzeDump(DumpMetainfo dumpInfo, string analysisWorkingDir, AnalyzerState previousState) { if (dumpInfo.DumpType != DumpType.WindowsDump && dumpInfo.DumpType != DumpType.LinuxCoreDump) { return(previousState); } try { string dumpFilePath = dumpRepo.GetDumpFilePath(dumpInfo.Id); if (!File.Exists(dumpFilePath)) { dumpRepo.SetErrorMessage(dumpInfo.Id, $"Primary dump file not found (id: {dumpInfo.Id}, path: {dumpFilePath})"); return(AnalyzerState.Failed); } if (new FileInfo(dumpFilePath).Length == 0) { dumpRepo.SetErrorMessage(dumpInfo.Id, "The primary dump file is empty!"); return(AnalyzerState.Failed); } 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); } // Re-fetch dump info as it was updated dumpInfo = dumpRepo.Get(dumpInfo.Id); SDResult result = await dumpRepo.GetResultAndThrow(dumpInfo.Id); if (result != null) { return(AnalyzerState.Succeeded); } else { return(AnalyzerState.Failed); } } catch (Exception e) { Console.WriteLine(e.Message); dumpRepo.SetErrorMessage(dumpInfo.Id, e.ToString()); return(AnalyzerState.Failed); } finally { dumpInfo = dumpRepo.Get(dumpInfo.Id); if (settings.Value.DeleteDumpAfterAnalysis) { dumpRepo.DeleteDumpFile(dumpInfo.Id); } } }
private async Task <IEnumerable <DumpViewModel> > GetDumpListViewModels(string bundleId) { var bundleInfo = bundleRepo.Get(bundleId); if (relationshipRepo.IsPopulated) { return(await Task.WhenAll(dumpRepo.Get(bundleId).Select(async x => new DumpViewModel(x, new BundleViewModel(bundleInfo), new Similarities(await similarityService.GetSimilarities(x.Id)), new RetentionViewModel(x, dumpRepo.IsPrimaryDumpAvailable(x.Id), TimeSpan.FromDays(settings.WarnBeforeDeletionInDays), settings.UseJiraIntegration && jiraIssueRepository.IsPopulated && jiraIssueRepository.HasBundleOpenIssues(bundleId)))))); } return(dumpRepo.Get(bundleId).Select(x => new DumpViewModel(x, new BundleViewModel(bundleInfo)))); }
// called by WebSocketManager public void StartSession(string socketId, string bundleId, string dumpId, string initialCommand) { try { System.Console.WriteLine($"StartSession ({socketId}): {bundleId}, {dumpId}"); if (string.IsNullOrEmpty(bundleId) || string.IsNullOrEmpty(dumpId)) { return; } var dumpInfo = dumpRepo.Get(bundleId, dumpId); var dumpFilePath = dumpRepo.GetDumpFilePath(bundleId, dumpId); var dumpFilePathInfo = dumpFilePath != null ? new FileInfo(dumpFilePath) : null; var workingDirectory = dumpFilePathInfo?.Directory; var sdResult = dumpRepo.GetResult(bundleId, dumpId).Result; bool is64bit = sdResult?.SystemContext.ProcessArchitecture.Contains("64") ?? true; // default to 64 bit in case it's not known ConsoleAppManager mgr = null; var initialCommands = new List <string>(); if (dumpInfo.DumpFileName.EndsWith(".dmp", StringComparison.OrdinalIgnoreCase)) { mgr = StartCdb(socketId, workingDirectory, dumpFilePathInfo, is64bit, bundleId, dumpId); initialCommands.Add(".cordll -ve -u -l"); // load DAC and SOS } else { throw new NotSupportedException($"file extension of '{dumpInfo.DumpFileName}' not supported for interactive mode."); } if (mgr != null && !string.IsNullOrEmpty(initialCommand)) { initialCommands.Add(WebUtility.UrlDecode(initialCommand)); } RunInitialCommandsAsync(socketId, mgr, initialCommands); } catch (Exception e) { Console.WriteLine($"Error in StartSession: {e}"); } }
public void StartSession(string socketId, string bundleId, string dumpId) { try { System.Console.WriteLine($"StartSession ({socketId}): {bundleId}, {dumpId}"); if (string.IsNullOrEmpty(bundleId) || string.IsNullOrEmpty(dumpId)) { return; } var dumpInfo = dumpRepo.Get(bundleId, dumpId); bool is64bit = dumpInfo.Is64Bit.HasValue ? dumpInfo.Is64Bit.Value : true; // default to 64 bit in case it's not known. StartCdb(socketId, dumpRepo.GetDumpFilePath(bundleId, dumpId), is64bit); } catch (Exception e) { Console.WriteLine($"Error in StartSession: {e}"); } }
public async Task <IActionResult> Get(string bundleId) { // check if it is a bundle var bundleInfo = superDumpRepo.GetBundle(bundleId); if (bundleInfo == null) { return(NotFound("Resource not found")); } var resultList = new List <SDResult>(); foreach (var dumpInfo in dumpRepo.Get(bundleId)) { resultList.Add(await superDumpRepo.GetResult(bundleId, dumpInfo.DumpId)); } return(Content(JsonConvert.SerializeObject(resultList, Formatting.Indented, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }), "application/json")); }
private IEnumerable <DumpListViewModel> GetDumpListViewModels(string bundleId) { return(dumpRepo.Get(bundleId).Select(x => new DumpListViewModel(x, new Similarities(similarityService.GetSimilarities(x.Id).Result)))); }
public void ManySimilar() { similarityService.CalculateSimilarity(dumpRepo.Get(DumpIdentifier.Create("bundle1", "dump1")), true, DateTime.MinValue); }