public async Task StartAnalyzer() { await _redis.Subscribe(RedisKeys.RESOLVE_COMPLETE_CHANNEL, async msg => { _logger.LogInformation("Starting Analyzer Job"); var resolvedBlackDomain = await _redis.GetResolvedDomains(RedisKeys.BLACK_DOMAINS_RESOLVED); var resolvedWhiteDomain = await _redis.GetResolvedDomains(RedisKeys.WHITE_DOMAINS_RESOLVED); var suspectDomains = resolvedBlackDomain.Where(x => x.IPAddresses.Count > SuspectIpCount).AsEnumerable(); await _suspectDomainSevice.UpdateSuspectDomains(suspectDomains); var attacks = await _attackService.FindAttacks(resolvedBlackDomain, resolvedWhiteDomain); attacks = await _attackService.ExcludeDomains(attacks); var attackToNotify = await _attackService.UpdateDnsAttacks(attacks); var groupToNotify = await _attackService.UpdateDnsAttackGroups(); await _ipInfoService.UpdateIpInfo(true); if (attackToNotify.Any()) { var attackMessage = await _notifyService.BuildAttackMessage(string.Empty, attackToNotify.ToArray()); await _redis.Publish(RedisKeys.NOTIFY_SEND_CHANNEL, attackMessage.ProtoSerialize()); } if (groupToNotify.Any()) { var groupMessage = await _notifyService.BuildGroupMessage(string.Empty, groupToNotify.ToArray()); await _redis.Publish(RedisKeys.NOTIFY_SEND_CHANNEL, groupMessage.ProtoSerialize()); } _logger.LogInformation("Completed Analyzer Job"); }); }