public IPsItem GetIpsItemFromDomainItem(DomainsItem dominio) { IPsItem ip = null; var po = new ParallelOptions(); if (Program.cfgCurrent.ParallelDnsQueries != 0) { po.MaxDegreeOfParallelism = Program.cfgCurrent.ParallelDnsQueries; } Parallel.For(0, Program.data.computerDomains.Items.Count, po, delegate(int i) { if (dominio == computerDomains.Items[i].Domain) { for (int c = 0; c < computerIPs.Items.Count; c++) { if (computerIPs.Items[c].Computer.name == computerDomains.Items[i].Computer.name) { ip = computerIPs.Items[c].Ip; return; } } } }); return(ip); }
public RelationsItem(DomainsItem domain, IPsItem ip, string source) : base() { this.Domain = domain; this.Ip = ip; this.Ip.IdProject = Program.data.Project.Id; this.Source = source; }
public string GetDomainSource(string domain) { domain = domain.Trim(); DomainsItem d = null; try { d = domains.Items.First(S => S.Domain.ToLower() == domain.ToLower()); } catch { } return(d != null ? d.Source : string.Empty); }
public ComputerDomains GetComputerDomainsFromDomainsItem(DomainsItem dominio) { var lstComputers = new ComputerDomains(); var po = new ParallelOptions(); if (Program.cfgCurrent.ParallelDnsQueries != 0) { po.MaxDegreeOfParallelism = Program.cfgCurrent.ParallelDnsQueries; } Parallel.ForEach(Program.data.computerDomains.Items, S => { if ((S.Domain != null) && (S.Domain.Domain == dominio.Domain)) { lstComputers.Items.Add(S); } }); return(lstComputers); }
public ComputerDomainsItem(ComputersItem computer, DomainsItem domain, string source) : base() { this.Computer = computer; this.Domain = domain; this.Source = source; }
/// <summary> /// Add domain if this not exist in the list. /// </summary> /// <param name="domain"></param> /// <param name="source"></param> /// <param name="maxRecursion"></param> /// <param name="cfgCurrent"></param> public void AddDomain(string domain, string source, int maxRecursion, Configuration cfgCurrent) { domain = domain.Trim(); if (domains.Items.Any(S => S.Domain.ToLower() == domain.ToLower())) { return; } var dItem = new DomainsItem(domain, source); domains.Items.Add(dItem); #if PLUGINS Thread tPluginOnDomain = new Thread(new ParameterizedThreadStart(Program.data.plugins.OnNewDomain)); tPluginOnDomain.IsBackground = true; object[] oDomain = new object[] { new object[] { domain } }; tPluginOnDomain.Start(oDomain); #endif var domainParts = domain.Split('.'); var currentdomain = domainParts[domainParts.Length - 1]; for (var i = 2; i < domainParts.Length; i++) { currentdomain = domainParts[domainParts.Length - i] + "." + currentdomain; AddDomain(currentdomain, string.Format("{0} > Inferred by {2} [{1}]", GetDomainSource(domain), currentdomain, domain), maxRecursion - 1, cfgCurrent); } if (maxRecursion <= 0) { OnChangeEvent(null); return; } //OnLog(null, new EventsThreads.ThreadStringEventArgs(string.Format("Resolving domain: {0}", domain))); var listIpsOfDomain = DNSUtil.GetHostAddresses(domain); if (listIpsOfDomain.Count == 0) { var computer = new ComputersItem(); computer.type = ComputersItem.Tipo.Server; computer.name = domain; computer.NotOS = true; computer.os = OperatingSystem.OS.Unknown; if (!computers.Items.Any(S => S.name == domain)) { computers.Items.Add(computer); } } foreach (var IP in listIpsOfDomain) { if (Program.data.IsMainDomainOrAlternative(domain)) { var limit = Program.data.GetLimitFromIp(IP.ToString()); if (limit == null) { Program.data.AddLimit(new Limits(IP.ToString())); } else { var lastOct = int.Parse(IP.ToString().Split(new char[] { '.' })[3]); if (lastOct < limit.Lower) { limit.Lower = lastOct; } else if (lastOct > limit.Higher) { limit.Higher = lastOct; } } } AddResolution(domain, IP.ToString(), string.Format("{0} > DNS resolution [{1}]", GetDomainSource(domain), IP.ToString()), maxRecursion - 1, Program.cfgCurrent, false); } // Fingerprinting HTTP if (cfgCurrent.PassiveFingerPrintingHttp && cfgCurrent.FingerPrintingAllHttp) { if (NewDomainByHTTPServer != null) { NewDomainByHTTPServer(dItem, null); } } else if ((cfgCurrent.PassiveFingerPrintingHttp) && (source.ToLower() == "documents search" || source.ToLower().Contains("websearch") || source.ToLower().Contains("bing ip search") || source.ToLower().Contains("technologyrecognition") || source.ToLower().Contains("fingerprinting") || source.ToLower().Contains("certificate fingerprinting"))) { if (NewDomainByHTTPServer != null) { NewDomainByHTTPServer(dItem, null); } } // Fingerprinting SMTP if (cfgCurrent.PasiveFingerPrintingSmtp && cfgCurrent.FingerPrintingAllSmtp) { if (NewDomainByMXServer != null) { NewDomainByMXServer(dItem, null); } } else if ((cfgCurrent.PasiveFingerPrintingSmtp) && (source.ToLower().Contains("mx server"))) { if (NewDomainByMXServer != null) { NewDomainByMXServer(dItem, null); } } // Fingerprinting FTP if (cfgCurrent.FingerPrintingAllFtp) { if (NewDomainByFTPServer != null) { NewDomainByFTPServer(dItem, null); } } OnChangeEvent(null); }
public void FingerPrintDns(DomainsItem dom) { NewDomainByDNSServer?.Invoke(dom, null); }