Beispiel #1
0
        static async Task AutoHostDiscoveryTest()
        {
            FakeScanRepository rep  = new FakeScanRepository();
            string             json = "";

            using (Kamaji.Worker.IWorker worker = new AutoHostDiscoveryWorker.Worker())
            {
                var result = await worker.Run(ConsoleObserver.Instance, null, rep, null);

                json = result.Result?.ToString();
            }

            Console.WriteLine();
            Console.WriteLine("Done.");
        }
Beispiel #2
0
        static async Task SpiderTest()
        {
            FakeScanRepository rep = new FakeScanRepository();


            using (Kamaji.Worker.IWorker worker = new WebPageSpider.Worker())
            {
                await worker.SetupEnvironment();

                async Task <Kamaji.Worker.WorkerResult> Result(string asset)
                {
                    var results = await worker.Run(ConsoleObserver.Instance, asset, rep, null);

                    await rep.AddChildScan(asset, results.Result as IEnumerable <string>);

                    return(results);
                }

                await Result("http://toastytech.com/evil/");//"https://demos.telerik.com/aspnet-mvc/tripxpert/

                var links = await rep.GetResults(true, true);

                do
                {
                    foreach (var link in links)
                    {
                        await Result(link);

                        Console.WriteLine(rep.Dic.Count + " " + link);
                        await Task.Delay(150);
                    }
                    links = await rep.GetResults(true, true);

                    await Task.Delay(250);
                } while (links.Any());
            }
            Console.WriteLine();
            Console.WriteLine("its done");
            Console.WriteLine();
            foreach (var kvp in rep.Dic)
            {
                Console.WriteLine(kvp.Key);
            }
            Console.WriteLine();
            Console.ReadKey();
        }