Example #1
0
        /// <summary>
        /// Search an IP address in Bing
        /// </summary>
        /// <param name="ip"></param>
        /// <returns></returns>
        public bool SearchIpBingSingleIp(string ip)
        {
            if (CheckToSkip())
            {
                EnableSkip("Skip to next IP");
                return(false);
            }

            if (ip.Contains("\\") || ip.Contains("/") || !DNSUtil.IsIPv4(ip))
            {
                return(false);
            }

            var message = $"[{PanelSearchIPBing.EngineToString(searchIPEngine)}] Searching domains in IP {ip}";

            Program.LogThis(new Log(Log.ModuleType.IPBingSearch, message, Log.LogType.debug));
            Program.ChangeStatus(message);
            List <string> currentResults;

            switch (searchIPEngine)
            {
            case PanelSearchIPBing.Engine.BingWeb:
                try
                {
                    var bingSearcher = new BingWebSearcher
                    {
                        LocatedInRegion = BingWebSearcher.Region.AnyRegion,
                        SearchAll       = true,
                        WriteInLanguage = BingWebSearcher.Language.AnyLanguage
                    };

                    currentResults = new List <string>();

                    SerchLinkWebBingEvent(ip, bingSearcher, currentResults);
                    break;
                }
                catch
                {
                    break;
                }

            case PanelSearchIPBing.Engine.BingAPI:
                var bingSearcherApi = new BingAPISearcher(Program.cfgCurrent.BingApiKey);
                currentResults = new List <string>();
                SerchLinkApiBingEvent(ip, bingSearcherApi, currentResults);
                break;
            }

            return(true);
        }
Example #2
0
        public bool IsIpInLimitRange(string ip)
        {
            var result = false;

            if (DNSUtil.IsIPv4(ip))
            {
                foreach (var limit in lstLimits)
                {
                    result = limit.IsInRangeLimit(ip);

                    if (result)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Example #3
0
        /// <summary>
        /// Search an IP address in Bing
        /// </summary>
        /// <param name="ip"></param>
        /// <returns></returns>
        public bool SearchIpBingSingleIp(string ip)
        {
            CancelIfSkipRequested();

            if (ip.Contains("\\") || ip.Contains("/") || !DNSUtil.IsIPv4(ip))
            {
                return(false);
            }

            var message = $"[{PanelSearchIPBing.EngineToString(searchIPEngine)}] Searching domains in IP {ip}";

            Program.LogThis(new Log(Log.ModuleType.IPBingSearch, message, Log.LogType.debug));
            Program.ChangeStatus(message);
            LinkSearcher searcher = null;

            try
            {
                switch (searchIPEngine)
                {
                case PanelSearchIPBing.Engine.BingWeb:
                    searcher = new BingWebSearcher
                    {
                        LocatedInRegion = BingWebSearcher.Region.AnyRegion,
                        WriteInLanguage = BingWebSearcher.Language.AnyLanguage
                    };
                    break;

                case PanelSearchIPBing.Engine.BingAPI:
                    searcher = new BingAPISearcher(Program.cfgCurrent.BingApiKey);
                    break;
                }
                SearchIP(ip, searcher);
            }
            catch (Exception)
            {
                return(false);
            }

            return(true);
        }