如果存在一些领域——如果它们有一只nt子,就会有 p子,则试图绘制一份域清单,以获得初步的标识。 不是问题,但出于某种原因,转头也指背。
因此,试图获得http://unter responce of the special url.,但不管怎样,我得到403份答复。 是否有任何想法?
private void hunt_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
string hostAddress = txtKeyword.Text;
string combined;
string[] strArray = new string[] { ".com", ".net", ".org", ".ca", ".gov" };
foreach (string str in strArray)
{
combined = hostAddress + str;
string result = string.Empty;
try
{
Ping ping = new Ping();
int timeout = 1500;
PingReply pingreply = ping.Send(combined, timeout);
if (pingreply != null && pingreply.Status.ToString() != "TimedOut")
{
result = "Address: " + pingreply.Address + "
"
+ "Roundtrip Time: " + pingreply.RoundtripTime + "
"
+ "TTL (Time To Live): " + pingreply.Options.Ttl + "
"
+ "Buffer Size: " + pingreply.Buffer.Length + "
";
listBox1.Items.Add(combined + " " + result);
}
else
{
listBox1.Items.Add(combined + " not found");
}
}
catch (Exception pingError)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www."+combined);
request.Method = "HEAD";
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
HttpStatusCode status = response.StatusCode;
listBox1.Items.Add(status);
}
}
}
thanks in advance
EDIT Ping error as follows:
System.Net.NetworkInformation.PingException: An exception occurred during a Ping request. ---> System.Net.Sockets.SocketException: No such host is known
at System.Net.Dns.GetAddrInfo(String name)
at System.Net.Dns.InternalGetHostByName(String hostName, Boolean includeIPv6)
at System.Net.Dns.GetHostAddresses(String hostNameOrAddress)
at System.Net.NetworkInformation.Ping.Send(String hostNameOrAddress, Int32 timeout, Byte[] buffer, PingOptions options)
--- End of inner exception stack trace ---
at System.Net.NetworkInformation.Ping.Send(String hostNameOrAddress, Int32 timeout, Byte[] buffer, PingOptions options)
at System.Net.NetworkInformation.Ping.Send(String hostNameOrAddress, Int32 timeout)
at DomainHunter.Form1.hunt_Click(Object sender, EventArgs e) in