Using System;
Using System.Drawing;
Using System.Collections;
Using System.ComponentModel;
Using System.Windows.Forms;
Using System.Net;
Using System.Threading;
Public Form1 ()
{
//
Required for Windows Forms Designer support
//
InitializeComponent ();
//
TODO: Add any constructor code after the InitializeComponent call
//
}
<summary>
Clean up all resources that are in use.
</summary>
protected override void Dispose (bool disposing)
{
if (disposing)
{
if (Components!= null)
{
Components. Dispose ();
}
}
Base. Dispose (disposing);
}
public static void Main ()
{
Application.Run (New Form1 ());
}
Code generated #region the Windows forms Designer
<summary>
Designer supports required methods-do not use the Code editor to modify
The contents of this method.
</summary>
private void InitializeComponent ()
{
This.button1 = new System.Windows.Forms.Button ();
This.button2 = new System.Windows.Forms.Button ();
This.button3 = new System.Windows.Forms.Button ();
This.textbox1 = new System.Windows.Forms.TextBox ();
This.textbox2 = new System.Windows.Forms.TextBox ();
This.label1 = new System.Windows.Forms.Label ();
This.textbox3 = new System.Windows.Forms.TextBox ();
This.textbox4 = new System.Windows.Forms.TextBox ();
THIS.TEXTBOX5 = new System.Windows.Forms.TextBox ();
This. SuspendLayout ();
//
Button1
//
This.button1.Location = new System.Drawing.Point (40, 272);
This.button1.Name = "Button1";
This.button1.Size = new System.Drawing.Size (104, 32);
This.button1.TabIndex = 0;
This.button1.Text = "Button1";
This.button1.Click + = new System.EventHandler (This.button1_click);
//
Button2
//
This.button2.Location = new System.Drawing.Point (264, 272);
This.button2.Name = "Button2";
This.button2.Size = new System.Drawing.Size (104, 32);
This.button2.TabIndex = 1;
This.button2.Text = "Button2";
This.button2.Click + = new System.EventHandler (This.button2_click);
//
Button3
//
This.button3.Location = new System.Drawing.Point (480, 272);
This.button3.Name = "Button3";
This.button3.Size = new System.Drawing.Size (104, 32);
This.button3.TabIndex = 2;
This.button3.Text = "Button3";
This.button3.Click + = new System.EventHandler (This.button3_click);
//
TextBox1
//
This.textBox1.Location = new System.Drawing.Point (40, 88);
This.textBox1.Multiline = true;
This.textBox1.Name = "TextBox1";
This.textBox1.Size = new System.Drawing.Size (544, 64);
This.textBox1.TabIndex = 3;
This.textBox1.Text = "";
//
TextBox2
//
This.textBox2.Location = new System.Drawing.Point (40, 184);
This.textBox2.Multiline = true;
This.textBox2.Name = "TextBox2";
This.textBox2.Size = new System.Drawing.Size (544, 56);
This.textBox2.TabIndex = 4;
This.textBox2.Text = "";
//
Label1
//
This.label1.Location = new System.Drawing.Point (40, 24);
This.label1.Name = "Label1";
This.label1.Size = new System.Drawing.Size (120, 24);
This.label1.TabIndex = 5;
This.label1.Text = "Label1";
//
TextBox3
//
This.textBox3.Location = new System.Drawing.Point (256, 16);
This.textBox3.Name = "TextBox3";
This.textBox3.Size = new System.Drawing.Size (176, 21);
This.textBox3.TabIndex = 6;
This.textBox3.Text = "TextBox3";
//
TextBox4
//
This.textBox4.Location = new System.Drawing.Point (256, 56);
This.textBox4.Name = "TextBox4";
This.textBox4.Size = new System.Drawing.Size (176, 21);
This.textBox4.TabIndex = 7;
This.textBox4.Text = "TextBox4";
//
TextBox5
//
This.textBox5.Location = new System.Drawing.Point (464, 56);
This.textBox5.Name = "TEXTBOX5";
This.textBox5.Size = new System.Drawing.Size (152, 21);
This.textBox5.TabIndex = 8;
This.textBox5.Text = "TEXTBOX5";
//
Form1
//
This. AutoScaleBaseSize = new System.Drawing.Size (6, 14);
This. ClientSize = new System.Drawing.Size (648, 350);
This. Controls.Add (THIS.TEXTBOX5);
This. Controls.Add (THIS.TEXTBOX4);
This. Controls.Add (THIS.TEXTBOX3);
This. Controls.Add (THIS.LABEL1);
This. Controls.Add (THIS.TEXTBOX2);
This. Controls.Add (This.textbox1);
This. Controls.Add (This.button3);
This. Controls.Add (This.button2);
This. Controls.Add (This.button1);
This. Name = "Form1";
This. Text = "Form1";
This. Load + = new System.EventHandler (this. Form1_Load);
This. ResumeLayout (FALSE);
}
private void Button1_Click (object sender, System.EventArgs e)
{
Iphostentry myHost = new Iphostentry ();
Try
{
MyHost = Dns.gethostbyname (Dns.gethostname ());
Show Local Host name
This.textBox2.AppendText (MyHost.HostName.ToString ());
Displays the IP Address table for the local host
for (int i=0 i < myHost.AddressList.Length; i++)
{
This.textBox2.AppendText ("Local Host IP address->" + myhost.addresslist[i]. ToString () + "\ r \ n");
Textbox2.refresh ();
}
}
catch (Exception error)
{
MessageBox.Show (Error. message);
}
}
private void Button2_Click (object sender, System.EventArgs e)
{
Iphostentry Mydnstoip = new Iphostentry ();
Mydnstoip = Dns.resolve (This.textBox1.Text);
Displays a list of IP addresses for this domain name
for (int i = 0; i < myDnsToIP.AddressList.Length; i++)
{
This.textBox2.AppendText (this.textBox1.Text + "IP address is" + mydnstoip.addresslist[i]. ToString () + "\ r \ n");
}
}
String stripaddress = TextBox3.Text.ToString ();
Start scanning addresses
int nstrat = Int32.Parse (Textbox4.text);
Terminate scan Address
int nend = Int32.Parse (Textbox5.text);
Scan actions
for (int i = Nstrat i <= nend; i++)
{
String strscanipadd = strIPAddress + "." +i.tostring ();
This.label1.Text = i.ToString ();
Convert to IP address
IPAddress Myscanip = Ipaddress.parse (Strscanipadd);
Try
{
You can add your own, enhanced features
Dns.gethostbyaddress method: According to IP land
Address to obtain DNS host information.
Iphostentry myscanhost = dns.gethostbyaddress (Myscanip);
Get the name of the host
String strhostname = MyScanHost.HostName.ToString ();
This.textBox2.AppendText (Strscanipadd + "->" + strhostname + "\ r \ n");
}
catch (Exception error)
{
MessageBox.Show (Error. message);
}
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service