Beispiel #1
0
        public bruteResult Config(ref string dork, string objectString, string proxy = null, string additionalOne = null, string additionalTwo = null)
        {
            transActions++;
            try
            {
                string userAgent          = Leaf.xNet.Http.RandomUserAgent();
                Leaf.xNet.HttpRequest req = new Leaf.xNet.HttpRequest()
                {
                    IgnoreProtocolErrors = true,
                    AllowAutoRedirect    = true,
                    Cookies          = new CookieStorage(false),
                    ConnectTimeout   = helperObejct.timeOut * 1000,
                    ReadWriteTimeout = helperObejct.timeOut * 1000,
                    KeepAlive        = true,
                    UserAgent        = userAgent
                };
again:
                req.UserAgent = userAgent;
                if (NeedProxy)
                {
                    helperObejct.setProxy(ref req, proxy);
                }
                req.Get("https://www.google.com/ncr");
                req.ClearAllHeaders();
                req.Cookies = req.Response.Cookies;
                string url = $"https://www.google.com/search?q={dork}&num=100&hl=en&complete=0&safe=off&filter=0&btnG=Search&start=0";
                req.Get(url);
                string source   = req.Response.ToString();
                string nextPage = Regex.Match(source, @"href=""(\S{1,1000})"" aria-label=""Next page""").Groups[1].Value.ToString();
                source = WebUtility.UrlDecode(source);
                Regex           rx = new Regex(@"<a href=""/url[?]q=(\S{1,100})[&amp]");
                MatchCollection mt = rx.Matches(source);
                foreach (Match item in mt)
                {
                    string val = item.Groups[1].Value.ToString();
                    val = Regex.Replace(val, @"&amp\S{1,10000}", "");
                    if (Uri.IsWellFormedUriString(val, UriKind.Absolute))
                    {
                        if (!helperObejct.urlsList.Contains(val))
                        {
                            helperObejct.urlsList.Add(val);
                            helperObejct.Save(val, "Google");
                            Interlocked.Increment(ref statistics.urlFound);
                            Interlocked.Increment(ref statistics.google);
                            helperObejct.showStatusVoid();
                        }
                    }
                }
                if (nextPage.Length > 10)
                {
                    url = "https://www.google.com" + nextPage;
                    goto again;
                }
                else
                {
                    transActions--;
                    return(bruteResult.itsSearcher);
                }
            }
            catch (Exception E)
            {
                transActions--;
                helperObejct.HandleException(E);
                return(bruteResult.error);
            }
        }