private TargetResult Connect(HttpProtocol Protocol, string IPAddress, int Port) { TargetResult Result = new TargetResult(); //FingerPrinter fingerprinter = new FingerPrinter(); //fingerprinter.ReadText(); string Address = string.Empty; if (Protocol == HttpProtocol.HTTP) { Address = "http://" + IPAddress + ":" + Port.ToString(); } else if (Protocol == HttpProtocol.HTTPs) { Address = "https://" + IPAddress + ":" + Port.ToString(); } CreateWebrequest webRequest = new CreateWebrequest(); Result.Html = webRequest.StringGetWebPage(Address, string.Empty); Result.Url = Address; Result.Protocol = Protocol; if (webRequest.Response != null) { Result.ResponseHeaders = webRequest.Response.Headers; Result.Banner = webRequest.Response.Server; Result.WebServer = fingerprinter.GetWebServer(webRequest.Response.Server); IPHostEntry Hostname = Dns.GetHostEntry(IPAddress); Result.Hostname = Hostname.HostName; Result.Success = true; } else { Result.Success = false; } return(Result); }
private TargetResult Connect(HttpProtocol Protocol, string IPAddress, int Port) { TargetResult Result = new TargetResult(); //FingerPrinter fingerprinter = new FingerPrinter(); //fingerprinter.ReadText(); string Address = string.Empty; if (Protocol == HttpProtocol.HTTP) Address = "http://" + IPAddress + ":" + Port.ToString(); else if (Protocol == HttpProtocol.HTTPs) Address = "https://" + IPAddress + ":" + Port.ToString(); CreateWebrequest webRequest = new CreateWebrequest(); Result.Html = webRequest.StringGetWebPage(Address, string.Empty); Result.Url = Address; Result.Protocol = Protocol; if (webRequest.Response != null) { Result.ResponseHeaders = webRequest.Response.Headers; Result.Banner = webRequest.Response.Server; Result.WebServer = fingerprinter.GetWebServer(webRequest.Response.Server); IPHostEntry Hostname = Dns.GetHostEntry(IPAddress); Result.Hostname = Hostname.HostName; Result.Success = true; } else { Result.Success = false; } return Result; }