예제 #1
0
        public async Task DeleteScanTest()
        {
            ArachniApi api    = new ArachniApi(Address);
            bool       result = await api.DeleteScan(id);

            Assert.IsNotNull(result);
        }
예제 #2
0
        public async Task NewScanTest()
        {
            ArachniApi api    = new ArachniApi(Address);
            string     result = await api.NewScan(PostRequest.Create("http://testhtml5.vulnweb.com"));

            Assert.IsNotNull(result);
        }
예제 #3
0
        public async Task GetScanListTest()
        {
            ArachniApi api = new ArachniApi(Address);
            IEnumerable <ScansResponse> result = await api.GetScanList();

            Assert.IsNotNull(result);
        }
예제 #4
0
        public async Task GetReportTest()
        {
            ArachniApi     api    = new ArachniApi(Address);
            ReportResponse result = await api.GetReport(id);

            Assert.IsNotNull(result);
            string j = JsonConvert.SerializeObject(result);
            await File.WriteAllTextAsync("d:\\result_report.json", j);
        }
예제 #5
0
        protected override async Task <object> Run_Internal(IObserver observer, string asset, IScanRepository repository, object args)
        {
            ReportResponse ret = null;

            if (!String.IsNullOrEmpty(asset) && args is IDictionary <string, object> dic)
            {
                string arachniRestApiAddress = dic[nameof(arachniRestApiAddress)]?.ToString();
                if (!String.IsNullOrEmpty(arachniRestApiAddress))
                {
                    ArachniApi api = new ArachniApi(arachniRestApiAddress);
                    string     id  = await api.NewScan(PostRequest.Create(asset));

                    if (!String.IsNullOrEmpty(id))
                    {
                        while (true)
                        {
                            await Task.Delay(1000);

                            SummaryResponse summary = await api.GetSummary(id);

                            if (null != summary && null != summary.Status)
                            {
                                observer?.Notify("Arachni_" + asset, $"Status: {summary.Status}, request: {summary.Statistics?.Http?["request_count"]}, runtime: {summary.Statistics?.Runtime}", null);

                                if (summary.Status == "done")
                                {
                                    ret = await api.GetReport(id);

                                    observer?.Notify("Arachni_" + asset, $"{asset} scan has been completed", null);
                                    break;
                                }
                            }
                            else
                            {
                                break;
                            }
                        }
                    }
                }
            }

            return(ret);
        }