Beispiel #1
0
        private static void ShodanDataFound(object sender, EventsThreads.CollectionFound <ShodanRecognition.ShodanIPInformation> e)
        {
            try
            {
                if (e?.Data == null || e.Data.Count <= 0)
                {
                    return;
                }
                // just an object is received
                ShodanRecognition.ShodanIPInformation si = e.Data.First();
                Program.LogThis(new Log(Log.ModuleType.ShodanSearch,
                                        $"Found IP Information {si.IPAddress}", Log.LogType.low));

                var ei = new ExtendedIPInformation
                {
                    Country      = si.Country,
                    ServerBanner = si.ServerBanner
                };
                foreach (var hostName in si.HostNames)
                {
                    Program.data.AddResolution(hostName, si.IPAddress,
                                               $"Shodan Hostname [{hostName}]", 0, Program.cfgCurrent, true);
                }
                ei.OS             = si.OS;
                ei.ShodanResponse = si.ShodanResponse;
                // add data found in shodan to the IP address
                Program.data.SetIPInformation(si.IPAddress, ei);
                Program.data.GetServersFromIPs();
            }
            catch (Exception ex)
            {
                Program.LogThis(new Log(Log.ModuleType.ShodanSearch,
                                        $"Error managing Shodan data returned {ex.Message}", Log.LogType.error));
            }
        }
Beispiel #2
0
        public void SetIPInformation(string ip, ExtendedIPInformation info)
        {
            var i = GetIp(ip);

            if (i != null)
            {
                i.Information = info;
            }
        }