Ejemplo n.º 1
0
        public void RunFootprint()
        {
            // ThreadStart starter = new ThreadStart(this.SpiderThread);
            // Thread spider = new Thread(starter);
            // spider.Start();

            _spider = new Spider.Engine.Spider();
            _spider.ReportTo = new Spider.Engine.ConsoleSpiderStatusListener();
            //  TODO - Make this a parameter
            _spider.OutputPath = "C:\\Sprajax\\";
            //  TODO - Make this ia parameter, and when it can be more than 1 we need to do some serious QA
            //  because certain things (AtlastListener page and tag handling, for example) currently depend on
            //  this being single-threaded.
            int threads = 2;

            _spider.Listeners.Add(new DenimGroup.Sprajax.Engine.Listeners.AtlasListener(this));
            _spider.Listeners.Add(new DenimGroup.Sprajax.Engine.Listeners.GoogleWebToolkitListener(this));

            try
            {
                _sessionId = Guid.NewGuid();
                SqlConnection conn = GetConnection();
                SqlCommand cmd = new SqlCommand();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "up_CreateSession";
                cmd.Connection = conn;
                cmd.Parameters.Add(new SqlParameter("ID", _sessionId));
                cmd.Parameters.Add(new SqlParameter("BaseUri", _baseUrl));
                cmd.ExecuteNonQuery();
                conn.Dispose();

                //  Spider the site and grab all the information we can find.
                //  TODO - There seems to be some sort of threading or timing problem
                //  waiting for the spider to finish.  Might need to debug some
                //  spider code - DPC
                Log("About to start spidering");
                _spider.Start(new Uri(_baseUrl), threads);
                _spider.SpiderDone.WaitDone();
                Log("Finished spidering");

                //  Print out what we found
                Log("JavaScript files found");
                foreach (Uri jsUri in _javaScriptUris.Keys)
                {
                    Log(jsUri.AbsoluteUri);
                }

                Log("Frameworks detected");
                foreach(Framework framework in _frameworks.Keys)
                {
                    Log(framework.ToString());
                }

                Log("WebServices found");
                foreach(Uri wsUri in _webServicesCollections.Keys)
                {
                    Log(wsUri.AbsoluteUri);
                }

                
            }
            catch (UriFormatException ex)
            {
                Log(ex.Message);
                return;
            }
        }
Ejemplo n.º 2
0
        public void RunFootprint()
        {
            // ThreadStart starter = new ThreadStart(this.SpiderThread);
            // Thread spider = new Thread(starter);
            // spider.Start();

            _spider          = new Spider.Engine.Spider();
            _spider.ReportTo = new Spider.Engine.ConsoleSpiderStatusListener();
            //  TODO - Make this a parameter
            _spider.OutputPath = "C:\\Sprajax\\";
            //  TODO - Make this ia parameter, and when it can be more than 1 we need to do some serious QA
            //  because certain things (AtlastListener page and tag handling, for example) currently depend on
            //  this being single-threaded.
            int threads = 2;

            _spider.Listeners.Add(new DenimGroup.Sprajax.Engine.Listeners.AtlasListener(this));
            _spider.Listeners.Add(new DenimGroup.Sprajax.Engine.Listeners.GoogleWebToolkitListener(this));

            try
            {
                _sessionId = Guid.NewGuid();
                SqlConnection conn = GetConnection();
                SqlCommand    cmd  = new SqlCommand();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "up_CreateSession";
                cmd.Connection  = conn;
                cmd.Parameters.Add(new SqlParameter("ID", _sessionId));
                cmd.Parameters.Add(new SqlParameter("BaseUri", _baseUrl));
                cmd.ExecuteNonQuery();
                conn.Dispose();

                //  Spider the site and grab all the information we can find.
                //  TODO - There seems to be some sort of threading or timing problem
                //  waiting for the spider to finish.  Might need to debug some
                //  spider code - DPC
                Log("About to start spidering");
                _spider.Start(new Uri(_baseUrl), threads);
                _spider.SpiderDone.WaitDone();
                Log("Finished spidering");

                //  Print out what we found
                Log("JavaScript files found");
                foreach (Uri jsUri in _javaScriptUris.Keys)
                {
                    Log(jsUri.AbsoluteUri);
                }

                Log("Frameworks detected");
                foreach (Framework framework in _frameworks.Keys)
                {
                    Log(framework.ToString());
                }

                Log("WebServices found");
                foreach (Uri wsUri in _webServicesCollections.Keys)
                {
                    Log(wsUri.AbsoluteUri);
                }
            }
            catch (UriFormatException ex)
            {
                Log(ex.Message);
                return;
            }
        }