ln.skyscanner/crawl/tests/Crawling.cs

65 lines
1.5 KiB
C#

// /**
// * File: CrawlTest.cs
// * Author: haraldwolff
// *
// * This file and it's content is copyrighted by the Author and / or copyright holder.
// * Any use wihtout proper permission is illegal and may lead to legal actions.
// *
// *
// **/
using System;
using System.Collections.Generic;
using System.Reflection;
using ln.types;
namespace ln.skyscanner.crawl.tests
{
public static class Crawling
{
public static bool Crawl(HostCrawl hostCrawl)
{
hostCrawl.setState("ICMP");
if (!ICMP.IsReachable(hostCrawl.CrawledHost))
{
return false;
}
if (hostCrawl.AbortRequested)
return false;
hostCrawl.setState("SSH");
if (SSH.CanConnect(hostCrawl.CrawledHost))
{
// ToDo: Extract more details...
}
if (hostCrawl.AbortRequested)
return false;
hostCrawl.setState("SNMP");
if (SNMP.HasSNMP(hostCrawl.CrawledHost))
{
if (hostCrawl.AbortRequested)
return false;
hostCrawl.setState("RFC1213");
RFC1213.Check(hostCrawl.CrawledHost);
}
foreach (CIDR ip in hostCrawl.CrawledHost.IPAddresses)
{
if (ip.MaskWidth != 32)
hostCrawl.Crawler.CrawlPool.GetSubnet(ip.Network);
}
return true;
}
}
}