Beispiel #1
0
        void LongTaskSpudHack()
        {
            //this is actually just sad to see code duplicated..

            if (this.TheGoogleHackDatabase.Count == 0)
            {
                MessageBox.Show("Please first load the GHDB - you have zero entries", "Error");
                return;
            }
            stopGH = false;
            //om.google.api.GoogleSearchService myGoogleservice = new com.google.api.GoogleSearchService();
            //com.google.api.GoogleSearchResult myGoogleresult = new com.google.api.GoogleSearchResult();
            //com.google.api.ResultElement myElement = new com.google.api.ResultElement();

            //string googleKey = txtGoogleKey.Text;
            this.Invoke(this.dlgControlerSetReadonly, new Object[] { this.txtGoogleHackTarget, true });
            this.Invoke(this.dlgControlDisable, new Object[] { this.btn_GHStart, false });
            this.Invoke(this.dlgControlDisable, new Object[] { this.btn_GHStop, true });
            this.Invoke(this.dlgControlProgMax, new Object[] { this.prgsGoogleHackAll, this.TheGoogleHackDatabase.Count });
            this.Invoke(this.dlgControlProgVal, new Object[] { this.prgsGoogleHackAll, 0 });

            for (int l = 0; l < this.TheGoogleHackDatabase.Count && (stopGH == false); l++)
            {

                GoogleHackDB_type GoogleHack = (GoogleHackDB_type)TheGoogleHackDatabase[l];

                this.Invoke(this.dlgControlProgInc, new Object[] { this.prgsGoogleHackAll, 1 });
                //prgsGoogleHackAll.Increment(1);
                if (GHstopscroll == false)
                {
                    this.Invoke(this.dlgControlListSel, new Object[] { this.lstGoogleHack, 1 });
                    //lstGoogleHack.SelectedIndex=l;
                }
                String the_target = this.Invoke(this.dlgControlTextGet, new Object[] { txtGoogleHackTarget }).ToString();
                string query = "site:" + the_target + " " + GoogleHack.querystring;
                this.Invoke(this.dlgControlTextSet, new Object[] { this.lblGoogleHackStatus, query });
                //lblGoogleHackStatus.Text=query;
                int j;
                int the_depth = System.Convert.ToInt32(this.Invoke(this.dlgControllNupGet, new Object[] { this.updownGoogleDepth }));
                ArrayList collectedURLS = new ArrayList();
                for (j = 0; j <= the_depth && (stopGH == false); j += 10)
                {
                    bool DoIGo = true;
                    com.sensepost.spud.obj.Service the_srv = new SensePost.Wikto.com.sensepost.spud.obj.Service();
                    com.sensepost.spud.obj.StructuredResult the_res = new SensePost.Wikto.com.sensepost.spud.obj.StructuredResult();

                    this.Invoke(this.dlgControlProgVal, new Object[] { this.prgGHQuick, 10 });

                    this.Invoke(this.dlgControlTextSet, new Object[] { this.lblGoogleHackPage, j.ToString() });
                    //lblGoogleHackPage.Text=j.ToString();
                    try
                    {
                        the_res = the_srv.GetStructResult(query, j, 10, true);
                        //myGoogleresult = myGoogleservice.doGoogleSearch
                        //    (googleKey, query, j, 10, false, "", false, "", "latin1", "latin1");
                    }
                    catch (Exception ex)
                    {
                        this.Invoke(this.dlgControlListAdd, new Object[] { this.lstGoogleHackResults, ex.Message.ToString() });
                        //lstGoogleHackResults.Items.Add(ex.Message);
                        //if (ex.Message.IndexOf("Invalid authorization key:") > 0)
                        //{
                        //    MessageBox.Show("Your Google API key appear to be invalid.\nPlease enter a valid key in System Config section.");
                        //    stopGH = true;
                        //}
                        DoIGo = false;
                    }
                    this.Invoke(this.dlgControlProgVal, new Object[] { this.prgGHQuick, 0 });

                    this.Invoke(this.dlgControlTextSet, new Object[] { this.lblGoogleHackEst, the_res.ResultTotal.ToString() });
                    //lblGoogleHackEst.Text=myGoogleresult.estimatedTotalResultsCount.ToString();

                    if (DoIGo)
                    {
                        foreach (com.sensepost.spud.obj.StructuredResultElement the_elm in the_res.ResultItems)
                        {
                            collectedURLS.Add(the_elm.ResultUrl.ToString());
                        }
                    }
                    //for (i = 0; i < 10 && (stopGH == false); i++)
                    //{
                    //    try
                    //    {
                    //        myElement = myGoogleresult.resultElements[i];
                    //        collectedURLS.Add(myElement.URL.ToString());
                    //    }
                    //    catch
                    //    {
                    //        this.Invoke(this.dlgControlTextSet, new Object[] { this.lblGoogleHackStatus, "Done" });
                    //        //lblGoogleHackStatus.Text ="Done";
                    //        j = 99999999;
                    //        break;
                    //    }
                    // }
                }
                if (collectedURLS.Count > 0)
                {
                    this.Invoke(this.dlgControlListAdd, new Object[] { lstGoogleHackResults, "" });
                    this.Invoke(this.dlgControlListAdd, new Object[] { lstGoogleHackResults, GoogleHack.signatureReferenceNumber + "\t" + GoogleHack.querystring });
                    this.Invoke(this.dlgControlListAdd, new Object[] { lstGoogleHackResults, "---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------" });
                    //lstGoogleHackResults.BackColor=System.Drawing.Color.White;
                    foreach (string Url in collectedURLS)
                    {
                        this.Invoke(this.dlgControlListAdd, new Object[] { lstGoogleHackResults, Url });
                        //lstGoogleHackResults.Items.Add(Url);
                    }
                }
            }
        }
Beispiel #2
0
        private void btnGoogleHackOnceOff_Click(object sender, System.EventArgs e)
        {

            //ermm..
            stopGH = false;
            btn_GHStop.Enabled = true;
            btn_GHStart.Enabled = false;
            //string googleKey = txtGoogleKey.Text;
            ArrayList collectedURLS = new ArrayList();

            string query = txtGoogleHackOnceOff.Text;
            lblGoogleHackStatus.Text = query;
            int j;

            for (j = 0; j <= (int)updownGoogleDepth.Value && (stopGH == false); j += 10)
            {
                com.sensepost.spud.obj.Service the_srv = new SensePost.Wikto.com.sensepost.spud.obj.Service();
                com.sensepost.spud.obj.StructuredResult the_res = new SensePost.Wikto.com.sensepost.spud.obj.StructuredResult();

                prgGHQuick.Value = 10;
                lblGoogleHackPage.Text = j.ToString();

                try
                {
                    the_res = the_srv.GetStructResult(query, j, 10, false);
                    //myGoogleresult = myGoogleservice.doGoogleSearch(googleKey, query, j, 10, false, "", false, "", "latin1", "latin1");
                }
                catch (Exception ex)
                {
                    lstGoogleHackResults.Items.Add(ex.Message);
                }
                prgGHQuick.Value = 0;
                //lblGoogleHackEst.Text = myGoogleresult.estimatedTotalResultsCount.ToString();

                lstGoogleHackResults.Items.Add("�");
                lstGoogleHackResults.Items.Add("Once off:\t" + query);
                lstGoogleHackResults.Items.Add("---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------");
                lstGoogleHackResults.BackColor = System.Drawing.Color.White;
                foreach (com.sensepost.spud.obj.StructuredResultElement the_elm in the_res.ResultItems)
                {
                    lstGoogleHackResults.Items.Add(the_elm.ResultUrl.ToString());
                }
                btn_GHStop.Enabled = false;
                btn_GHStart.Enabled = true;
            }
        }
Beispiel #3
0
        public void LongTaskSpud()
        {
            this.Invoke(this.dlgControlerSetReadonly, new Object[] { this.txtGoogleTarget, true });
            this.Invoke(this.dlgControlerSetReadonly, new Object[] { this.txtWords, true });
            this.Invoke(this.dlgControlerSetReadonly, new Object[] { this.txtGoogleKeyword, true });
            stoppitgoogle = false;


            /*com.google.api.GoogleSearchService myGoogleservice = new com.google.api.GoogleSearchService();
            com.google.api.GoogleSearchResult myGoogleresult = new com.google.api.GoogleSearchResult();
            com.google.api.ResultElement myElement = new com.google.api.ResultElement();
            string googleKey = txtGoogleKey.Text;*/

            int wordcount = 0;
            string[] googleWords = new string[100];
            ArrayList uniqueURLs = new ArrayList();

            this.Invoke(this.dlgControlDisable, new Object[] { this.btnGoogleStart, false });
            this.Invoke(this.dlgControlDisable, new Object[] { this.btnStopGoole, true });

            googleWords = this.Invoke(this.dlgControlTextGet, new Object[] { this.txtWords }).ToString().Split(',');
            wordcount = googleWords.Length;

            int the_depth = System.Convert.ToInt32(this.Invoke(this.dlgControllNupGet, new Object[] { this.updownGoogleDepth }));
            String the_targt = this.Invoke(this.dlgControlTextGet, new Object[] { this.txtGoogleTarget }).ToString();
            String the_keywd = this.Invoke(this.dlgControlTextGet, new Object[] { this.txtGoogleKeyword }).ToString();

            this.Invoke(this.dlgControlProgVal, new Object[] { this.prgGoogle, 0 });
            this.Invoke(this.dlgControlProgMax, new Object[] { this.prgGoogle, wordcount });

            foreach (string googleWord in googleWords)
            {
                string query = the_keywd + " filetype:" + googleWord + " site:" + the_targt;
                this.Invoke(this.dlgControlTextSet, new Object[] { this.txtGoogleQuery, query });
                this.Invoke(this.dlgControlTextSet, new Object[] { this.lblGoogleStatus, query });

                int j;

                for (j = 0; j <= the_depth && (stoppitgoogle == false); j += 10)
                {
                    com.sensepost.spud.obj.Service the_srv = new SensePost.Wikto.com.sensepost.spud.obj.Service();
                    com.sensepost.spud.obj.StructuredResult the_res = new SensePost.Wikto.com.sensepost.spud.obj.StructuredResult();


                    this.Invoke(this.dlgControlTextSet, new Object[] { this.lblPageNumber, j.ToString() });
                    try
                    {
                        the_res = the_srv.GetStructResult(query, j, 10, false);
                        //myGoogleresult = myGoogleservice.doGoogleSearch(googleKey, query, j, 10, false, "", false, "", "latin1", "latin1");
                    }
                    catch (Exception ex)
                    {
                        this.Invoke(this.dlgControlListAdd, new Object[] { this.lstGoogleLink, ex.Message });
                        //if (ex.Message.IndexOf("Invalid authorization key:") > 0)
                        //{
                        //    MessageBox.Show("Your Google API key appear to be invalid.\nPlease enter a valid key in System Config section.");
                        //    stoppitgoogle = true;
                        //}
                    }
                    this.Invoke(this.dlgControlTextSet, new Object[] { this.lblEstimate, the_res.ResultTotal.ToString() });

                    if (the_res.ResultItems != null)
                    {
                        foreach (com.sensepost.spud.obj.StructuredResultElement the_elm in the_res.ResultItems)
                        {
                            this.Invoke(this.dlgControlListUnq, new Object[] { this.lstGoogleLink, the_elm.ResultUrl.ToString() });
                            parseGoogleCGIs(the_elm.ResultUrl.ToString());
                        }
                    }

                }
                this.Invoke(this.dlgControlProgInc, new Object[] { this.prgGoogle, 1 });
            }
            this.Invoke(this.dlgControlProgVal, new Object[] { this.prgGoogle, 0 });
        }