public DatabaseManager(IConfiguration config) { string host = config["Host"]; Mongo = new Mongo(host, config["Mongo:Port"], config["Mongo:Login"], config["Mongo:Password"], "vt_reports", "short_vt_reports"); Redis = new Redis(host, config["Redis:Port"]); //Neo4J = new Neo4J(host, config["Neo4j:Port"], config["Neo4j:Login"], config["Neo4j:Password"]); Neo4J = new Neo4JExperimental(host, config["Neo4j:Port"], config["Neo4j:Login"], config["Neo4j:Password"]); Postgres = new Postgres(host, config["Postgre:Port"], config["Postgre:Login"], config["Postgre:Password"], config["Postgre:Database"]); Elastic = new Elastic(host, config["ElasticSearch:Port"]); VirusTotal = new VirusTotal(@"Resources\.virustotal.api", @"Resources\sigs.json", Mongo); Logstash = new Logstash.Logstash(host, int.Parse(config["Logstash:Port"])); }
public async Task <bool> PushNewHost(string ip) { string subnetIp = await Neo4J.PushHostRaw(ip); if (subnetIp != default) { var parentSubnetPolicies = Redis.GetHostWildcards(subnetIp); await foreach (string policy in parentSubnetPolicies) { await Postgres.AttachPolicy(ip, policy); } } if (!await Postgres.InsertNewOne(ip)) { return(false); } await UpdateRedisStorage(); return(true); }
public async Task UpdateRedisStorage() { await Redis.PushHostData(await Postgres.GetEntities()); }