الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

كود باحث عن بوابات مفتوحات

مغلق
بدأه XzaB في 22 مارس 2005 · 0 رد · 487 مشاهدة · في Microsoft Visual C#.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1

لقد كتبت ذلك الكود للتعليم كيفية استخدام الــSocket فى السى شارب و اذن ان ذلك سوف يفيد جميع الاخوة المبتدأين فى برمجة برامج لانترنت ....

/*

* Auther   : Ashraf M Kaabi

* Website : http://ashrafmagdi.info

* E-Mail    : AshrafMagdi@HoTMaiL.CoM

* Created : 21-March-2005

*/

using System;

using System.Drawing;

using System.Windows.Forms;

using System.Net.Sockets;

using System.Net;

using System.IO;

using System.Threading;

namespace IPScanner

{

/// <summary>

/// Description of MainForm.

/// </summary>

public class Form1 : System.Windows.Forms.Form

{

 private System.Windows.Forms.Button button1;

 private System.Windows.Forms.Label label5;

 private System.Windows.Forms.Label label1;

 private System.Windows.Forms.TextBox textBox4;

 private System.Windows.Forms.TextBox textBox1;

 private System.Windows.Forms.TextBox textBox3;

 private System.Windows.Forms.TextBox textBox2;

 public System.Windows.Forms.ListBox listBox1;

 public static int n = 10;

 static string ip;

 static int port;

 private System.Windows.Forms.GroupBox groupBox1;

 private System.Windows.Forms.GroupBox groupBox2;

 private System.Windows.Forms.GroupBox groupBox3;

 private System.Windows.Forms.GroupBox groupBox4;

 private System.Windows.Forms.GroupBox groupBox5;

 private System.Windows.Forms.GroupBox groupBox6;

 private System.Windows.Forms.GroupBox groupBox7;

 static object obmrd;

       

   

 public Form1()

 {

 //

 // The InitializeComponent() call is required for Windows Forms designer support.

 //

 InitializeComponent();          

 //

 // TODO: Add constructor code after the InitializeComponent() call.

 //

 }

       

 [STAThread]

 public static void Main(string[] args)

 {

 Application.Run(new Form1());

 }

       

       #region Windows Forms Designer generated code

 /// <summary>

 /// This method is required for Windows Forms designer support.

 /// do not change the method contents inside the source code editor. The Forms designer might

 /// not be able to load this method if it was changed manually.

 /// </summary>

 private void InitializeComponent()

 {

 System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));

 this.textBox2 = new System.Windows.Forms.TextBox();

 this.textBox3 = new System.Windows.Forms.TextBox();

 this.textBox1 = new System.Windows.Forms.TextBox();

 this.textBox4 = new System.Windows.Forms.TextBox();

 this.label1 = new System.Windows.Forms.Label();

 this.label5 = new System.Windows.Forms.Label();

 this.button1 = new System.Windows.Forms.Button();

 this.listBox1 = new System.Windows.Forms.ListBox();

 this.groupBox1 = new System.Windows.Forms.GroupBox();

 this.groupBox2 = new System.Windows.Forms.GroupBox();

 this.groupBox3 = new System.Windows.Forms.GroupBox();

 this.groupBox5 = new System.Windows.Forms.GroupBox();

 this.groupBox4 = new System.Windows.Forms.GroupBox();

 this.groupBox6 = new System.Windows.Forms.GroupBox();

 this.groupBox7 = new System.Windows.Forms.GroupBox();

 this.groupBox2.SuspendLayout();

 this.groupBox3.SuspendLayout();

 this.groupBox5.SuspendLayout();

 this.groupBox4.SuspendLayout();

 this.groupBox6.SuspendLayout();

 this.groupBox7.SuspendLayout();

 this.SuspendLayout();

 //

 // textBox2

 //

 this.textBox2.AccessibleDescription = ((string)(resources.GetObject("textBox2.AccessibleDescription")));

 this.textBox2.AccessibleName = ((string)(resources.GetObject("textBox2.AccessibleName")));

 this.textBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("textBox2.Anchor")));

 this.textBox2.AutoSize = ((bool)(resources.GetObject("textBox2.AutoSize")));

 this.textBox2.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("textBox2.BackgroundImage")));

 this.textBox2.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("textBox2.Dock")));

 this.textBox2.Enabled = ((bool)(resources.GetObject("textBox2.Enabled")));

 this.textBox2.Font = ((System.Drawing.Font)(resources.GetObject("textBox2.Font")));

 this.textBox2.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("textBox2.ImeMode")));

 this.textBox2.Location = ((System.Drawing.Point)(resources.GetObject("textBox2.Location")));

 this.textBox2.MaxLength = ((int)(resources.GetObject("textBox2.MaxLength")));

 this.textBox2.Multiline = ((bool)(resources.GetObject("textBox2.Multiline")));

 this.textBox2.Name = "textBox2";

 this.textBox2.PasswordChar = ((char)(resources.GetObject("textBox2.PasswordChar")));

 this.textBox2.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("textBox2.RightToLeft")));

 this.textBox2.ScrollBars = ((System.Windows.Forms.ScrollBars)(resources.GetObject("textBox2.ScrollBars")));

 this.textBox2.Size = ((System.Drawing.Size)(resources.GetObject("textBox2.Size")));

 this.textBox2.TabIndex = ((int)(resources.GetObject("textBox2.TabIndex")));

 this.textBox2.Text = resources.GetString("textBox2.Text");

 this.textBox2.TextAlign = ((System.Windows.Forms.HorizontalAlignment)(resources.GetObject("textBox2.TextAlign")));

 this.textBox2.Visible = ((bool)(resources.GetObject("textBox2.Visible")));

 this.textBox2.WordWrap = ((bool)(resources.GetObject("textBox2.WordWrap")));

 //

 // textBox3

 //

 this.textBox3.AccessibleDescription = ((string)(resources.GetObject("textBox3.AccessibleDescription")));

 this.textBox3.AccessibleName = ((string)(resources.GetObject("textBox3.AccessibleName")));

 this.textBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("textBox3.Anchor")));

 this.textBox3.AutoSize = ((bool)(resources.GetObject("textBox3.AutoSize")));

 this.textBox3.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("textBox3.BackgroundImage")));

 this.textBox3.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("textBox3.Dock")));

 this.textBox3.Enabled = ((bool)(resources.GetObject("textBox3.Enabled")));

 this.textBox3.Font = ((System.Drawing.Font)(resources.GetObject("textBox3.Font")));

 this.textBox3.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("textBox3.ImeMode")));

 this.textBox3.Location = ((System.Drawing.Point)(resources.GetObject("textBox3.Location")));

 this.textBox3.MaxLength = ((int)(resources.GetObject("textBox3.MaxLength")));

 this.textBox3.Multiline = ((bool)(resources.GetObject("textBox3.Multiline")));

 this.textBox3.Name = "textBox3";

 this.textBox3.PasswordChar = ((char)(resources.GetObject("textBox3.PasswordChar")));

 this.textBox3.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("textBox3.RightToLeft")));

 this.textBox3.ScrollBars = ((System.Windows.Forms.ScrollBars)(resources.GetObject("textBox3.ScrollBars")));

 this.textBox3.Size = ((System.Drawing.Size)(resources.GetObject("textBox3.Size")));

 this.textBox3.TabIndex = ((int)(resources.GetObject("textBox3.TabIndex")));

 this.textBox3.Text = resources.GetString("textBox3.Text");

 this.textBox3.TextAlign = ((System.Windows.Forms.HorizontalAlignment)(resources.GetObject("textBox3.TextAlign")));

 this.textBox3.Visible = ((bool)(resources.GetObject("textBox3.Visible")));

 this.textBox3.WordWrap = ((bool)(resources.GetObject("textBox3.WordWrap")));

 //

 // textBox1

 //

 this.textBox1.AccessibleDescription = ((string)(resources.GetObject("textBox1.AccessibleDescription")));

 this.textBox1.AccessibleName = ((string)(resources.GetObject("textBox1.AccessibleName")));

 this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("textBox1.Anchor")));

 this.textBox1.AutoSize = ((bool)(resources.GetObject("textBox1.AutoSize")));

 this.textBox1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("textBox1.BackgroundImage")));

 this.textBox1.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("textBox1.Dock")));

 this.textBox1.Enabled = ((bool)(resources.GetObject("textBox1.Enabled")));

 this.textBox1.Font = ((System.Drawing.Font)(resources.GetObject("textBox1.Font")));

 this.textBox1.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("textBox1.ImeMode")));

 this.textBox1.Location = ((System.Drawing.Point)(resources.GetObject("textBox1.Location")));

 this.textBox1.MaxLength = ((int)(resources.GetObject("textBox1.MaxLength")));

 this.textBox1.Multiline = ((bool)(resources.GetObject("textBox1.Multiline")));

 this.textBox1.Name = "textBox1";

 this.textBox1.PasswordChar = ((char)(resources.GetObject("textBox1.PasswordChar")));

 this.textBox1.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("textBox1.RightToLeft")));

 this.textBox1.ScrollBars = ((System.Windows.Forms.ScrollBars)(resources.GetObject("textBox1.ScrollBars")));

 this.textBox1.Size = ((System.Drawing.Size)(resources.GetObject("textBox1.Size")));

 this.textBox1.TabIndex = ((int)(resources.GetObject("textBox1.TabIndex")));

 this.textBox1.Text = resources.GetString("textBox1.Text");

 this.textBox1.TextAlign = ((System.Windows.Forms.HorizontalAlignment)(resources.GetObject("textBox1.TextAlign")));

 this.textBox1.Visible = ((bool)(resources.GetObject("textBox1.Visible")));

 this.textBox1.WordWrap = ((bool)(resources.GetObject("textBox1.WordWrap")));

 //

 // textBox4

 //

 this.textBox4.AccessibleDescription = ((string)(resources.GetObject("textBox4.AccessibleDescription")));

 this.textBox4.AccessibleName = ((string)(resources.GetObject("textBox4.AccessibleName")));

 this.textBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("textBox4.Anchor")));

 this.textBox4.AutoSize = ((bool)(resources.GetObject("textBox4.AutoSize")));

 this.textBox4.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("textBox4.BackgroundImage")));

 this.textBox4.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("textBox4.Dock")));

 this.textBox4.Enabled = ((bool)(resources.GetObject("textBox4.Enabled")));

 this.textBox4.Font = ((System.Drawing.Font)(resources.GetObject("textBox4.Font")));

 this.textBox4.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("textBox4.ImeMode")));

 this.textBox4.Location = ((System.Drawing.Point)(resources.GetObject("textBox4.Location")));

 this.textBox4.MaxLength = ((int)(resources.GetObject("textBox4.MaxLength")));

 this.textBox4.Multiline = ((bool)(resources.GetObject("textBox4.Multiline")));

 this.textBox4.Name = "textBox4";

 this.textBox4.PasswordChar = ((char)(resources.GetObject("textBox4.PasswordChar")));

 this.textBox4.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("textBox4.RightToLeft")));

 this.textBox4.ScrollBars = ((System.Windows.Forms.ScrollBars)(resources.GetObject("textBox4.ScrollBars")));

 this.textBox4.Size = ((System.Drawing.Size)(resources.GetObject("textBox4.Size")));

 this.textBox4.TabIndex = ((int)(resources.GetObject("textBox4.TabIndex")));

 this.textBox4.Text = resources.GetString("textBox4.Text");

 this.textBox4.TextAlign = ((System.Windows.Forms.HorizontalAlignment)(resources.GetObject("textBox4.TextAlign")));

 this.textBox4.Visible = ((bool)(resources.GetObject("textBox4.Visible")));

 this.textBox4.WordWrap = ((bool)(resources.GetObject("textBox4.WordWrap")));

 //

 // label1

 //

 this.label1.AccessibleDescription = ((string)(resources.GetObject("label1.AccessibleDescription")));

 this.label1.AccessibleName = ((string)(resources.GetObject("label1.AccessibleName")));

 this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("label1.Anchor")));

 this.label1.AutoSize = ((bool)(resources.GetObject("label1.AutoSize")));

 this.label1.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("label1.Dock")));

 this.label1.Enabled = ((bool)(resources.GetObject("label1.Enabled")));

 this.label1.Font = ((System.Drawing.Font)(resources.GetObject("label1.Font")));

 this.label1.ForeColor = System.Drawing.Color.Black;

 this.label1.Image = ((System.Drawing.Image)(resources.GetObject("label1.Image")));

 this.label1.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("label1.ImageAlign")));

 this.label1.ImageIndex = ((int)(resources.GetObject("label1.ImageIndex")));

 this.label1.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("label1.ImeMode")));

 this.label1.Location = ((System.Drawing.Point)(resources.GetObject("label1.Location")));

 this.label1.Name = "label1";

 this.label1.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("label1.RightToLeft")));

 this.label1.Size = ((System.Drawing.Size)(resources.GetObject("label1.Size")));

 this.label1.TabIndex = ((int)(resources.GetObject("label1.TabIndex")));

 this.label1.Text = resources.GetString("label1.Text");

 this.label1.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("label1.TextAlign")));

 this.label1.Visible = ((bool)(resources.GetObject("label1.Visible")));

 //

 // label5

 //

 this.label5.AccessibleDescription = ((string)(resources.GetObject("label5.AccessibleDescription")));

 this.label5.AccessibleName = ((string)(resources.GetObject("label5.AccessibleName")));

 this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("label5.Anchor")));

 this.label5.AutoSize = ((bool)(resources.GetObject("label5.AutoSize")));

 this.label5.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("label5.Dock")));

 this.label5.Enabled = ((bool)(resources.GetObject("label5.Enabled")));

 this.label5.Font = ((System.Drawing.Font)(resources.GetObject("label5.Font")));

 this.label5.Image = ((System.Drawing.Image)(resources.GetObject("label5.Image")));

 this.label5.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("label5.ImageAlign")));

 this.label5.ImageIndex = ((int)(resources.GetObject("label5.ImageIndex")));

 this.label5.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("label5.ImeMode")));

 this.label5.Location = ((System.Drawing.Point)(resources.GetObject("label5.Location")));

 this.label5.Name = "label5";

 this.label5.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("label5.RightToLeft")));

 this.label5.Size = ((System.Drawing.Size)(resources.GetObject("label5.Size")));

 this.label5.TabIndex = ((int)(resources.GetObject("label5.TabIndex")));

 this.label5.Text = resources.GetString("label5.Text");

 this.label5.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("label5.TextAlign")));

 this.label5.Visible = ((bool)(resources.GetObject("label5.Visible")));

 //

 // button1

 //

 this.button1.AccessibleDescription = ((string)(resources.GetObject("button1.AccessibleDescription")));

 this.button1.AccessibleName = ((string)(resources.GetObject("button1.AccessibleName")));

 this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("button1.Anchor")));

 this.button1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("button1.BackgroundImage")));

 this.button1.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("button1.Dock")));

 this.button1.Enabled = ((bool)(resources.GetObject("button1.Enabled")));

 this.button1.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("button1.FlatStyle")));

 this.button1.Font = ((System.Drawing.Font)(resources.GetObject("button1.Font")));

 this.button1.ForeColor = System.Drawing.Color.Black;

 this.button1.Image = ((System.Drawing.Image)(resources.GetObject("button1.Image")));

 this.button1.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("button1.ImageAlign")));

 this.button1.ImageIndex = ((int)(resources.GetObject("button1.ImageIndex")));

 this.button1.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("button1.ImeMode")));

 this.button1.Location = ((System.Drawing.Point)(resources.GetObject("button1.Location")));

 this.button1.Name = "button1";

 this.button1.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("button1.RightToLeft")));

 this.button1.Size = ((System.Drawing.Size)(resources.GetObject("button1.Size")));

 this.button1.TabIndex = ((int)(resources.GetObject("button1.TabIndex")));

 this.button1.Text = resources.GetString("button1.Text");

 this.button1.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("button1.TextAlign")));

 this.button1.Visible = ((bool)(resources.GetObject("button1.Visible")));

 this.button1.Click += new System.EventHandler(this.ButtonClick);

 //

 // listBox1

 //

 this.listBox1.AccessibleDescription = ((string)(resources.GetObject("listBox1.AccessibleDescription")));

 this.listBox1.AccessibleName = ((string)(resources.GetObject("listBox1.AccessibleName")));

 this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("listBox1.Anchor")));

 this.listBox1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("listBox1.BackgroundImage")));

 this.listBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;

 this.listBox1.ColumnWidth = ((int)(resources.GetObject("listBox1.ColumnWidth")));

 this.listBox1.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("listBox1.Dock")));

 this.listBox1.Enabled = ((bool)(resources.GetObject("listBox1.Enabled")));

 this.listBox1.Font = ((System.Drawing.Font)(resources.GetObject("listBox1.Font")));

 this.listBox1.HorizontalExtent = ((int)(resources.GetObject("listBox1.HorizontalExtent")));

 this.listBox1.HorizontalScrollbar = ((bool)(resources.GetObject("listBox1.HorizontalScrollbar")));

 this.listBox1.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("listBox1.ImeMode")));

 this.listBox1.IntegralHeight = ((bool)(resources.GetObject("listBox1.IntegralHeight")));

 this.listBox1.ItemHeight = ((int)(resources.GetObject("listBox1.ItemHeight")));

 this.listBox1.Location = ((System.Drawing.Point)(resources.GetObject("listBox1.Location")));

 this.listBox1.Name = "listBox1";

 this.listBox1.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("listBox1.RightToLeft")));

 this.listBox1.ScrollAlwaysVisible = ((bool)(resources.GetObject("listBox1.ScrollAlwaysVisible")));

 this.listBox1.Size = ((System.Drawing.Size)(resources.GetObject("listBox1.Size")));

 this.listBox1.TabIndex = ((int)(resources.GetObject("listBox1.TabIndex")));

 this.listBox1.Tag = "";

 this.listBox1.Visible = ((bool)(resources.GetObject("listBox1.Visible")));

 this.listBox1.SelectedIndexChanged += new System.EventHandler(this.listBox1_SelectedIndexChanged);

 //

 // groupBox1

 //

 this.groupBox1.AccessibleDescription = ((string)(resources.GetObject("groupBox1.AccessibleDescription")));

 this.groupBox1.AccessibleName = ((string)(resources.GetObject("groupBox1.AccessibleName")));

 this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("groupBox1.Anchor")));

 this.groupBox1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("groupBox1.BackgroundImage")));

 this.groupBox1.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("groupBox1.Dock")));

 this.groupBox1.Enabled = ((bool)(resources.GetObject("groupBox1.Enabled")));

 this.groupBox1.Font = ((System.Drawing.Font)(resources.GetObject("groupBox1.Font")));

 this.groupBox1.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("groupBox1.ImeMode")));

 this.groupBox1.Location = ((System.Drawing.Point)(resources.GetObject("groupBox1.Location")));

 this.groupBox1.Name = "groupBox1";

 this.groupBox1.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("groupBox1.RightToLeft")));

 this.groupBox1.Size = ((System.Drawing.Size)(resources.GetObject("groupBox1.Size")));

 this.groupBox1.TabIndex = ((int)(resources.GetObject("groupBox1.TabIndex")));

 this.groupBox1.TabStop = false;

 this.groupBox1.Text = resources.GetString("groupBox1.Text");

 this.groupBox1.Visible = ((bool)(resources.GetObject("groupBox1.Visible")));

 //

 // groupBox2

 //

 this.groupBox2.AccessibleDescription = ((string)(resources.GetObject("groupBox2.AccessibleDescription")));

 this.groupBox2.AccessibleName = ((string)(resources.GetObject("groupBox2.AccessibleName")));

 this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("groupBox2.Anchor")));

 this.groupBox2.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("groupBox2.BackgroundImage")));

 this.groupBox2.Controls.AddRange(new System.Windows.Forms.Control[] {

                   this.textBox2});

 this.groupBox2.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("groupBox2.Dock")));

 this.groupBox2.Enabled = ((bool)(resources.GetObject("groupBox2.Enabled")));

 this.groupBox2.Font = ((System.Drawing.Font)(resources.GetObject("groupBox2.Font")));

 this.groupBox2.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("groupBox2.ImeMode")));

 this.groupBox2.Location = ((System.Drawing.Point)(resources.GetObject("groupBox2.Location")));

 this.groupBox2.Name = "groupBox2";

 this.groupBox2.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("groupBox2.RightToLeft")));

 this.groupBox2.Size = ((System.Drawing.Size)(resources.GetObject("groupBox2.Size")));

 this.groupBox2.TabIndex = ((int)(resources.GetObject("groupBox2.TabIndex")));

 this.groupBox2.TabStop = false;

 this.groupBox2.Text = resources.GetString("groupBox2.Text");

 this.groupBox2.Visible = ((bool)(resources.GetObject("groupBox2.Visible")));

 //

 // groupBox3

 //

 this.groupBox3.AccessibleDescription = ((string)(resources.GetObject("groupBox3.AccessibleDescription")));

 this.groupBox3.AccessibleName = ((string)(resources.GetObject("groupBox3.AccessibleName")));

 this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("groupBox3.Anchor")));

 this.groupBox3.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("groupBox3.BackgroundImage")));

 this.groupBox3.Controls.AddRange(new System.Windows.Forms.Control[] {

                   this.groupBox5,

                   this.groupBox4});

 this.groupBox3.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("groupBox3.Dock")));

 this.groupBox3.Enabled = ((bool)(resources.GetObject("groupBox3.Enabled")));

 this.groupBox3.Font = ((System.Drawing.Font)(resources.GetObject("groupBox3.Font")));

 this.groupBox3.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("groupBox3.ImeMode")));

 this.groupBox3.Location = ((System.Drawing.Point)(resources.GetObject("groupBox3.Location")));

 this.groupBox3.Name = "groupBox3";

 this.groupBox3.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("groupBox3.RightToLeft")));

 this.groupBox3.Size = ((System.Drawing.Size)(resources.GetObject("groupBox3.Size")));

 this.groupBox3.TabIndex = ((int)(resources.GetObject("groupBox3.TabIndex")));

 this.groupBox3.TabStop = false;

 this.groupBox3.Text = resources.GetString("groupBox3.Text");

 this.groupBox3.Visible = ((bool)(resources.GetObject("groupBox3.Visible")));

 //

 // groupBox5

 //

 this.groupBox5.AccessibleDescription = ((string)(resources.GetObject("groupBox5.AccessibleDescription")));

 this.groupBox5.AccessibleName = ((string)(resources.GetObject("groupBox5.AccessibleName")));

 this.groupBox5.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("groupBox5.Anchor")));

 this.groupBox5.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("groupBox5.BackgroundImage")));

 this.groupBox5.Controls.AddRange(new System.Windows.Forms.Control[] {

                   this.textBox4});

 this.groupBox5.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("groupBox5.Dock")));

 this.groupBox5.Enabled = ((bool)(resources.GetObject("groupBox5.Enabled")));

 this.groupBox5.Font = ((System.Drawing.Font)(resources.GetObject("groupBox5.Font")));

 this.groupBox5.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("groupBox5.ImeMode")));

 this.groupBox5.Location = ((System.Drawing.Point)(resources.GetObject("groupBox5.Location")));

 this.groupBox5.Name = "groupBox5";

 this.groupBox5.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("groupBox5.RightToLeft")));

 this.groupBox5.Size = ((System.Drawing.Size)(resources.GetObject("groupBox5.Size")));

 this.groupBox5.TabIndex = ((int)(resources.GetObject("groupBox5.TabIndex")));

 this.groupBox5.TabStop = false;

 this.groupBox5.Text = resources.GetString("groupBox5.Text");

 this.groupBox5.Visible = ((bool)(resources.GetObject("groupBox5.Visible")));

 //

 // groupBox4

 //

 this.groupBox4.AccessibleDescription = ((string)(resources.GetObject("groupBox4.AccessibleDescription")));

 this.groupBox4.AccessibleName = ((string)(resources.GetObject("groupBox4.AccessibleName")));

 this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("groupBox4.Anchor")));

 this.groupBox4.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("groupBox4.BackgroundImage")));

 this.groupBox4.Controls.AddRange(new System.Windows.Forms.Control[] {

                   this.textBox3});

 this.groupBox4.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("groupBox4.Dock")));

 this.groupBox4.Enabled = ((bool)(resources.GetObject("groupBox4.Enabled")));

 this.groupBox4.Font = ((System.Drawing.Font)(resources.GetObject("groupBox4.Font")));

 this.groupBox4.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("groupBox4.ImeMode")));

 this.groupBox4.Location = ((System.Drawing.Point)(resources.GetObject("groupBox4.Location")));

 this.groupBox4.Name = "groupBox4";

 this.groupBox4.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("groupBox4.RightToLeft")));

 this.groupBox4.Size = ((System.Drawing.Size)(resources.GetObject("groupBox4.Size")));

 this.groupBox4.TabIndex = ((int)(resources.GetObject("groupBox4.TabIndex")));

 this.groupBox4.TabStop = false;

 this.groupBox4.Text = resources.GetString("groupBox4.Text");

 this.groupBox4.Visible = ((bool)(resources.GetObject("groupBox4.Visible")));

 //

 // groupBox6

 //

 this.groupBox6.AccessibleDescription = ((string)(resources.GetObject("groupBox6.AccessibleDescription")));

 this.groupBox6.AccessibleName = ((string)(resources.GetObject("groupBox6.AccessibleName")));

 this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("groupBox6.Anchor")));

 this.groupBox6.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("groupBox6.BackgroundImage")));

 this.groupBox6.Controls.AddRange(new System.Windows.Forms.Control[] {

                   this.button1});

 this.groupBox6.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("groupBox6.Dock")));

 this.groupBox6.Enabled = ((bool)(resources.GetObject("groupBox6.Enabled")));

 this.groupBox6.Font = ((System.Drawing.Font)(resources.GetObject("groupBox6.Font")));

 this.groupBox6.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("groupBox6.ImeMode")));

 this.groupBox6.Location = ((System.Drawing.Point)(resources.GetObject("groupBox6.Location")));

 this.groupBox6.Name = "groupBox6";

 this.groupBox6.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("groupBox6.RightToLeft")));

 this.groupBox6.Size = ((System.Drawing.Size)(resources.GetObject("groupBox6.Size")));

 this.groupBox6.TabIndex = ((int)(resources.GetObject("groupBox6.TabIndex")));

 this.groupBox6.TabStop = false;

 this.groupBox6.Text = resources.GetString("groupBox6.Text");

 this.groupBox6.Visible = ((bool)(resources.GetObject("groupBox6.Visible")));

 //

 // groupBox7

 //

 this.groupBox7.AccessibleDescription = ((string)(resources.GetObject("groupBox7.AccessibleDescription")));

 this.groupBox7.AccessibleName = ((string)(resources.GetObject("groupBox7.AccessibleName")));

 this.groupBox7.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("groupBox7.Anchor")));

 this.groupBox7.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("groupBox7.BackgroundImage")));

 this.groupBox7.Controls.AddRange(new System.Windows.Forms.Control[] {

                   this.label5});

 this.groupBox7.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("groupBox7.Dock")));

 this.groupBox7.Enabled = ((bool)(resources.GetObject("groupBox7.Enabled")));

 this.groupBox7.Font = ((System.Drawing.Font)(resources.GetObject("groupBox7.Font")));

 this.groupBox7.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("groupBox7.ImeMode")));

 this.groupBox7.Location = ((System.Drawing.Point)(resources.GetObject("groupBox7.Location")));

 this.groupBox7.Name = "groupBox7";

 this.groupBox7.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("groupBox7.RightToLeft")));

 this.groupBox7.Size = ((System.Drawing.Size)(resources.GetObject("groupBox7.Size")));

 this.groupBox7.TabIndex = ((int)(resources.GetObject("groupBox7.TabIndex")));

 this.groupBox7.TabStop = false;

 this.groupBox7.Text = resources.GetString("groupBox7.Text");

 this.groupBox7.Visible = ((bool)(resources.GetObject("groupBox7.Visible")));

 this.groupBox7.Enter += new System.EventHandler(this.groupBox7_Enter);

 //

 // Form1

 //

 this.AccessibleDescription = ((string)(resources.GetObject("$this.AccessibleDescription")));

 this.AccessibleName = ((string)(resources.GetObject("$this.AccessibleName")));

 this.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("$this.Anchor")));

 this.AutoScaleBaseSize = ((System.Drawing.Size)(resources.GetObject("$this.AutoScaleBaseSize")));

 this.AutoScroll = ((bool)(resources.GetObject("$this.AutoScroll")));

 this.AutoScrollMargin = ((System.Drawing.Size)(resources.GetObject("$this.AutoScrollMargin")));

 this.AutoScrollMinSize = ((System.Drawing.Size)(resources.GetObject("$this.AutoScrollMinSize")));

 this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));

 this.ClientSize = ((System.Drawing.Size)(resources.GetObject("$this.ClientSize")));

 this.Controls.AddRange(new System.Windows.Forms.Control[] {

                   this.groupBox6,

                   this.groupBox3,

                   this.groupBox2,

                   this.textBox1,

                   this.label1,

                   this.groupBox1,

                   this.listBox1,

                   this.groupBox7});

 this.Cursor = System.Windows.Forms.Cursors.Cross;

 this.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("$this.Dock")));

 this.Enabled = ((bool)(resources.GetObject("$this.Enabled")));

 this.Font = ((System.Drawing.Font)(resources.GetObject("$this.Font")));

 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;

 this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));

 this.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("$this.ImeMode")));

 this.Location = ((System.Drawing.Point)(resources.GetObject("$this.Location")));

 this.MaximumSize = ((System.Drawing.Size)(resources.GetObject("$this.MaximumSize")));

 this.MinimumSize = ((System.Drawing.Size)(resources.GetObject("$this.MinimumSize")));

 this.Name = "Form1";

 this.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("$this.RightToLeft")));

 this.StartPosition = ((System.Windows.Forms.FormStartPosition)(resources.GetObject("$this.StartPosition")));

 this.Text = resources.GetString("$this.Text");

 this.Visible = ((bool)(resources.GetObject("$this.Visible")));

 this.Load += new System.EventHandler(this.MainFormLoad);

 this.groupBox2.ResumeLayout(false);

 this.groupBox3.ResumeLayout(false);

 this.groupBox5.ResumeLayout(false);

 this.groupBox4.ResumeLayout(false);

 this.groupBox6.ResumeLayout(false);

 this.groupBox7.ResumeLayout(false);

 this.ResumeLayout(false);

 }

       #endregion

 void ButtonClick(object sender, System.EventArgs e)

 {

 try

 {

   Thread run = new Thread(new ThreadStart(scanner));

   if ( this.button1.Text == "Scan" )

   {

   n = int.Parse(this.textBox4.Text);

   port = int.Parse(this.textBox3.Text);

   //scanner(this.textBox1.Text,this.textBox2.Text);

   run.Start();

   //scanner();

                   

   this.button1.Text = "Stop";

   this.textBox1.Enabled = false;

   this.textBox2.Enabled = false;

   this.textBox3.Enabled = false;

   this.textBox4.Enabled = false;

   this.listBox1.Items.Add( "*** Scanning " + this.textBox1.Text + " to " + this.textBox2.Text + " port " + port + " threads " + this.textBox4.Text);

   this.listBox1.Refresh();

   }

   else

   {

   //run.Abort();

   this.button1.Text = "Scan";

   }

 }

 catch

 {

   MessageBox.Show("Parametre error !!","Error",MessageBoxButtons.OK,MessageBoxIcon.Error);

 }

 }

 void MainFormLoad(object sender, System.EventArgs e)

 {

 obmrd = sender;

 }    

 //public static void scanner(string ipString,string ipend)

 public void scanner()

 {

 try

 {

   string ipString = this.textBox1.Text;

   string ipend = this.textBox2.Text;

   char[] delimite = {'.'};

   string[] bAdd = ipString.Split(delimite,4);

   string[] bAdd2 = ipend.Split(delimite,4);            

   long w ,x ,y ,z;

   for (w=long.Parse(bAdd[0]);w<=256;w++) for (x=long.Parse(bAdd[1]);x<=256;x++) for (y=long.Parse(bAdd[2]);y<=256;y++) for (z=long.Parse(bAdd[3]);z<=256;z++)

                                 {

                                  if ( this.button1.Text == "Scan" )

                                  {

                                   CloseConnect();

                                   return;

                                  }

                                  n--;

                                  while (n <= 0 ) Thread.Sleep(300);

                                  ip = w.ToString() + '.' + x.ToString() + '.' + y.ToString() + '.' + z.ToString();

                                  //Console.WriteLine("{1}\t***Connection to {0}\n",ip,n);

                                  label5.Text = ip;

                                  label5.Refresh();

                   

                                  Connection ipToScan = new Connection(ip,port,this);    

                                  Thread t1 = new Thread(new ThreadStart(ipToScan.Connect));

                                  t1.Start();

                                  if ( ( w == long.Parse(bAdd2[0]) ) && ( x == long.Parse(bAdd2[1]) ) && ( y == long.Parse(bAdd2[2]) ) && ( z == long.Parse(bAdd2[3]) ) ) { this.button1.Text = "Scan"; }

                                 }

 }

 catch

 {

   MessageBox.Show("Parametre error !!","Error",MessageBoxButtons.OK,MessageBoxIcon.Error);

   CloseConnect();

   return;

 }

 }

 public void CloseConnect()

 {

 this.textBox1.Enabled = true;

 this.textBox2.Enabled = true;

 &

هذا الموضوع مغلق.

مواضيع مشابهة