Esempio n. 1
0
        /// <summary>
        /// Search an IP in Shodan
        /// </summary>
        /// <param name="oThreadSafeListIp"></param>
        public void SearchIpInShodanNoAsync(object oThreadSafeListIp)
        {
            if (string.IsNullOrEmpty(Program.cfgCurrent.ShodanApiKey))
            {
                MessageBox.Show(@"Before searching with Shodan's API you must set up a Shodan API Key. You can do it in 'Options > General Config'");
                return;
            }
            Invoke(new MethodInvoker(delegate
            {
                const string strMessage = "Searching IPs in Shodan";
                Program.FormMainInstance.toolStripStatusLabelLeft.Text = strMessage;
                Program.LogThis(new Log(Log.ModuleType.ShodanSearch, strMessage, Log.LogType.debug));
            }));

            var lstIPs = (oThreadSafeListIp as ModifiedComponents.ThreadSafeList <string>);

            var shodanItem = new ShodanRecognition(Program.cfgCurrent.ShodanApiKey, lstIPs);

            shodanItem.DataFoundEvent += Program.FormMainInstance.ShodanDataFound;
            shodanItem.LogEvent       += Program.FormMainInstance.ShodanLog;
            shodanItem.EndEvent       += delegate
            {
                const string strMessage = "Finish Searching IPs in Shodan";
                Program.FormMainInstance.toolStripStatusLabelLeft.Text = strMessage;
                Program.LogThis(new Log(Log.ModuleType.Shodan, strMessage, Log.LogType.debug));
                shodanItem = null;
            };

            shodanItem.StartRecognitionNoAsync();
        }
Esempio n. 2
0
        /// <summary>
        /// Search a netrange in Shodan
        /// </summary>
        /// <param name="lstNetRange"></param>
        public void SearchNetrangeShodanNoAsync(ThreadSafeList <NetRange> lstNetRange)
        {
            Invoke(new MethodInvoker(delegate
            {
                const string strMessage = "Searching IPs in Shodan by netrange";
                Program.FormMainInstance.toolStripStatusLabelLeft.Text = strMessage;
                Program.LogThis(new Log(Log.ModuleType.ShodanSearch, strMessage, Log.LogType.debug));
            }));
            if (string.IsNullOrEmpty(Program.cfgCurrent.ShodanApiKey))
            {
                MessageBox.Show(@"Before searching with Shodan's API you must set up a Shodan API Key. You can do it in 'Options > General Config'");
                return;
            }
            var sr = new ShodanRecognition(Program.cfgCurrent.ShodanApiKey);

            sr.StartRecognitionNetRangeNoAsync(lstNetRange);
        }
Esempio n. 3
0
 private void SearchFpShodan()
 {
     if (string.IsNullOrEmpty(Program.cfgCurrent.ShodanApiKey))
     {
         MessageBox.Show(@"Before searching with Shodan's API you must set up a Shodan API Key. You can do it in 'Options > General Config'");
         return;
     }
     if (sr != null)
     {
         MessageBox.Show(@"Already searching in Shodan, please wait", Program.ProgramName,
                         MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else
     {
         sr = new ShodanRecognition(Program.cfgCurrent.ShodanApiKey, Program.data.GetIPs());
         sr.DataFoundEvent += ShodanDataFound;
         sr.LogEvent       += ShodanLog;
         sr.EndEvent       += delegate { sr = null; };
         sr.StartRecognition();
     }
 }