using Magic_Frame_Final.Properties;
using SharpPcap;
using SharpPcap.Packets;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Magic_Frame_Final
{
	public class Form_main : Form
	{
		private delegate void updateMsgCallBack(string msg, ListBox listBox);

		private byte[] cpeMAC;

		private byte[] hello_key;

		private byte[] hello_magic_packet;

		private byte[] itfMAC;

		private byte[] KEY;

		private byte[] magic_packet;

		private byte[] partial_key;

		private byte[] type_factory_default = new byte[]
		{
			223,
			223,
			255,
			255,
			255,
			255
		};

		private byte[] type_factory_default_vxWorks = new byte[]
		{
			223,
			223,
			255,
			255,
			223,
			223
		};

		private byte[] type_ff = new byte[]
		{
			255,
			255,
			255,
			255,
			255,
			255
		};

		private byte[] type_hello = new byte[]
		{
			175,
			175,
			255,
			255,
			255,
			255
		};

		private byte[] type_hello_bootrom = new byte[]
		{
			175,
			175,
			175,
			175,
			255,
			255
		};

		private byte[] type_hello_vxWorks = new byte[]
		{
			175,
			175,
			255,
			255,
			175,
			175
		};

		private byte[] type_net_bootup = new byte[]
		{
			207,
			207,
			255,
			255,
			255,
			255
		};

		private byte[] type_net_bootup_bootrom = new byte[]
		{
			207,
			207,
			207,
			207,
			255,
			255
		};

		private byte[] type_tffs_bootup = new byte[]
		{
			191,
			191,
			255,
			255,
			255,
			255
		};

		private byte[] type_tffs_bootup_bootrom = new byte[]
		{
			191,
			191,
			191,
			191,
			255,
			255
		};

		private byte[] type_protocol = new byte[]
		{
			18,
			52
		};

		private int customerId;

		private List<PcapDevice> devices;

		private PcapDevice device;

		private string customerName = "";

		private string factoryDefault = "factorydef";

		private string helloMsg = "hello";

		private Triple_DES triple_des_obj = new Triple_DES();

		private bool lockForm;

		private IContainer components;

		private ListBox listBox_msg;

		private Label label_net_if;

		private ComboBox comboBox_if;

		private Label label_3;

		private TextBox textBox_mac;

		private Label label_4;

		private Label label_5;

		private Button button_start;

		private OpenFileDialog openFileDialog_bimage;

		private Timer timer_sendPkt;

		private RadioButton radioButton_factory_default;

		private Button button_stop;

		private GroupBox groupBox_login;

		private Button button_login;

		private TextBox textBox_pw;

		private TextBox textBox_user;

		private Label label_pw;
        private Label label_user;

		private bool byteArrayCompareEqual(byte[] array1, int array1Idx, byte[] array2, int array2Idx, int length)
		{
			byte[] array3 = new byte[length];
			byte[] array4 = new byte[length];
			Array.Copy(array1, array1Idx, array3, 0, length);
			Array.Copy(array2, array2Idx, array4, 0, length);
			if (array1.Length - array1Idx < length || array2.Length - array2Idx < length)
			{
				return false;
			}
			for (int i = 0; i < length; i++)
			{
				if (array3[i] != array4[i])
				{
					return false;
				}
			}
			return true;
		}

		private bool checkMacAddress(string mac)
		{
			if (mac.Length != 12)
			{
				return false;
			}
			for (int i = 0; i < mac.Length; i++)
			{
				if (mac[i] != '0' && mac[i] != '1' && mac[i] != '2' && mac[i] != '3' && mac[i] != '4' && mac[i] != '5' && mac[i] != '6' && mac[i] != '7' && mac[i] != '8' && mac[i] != '9' && mac[i] != 'a' && mac[i] != 'b' && mac[i] != 'c' && mac[i] != 'd' && mac[i] != 'e' && mac[i] != 'f' && mac[i] != 'A' && mac[i] != 'B' && mac[i] != 'C' && mac[i] != 'D' && mac[i] != 'E' && mac[i] != 'F')
				{
					return false;
				}
			}
			return true;
		}

		private byte[] createDecryptedPayload(byte[] cipher, byte[] key)
		{
			int num = cipher.Length;
			byte[] array = new byte[8];
			byte[] array2 = new byte[8];
			byte[] array3 = new byte[8];
			byte[] array4 = new byte[8];
			byte[] array5 = new byte[num];
			byte[] array6 = new byte[8];
			Array.Copy(key, 0, array2, 0, 8);
			Array.Copy(key, 8, array3, 0, 8);
			Array.Copy(key, 16, array4, 0, 8);
			for (int i = 0; i < cipher.Length / 8; i++)
			{
				Array.Copy(cipher, 8 * i, array, 0, 8);
				this.triple_des_obj.TRIPLE_DES_DECRYPT(array, array2, array3, array4, array6);
				Array.Copy(array6, 0, array5, 8 * i, 8);
			}
			return array5;
		}

		private byte[] createEncryptedPayload(byte[] plain, byte[] key)
		{
			int num = plain.Length;
			int num2 = num;
			if (num % 8 != 0)
			{
				num2 = (num / 8 + 1) * 8;
			}
			byte[] array = new byte[num2];
			Array.Copy(plain, 0, array, 0, num);
			byte[] array2 = new byte[num2];
			byte[] array3 = new byte[8];
			byte[] array4 = new byte[8];
			byte[] array5 = new byte[8];
			byte[] array6 = new byte[8];
			byte[] array7 = new byte[8];
			Array.Copy(key, 0, array4, 0, 8);
			Array.Copy(key, 8, array5, 0, 8);
			Array.Copy(key, 16, array6, 0, 8);
			for (int i = 0; i < array.Length / 8; i++)
			{
				Array.Copy(array, 8 * i, array7, 0, 8);
				this.triple_des_obj.TRIPLE_DES_ENCRYPT(array7, array4, array5, array6, array3);
				Array.Copy(array3, 0, array2, 8 * i, 8);
			}
			return array2;
		}

		private byte[] createPacket(byte[] destMAC, byte[] srcMAC, byte[] type, byte[] payLoad)
		{
			byte[] array = new byte[62];
			Array.Copy(destMAC, 0, array, 0, 6);
			Array.Copy(srcMAC, 0, array, 6, 6);
			Array.Copy(this.type_protocol, 0, array, 12, 2);
			Array.Copy(this.type_ff, 0, array, 14, 6);
			Array.Copy(type, 0, array, 20, 6);
			Array.Copy(payLoad, 0, array, 26, 36);
			return array;
		}

		private byte[] hello_key_generation(int id)
		{
			byte[] array = new byte[6];
			byte[] array2 = new byte[6];
			byte[] array3 = new byte[24];
			byte[] array4 = new byte[6];
			byte[] array5 = new byte[6];
			byte[] array6 = new byte[6];
			byte[] array7 = new byte[6];
			for (int i = 0; i < array4.Length; i++)
			{
				array4[i] = (byte)(Convert.ToByte(255 - this.cpeMAC[i]));
			}
			for (int j = 0; j < array7.Length; j++)
			{
				array7[j] = (byte)(Convert.ToByte(255 - this.itfMAC[j]));
			}
			for (int k = 0; k < array.Length; k++)
			{
				array[k] = (byte)(Convert.ToByte(this.cpeMAC[k] & this.itfMAC[k]));
			}
			for (int l = 0; l < array2.Length; l++)
			{
				array2[l] = (byte)(Convert.ToByte(this.cpeMAC[l] | this.itfMAC[l]));
			}
			for (int m = 0; m < array5.Length; m++)
			{
				array5[m] = (byte)(Convert.ToByte(255 - array[m]));
			}
			for (int n = 0; n < array6.Length; n++)
			{
				array6[n] = (byte)(Convert.ToByte(255 - array2[n]));
			}
			if (id % 2 == 0)
			{
				Array.Copy(array6, 0, array3, 0, 6);
			}
			else
			{
				Array.Copy(this.cpeMAC, 0, array3, 0, 6);
			}
			if (id / 2 % 2 == 0)
			{
				Array.Copy(this.itfMAC, 0, array3, 6, 6);
			}
			else
			{
				Array.Copy(array4, 0, array3, 6, 6);
			}
			if (id / 4 % 2 == 0)
			{
				Array.Copy(array7, 0, array3, 12, 6);
			}
			else
			{
				Array.Copy(array, 0, array3, 12, 6);
			}
			if (id / 8 % 2 == 0)
			{
				Array.Copy(array2, 0, array3, 18, 6);
			}
			else
			{
				Array.Copy(array5, 0, array3, 18, 6);
			}
			return array3;
		}

		private byte[] strtobyte(string str)
		{
			byte[] array = new byte[str.Length / 2];
			if (str.Length % 2 == 0)
			{
				for (int i = 0; i < str.Length / 2; i++)
				{
					string value = new string(new char[]
					{
						str[i * 2],
						str[i * 2 + 1]
					});
					array[i] = Convert.ToByte(value, 16);
				}
			}
			else
			{
				array[0] = (byte)str[0];
				for (int j = 0; j < str.Length / 2; j++)
				{
					string value2 = new string(new char[]
					{
						str[j * 2 + 1],
						str[j * 2 + 2]
					});
					array[j + 1] = Convert.ToByte(value2, 16);
				}
			}
			return array;
		}

		private string byteArrayToHexString(byte[] byteArray)
		{
			string result = string.Empty;
			StringBuilder stringBuilder = new StringBuilder();
			if (byteArray != null)
			{
				for (int i = 0; i < byteArray.Length; i++)
				{
					stringBuilder.Append(byteArray[i].ToString("X2"));
				}
				result = stringBuilder.ToString();
			}
			return result;
		}

		private void updateMsg(string msg, ListBox listBox)
		{
			if (base.InvokeRequired)
			{
				Form_main.updateMsgCallBack method = new Form_main.updateMsgCallBack(this.updateMsg);
				base.Invoke(method, new object[]
				{
					msg,
					listBox
				});
				return;
			}
			listBox.Items.Add(msg);
		}

		protected override void WndProc(ref Message m)
		{
			if (m.Msg == 274 && (int)m.WParam == 61536 && this.lockForm)
			{
				return;
			}
			base.WndProc(ref m);
		}

		public Form_main()
		{
			this.InitializeComponent();
			this.getDevice();
			this.comboBox_if.Enabled = false;
			this.textBox_mac.Enabled = false;
			this.button_start.Enabled = false;
			this.button_stop.Enabled = false;
			this.radioButton_factory_default.Enabled = false;
			this.listBox_msg.Enabled = false;
		}

		private void showSharpPcapVer()
		{
			this.listBox_msg.Items.Add("SharpPcap version : " + SharpPcap.Version.VersionString);
		}

		private void getDevice()
		{
			this.devices = Pcap.GetAllDevices();
            
            if (this.devices.Count < 1)
			{
				this.button_start.Enabled = false;
				return;
			}
			this.button_start.Enabled = true;
			DataTable dataTable = new DataTable();
			dataTable.Columns.Add(new DataColumn("Display", typeof(string)));
			dataTable.Columns.Add(new DataColumn("Id", typeof(int)));
			int num = 0;
			foreach (PcapDevice current in this.devices)
			{
				dataTable.Rows.Add(dataTable.NewRow());
				dataTable.Rows[num][0] = num + 1 + ". " + current.Description;
				dataTable.Rows[num][1] = num + 1;
				num++;
			}
			this.comboBox_if.DataSource = dataTable;
			this.comboBox_if.DisplayMember = "Display";
			this.comboBox_if.ValueMember = "Id";
		}

		private void button_login_Click(object sender, EventArgs e)
		{
			int num = 1;
			Settings @default = Settings.Default;
			string text = this.textBox_user.Text;
			string text2 = this.textBox_pw.Text;
			byte[] bytes = Encoding.UTF8.GetBytes(text);
			byte[] bytes2 = Encoding.UTF8.GetBytes(text2);
			byte[] key = new byte[]
			{
				174,
				93,
				164,
				164,
				164,
				115,
				189,
				177,
				164,
				164,
				165,
				191,
				174,
				93,
				164,
				164,
				164,
				115,
				189,
				177,
				164,
				164,
				165,
				191
			};
			string a = this.byteArrayToHexString(this.createEncryptedPayload(bytes, key));
			string a2 = this.byteArrayToHexString(this.createEncryptedPayload(bytes2, key));
			if (string.Equals(a, @default.username_01) && string.Equals(a2, @default.password_01))
			{
				this.customerName = "Airspan";
				this.customerId = 1;
			}
			else if (string.Equals(a, @default.username_02) && string.Equals(a2, @default.password_02))
			{
				this.customerName = "Alvarion";
				this.customerId = 2;
			}
			else if (string.Equals(a, @default.username_03) && string.Equals(a2, @default.password_03))
			{
				this.customerName = "Aviat";
				this.customerId = 3;
			}
			else if (string.Equals(a, @default.username_04) && string.Equals(a2, @default.password_04))
			{
				this.customerName = "Barret";
				this.customerId = 4;
			}
			else if (string.Equals(a, @default.username_05) && string.Equals(a2, @default.password_05))
			{
				this.customerName = "Canopy";
				this.customerId = 5;
			}
			else if (string.Equals(a, @default.username_06) && string.Equals(a2, @default.password_06))
			{
				this.customerName = "Gemtek";
				this.customerId = 6;
			}
			else if (string.Equals(a, @default.username_07) && string.Equals(a2, @default.password_07))
			{
				this.customerName = "Huawei";
				this.customerId = 7;
			}
			else if (string.Equals(a, @default.username_08) && string.Equals(a2, @default.password_08))
			{
				this.customerName = "Purewave";
				this.customerId = 8;
			}
			else if (string.Equals(a, @default.username_09) && string.Equals(a2, @default.password_09))
			{
				this.customerName = "Ruggedcom";
				this.customerId = 9;
			}
			else if (string.Equals(a, @default.username_10) && string.Equals(a2, @default.password_10))
			{
				this.customerName = "ZTE";
				this.customerId = 10;
			}
			else if (string.Equals(a, @default.username_11) && string.Equals(a2, @default.password_11))
			{
				this.customerName = "ZTE";
				this.customerId = 11;
			}
			else if (string.Equals(a, @default.username_12) && string.Equals(a2, @default.password_12))
			{
				this.customerName = "China Communication";
				this.customerId = 12;
			}
			else
			{
				this.listBox_msg.Items.Add("Login Failed!!!");
				this.listBox_msg.Items.Add("Username ->" + text + "<-");
				this.listBox_msg.Items.Add("Password ->" + text2 + "<-");
				num = 0;
			}
			if (num == 1)
			{
				this.listBox_msg.Items.Add("Login Customer: " + this.customerName);
				this.comboBox_if.Enabled = true;
				this.textBox_mac.Enabled = true;
				this.button_start.Enabled = true;
				this.listBox_msg.Enabled = true;
				this.textBox_user.Enabled = false;
				this.textBox_pw.Enabled = false;
				this.button_login.Enabled = false;
			}
		}

		private void button_start_Click(object sender, EventArgs e)
		{
			Encoding aSCII = Encoding.ASCII;
			if (!this.checkMacAddress(this.textBox_mac.Text))
			{
				MessageBox.Show("Please type the MAC address as below\nExample : 123456789ABC");
				return;
			}
			int selectedIndex = this.comboBox_if.SelectedIndex;
			this.device = this.devices[selectedIndex];
			this.device.Open();
			this.device.SetFilter("ether proto 0x1234 and less 62");
			this.cpeMAC = new byte[6];
			this.itfMAC = new byte[6];
			this.cpeMAC = this.strtobyte(this.textBox_mac.Text);
			this.itfMAC = this.device.Interface.MacAddress.GetAddressBytes();
			byte[] array = new byte[36];
			Array.Copy(aSCII.GetBytes(this.helloMsg), 0, array, 0, aSCII.GetBytes(this.helloMsg).Length);
			Array.Copy(BitConverter.GetBytes(this.customerId), 0, array, 11, 1);
			byte[] array2 = new byte[24];
			this.partial_key = new byte[6];
			Array.Copy(this.cpeMAC, 0, array2, 0, 6);
			Array.Copy(this.itfMAC, 0, array2, 8, 6);
			Array.Copy(this.type_hello, 0, array2, 16, 6);
			Random random = new Random();
			for (int i = 0; i < 3; i++)
			{
				for (int j = 0; j < 2; j++)
				{
					this.partial_key[(i + 1) * 2 - (j + 1)] = (array2[(i + 1) * 8 - (j + 1)] = (byte)random.Next(0, 255));
				}
			}
			this.hello_key = new byte[24];
			this.hello_key = this.hello_key_generation(this.customerId);
			byte[] array3 = new byte[24];
			array3 = this.createEncryptedPayload(array2, this.hello_key);
			array2 = new byte[24];
			array2 = this.createDecryptedPayload(array3, this.hello_key);
			Array.Copy(array3, 0, array, 12, 24);
			this.magic_packet = new byte[62];
			this.hello_magic_packet = new byte[62];
			this.magic_packet = this.createPacket(this.cpeMAC, this.itfMAC, this.type_hello, array);
			Array.Copy(this.magic_packet, 0, this.hello_magic_packet, 0, 62);
			this.timer_sendPkt.Enabled = true;
			this.lockForm = true;
			this.comboBox_if.Enabled = false;
			this.textBox_mac.Enabled = false;
			this.button_start.Enabled = false;
			this.button_stop.Enabled = true;
		}

		private void button_stop_Click(object sender, EventArgs e)
		{
			this.timer_sendPkt.Enabled = false;
			this.lockForm = false;
			this.comboBox_if.Enabled = true;
			this.textBox_mac.Enabled = true;
			this.button_start.Enabled = true;
			this.listBox_msg.Items.Add("Stop the process...");
		}

		private void timer_sendPkt_Tick(object sender, EventArgs e)
		{
			int num = 0;
			int num2 = 0;
			Packet packet = new Packet();
			Encoding aSCII = Encoding.ASCII;
			this.device.SendPacket(this.magic_packet);
			if ((packet = this.device.GetNextPacket()) != null && this.byteArrayCompareEqual(packet.Bytes, 0, this.itfMAC, 0, 6) && this.byteArrayCompareEqual(packet.Bytes, 6, this.cpeMAC, 0, 6) && this.byteArrayCompareEqual(packet.Bytes, 12, this.type_protocol, 0, 2) && this.byteArrayCompareEqual(packet.Bytes, 14, this.type_ff, 0, 6))
			{
				if (num == 0 && this.byteArrayCompareEqual(packet.Bytes, 20, this.type_hello_vxWorks, 0, 6) && this.byteArrayCompareEqual(packet.Bytes, 26, aSCII.GetBytes(this.helloMsg), 0, aSCII.GetBytes(this.helloMsg).Length) && (int)packet.Bytes[37] == this.customerId)
				{
					byte[] array = new byte[24];
					byte[] array2 = new byte[24];
					this.KEY = new byte[24];
					this.listBox_msg.Items.Add("Get a hello message replying from vxWorks ......\n");
					num = 1;
					Array.Copy(packet.Bytes, 38, array2, 0, 24);
					array = this.createDecryptedPayload(array2, this.hello_key);
					Array.Copy(array, 0, this.KEY, 0, 24);
					if (!this.byteArrayCompareEqual(this.KEY, 0, this.partial_key, 0, 6))
					{
						this.listBox_msg.Items.Add("Incorrect partial key ......");
						return;
					}
					this.listBox_msg.Items.Add("Correct partial key ......");
					if (this.radioButton_factory_default.Checked && num == 1)
					{
						this.timer_sendPkt.Enabled = false;
						byte[] array3 = new byte[36];
						Array.Copy(aSCII.GetBytes(this.factoryDefault), 0, array3, 0, aSCII.GetBytes(this.factoryDefault).Length);
						byte[] array4 = new byte[24];
						Array.Copy(this.cpeMAC, 0, array4, 0, 6);
						Array.Copy(this.itfMAC, 0, array4, 6, 6);
						Array.Copy(this.type_ff, 0, array4, 12, 6);
						Array.Copy(this.type_factory_default, 0, array4, 18, 6);
						byte[] sourceArray = new byte[24];
						sourceArray = this.createEncryptedPayload(array4, this.KEY);
						Array.Copy(sourceArray, 0, array3, 12, 24);
						this.magic_packet = new byte[62];
						this.magic_packet = this.createPacket(this.cpeMAC, this.itfMAC, this.type_factory_default, array3);
						this.timer_sendPkt.Enabled = true;
						return;
					}
				}
				else if (num2 == 0 && this.byteArrayCompareEqual(packet.Bytes, 20, this.type_factory_default_vxWorks, 0, 6) && this.byteArrayCompareEqual(packet.Bytes, 26, aSCII.GetBytes(this.factoryDefault), 0, aSCII.GetBytes(this.factoryDefault).Length))
				{
					byte[] array = new byte[24];
					byte[] array2 = new byte[24];
					this.listBox_msg.Items.Add("Get a factory default message replying from vxWorks ......\n");
					Array.Copy(packet.Bytes, 38, array2, 0, 24);
					array = this.createDecryptedPayload(array2, this.KEY);
					int num3 = 1;
					for (int i = 0; i < 12; i++)
					{
						if (array[i] != packet.Bytes[i])
						{
							num3 = 0;
							break;
						}
					}
					if (num3 == 1)
					{
						for (int j = 12; j < 24; j++)
						{
							if (array[j] != packet.Bytes[j + 2])
							{
								num3 = 0;
								break;
							}
						}
					}
					if (num3 == 1)
					{
						this.timer_sendPkt.Enabled = false;
						this.listBox_msg.Items.Add("Correct factory default message retrun ......");
						this.lockForm = false;
						this.comboBox_if.Enabled = true;
						this.textBox_mac.Enabled = true;
						this.button_start.Enabled = true;
						this.button_stop.Enabled = false;
						this.listBox_msg.Items.Add("Factory Default Finished!!");
						return;
					}
					this.listBox_msg.Items.Add("Incorrect function message retrun ......");
				}
			}
		}

		protected override void Dispose(bool disposing)
		{
			if (disposing && this.components != null)
			{
				this.components.Dispose();
			}
			base.Dispose(disposing);
		}

		private void InitializeComponent()
		{
            this.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form_main));
            this.listBox_msg = new System.Windows.Forms.ListBox();
            this.label_net_if = new System.Windows.Forms.Label();
            this.comboBox_if = new System.Windows.Forms.ComboBox();
            this.label_3 = new System.Windows.Forms.Label();
            this.textBox_mac = new System.Windows.Forms.TextBox();
            this.label_4 = new System.Windows.Forms.Label();
            this.label_5 = new System.Windows.Forms.Label();
            this.button_start = new System.Windows.Forms.Button();
            this.openFileDialog_bimage = new System.Windows.Forms.OpenFileDialog();
            this.timer_sendPkt = new System.Windows.Forms.Timer(this.components);
            this.radioButton_factory_default = new System.Windows.Forms.RadioButton();
            this.button_stop = new System.Windows.Forms.Button();
            this.groupBox_login = new System.Windows.Forms.GroupBox();
            this.button_login = new System.Windows.Forms.Button();
            this.textBox_pw = new System.Windows.Forms.TextBox();
            this.textBox_user = new System.Windows.Forms.TextBox();
            this.label_pw = new System.Windows.Forms.Label();
            this.label_user = new System.Windows.Forms.Label();
            this.groupBox_login.SuspendLayout();
            this.SuspendLayout();
            // 
            // listBox_msg
            // 
            this.listBox_msg.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.listBox_msg.FormattingEnabled = true;
            this.listBox_msg.HorizontalScrollbar = true;
            this.listBox_msg.ItemHeight = 15;
            this.listBox_msg.Location = new System.Drawing.Point(17, 217);
            this.listBox_msg.Name = "listBox_msg";
            this.listBox_msg.Size = new System.Drawing.Size(565, 214);
            this.listBox_msg.TabIndex = 0;
            // 
            // label_net_if
            // 
            this.label_net_if.AutoSize = true;
            this.label_net_if.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.label_net_if.Location = new System.Drawing.Point(14, 15);
            this.label_net_if.Name = "label_net_if";
            this.label_net_if.Size = new System.Drawing.Size(115, 15);
            this.label_net_if.TabIndex = 1;
            this.label_net_if.Text = "1. Network interface";
            // 
            // comboBox_if
            // 
            this.comboBox_if.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.comboBox_if.FormattingEnabled = true;
            this.comboBox_if.Location = new System.Drawing.Point(17, 33);
            this.comboBox_if.Name = "comboBox_if";
            this.comboBox_if.Size = new System.Drawing.Size(393, 23);
            this.comboBox_if.TabIndex = 2;
            // 
            // label_3
            // 
            this.label_3.AutoSize = true;
            this.label_3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.label_3.Location = new System.Drawing.Point(14, 61);
            this.label_3.Name = "label_3";
            this.label_3.Size = new System.Drawing.Size(170, 15);
            this.label_3.TabIndex = 3;
            this.label_3.Text = "2. MAC Address of the product";
            // 
            // textBox_mac
            // 
            this.textBox_mac.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.textBox_mac.Location = new System.Drawing.Point(17, 79);
            this.textBox_mac.MaxLength = 12;
            this.textBox_mac.Name = "textBox_mac";
            this.textBox_mac.Size = new System.Drawing.Size(393, 21);
            this.textBox_mac.TabIndex = 4;
            // 
            // label_4
            // 
            this.label_4.AutoSize = true;
            this.label_4.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.label_4.Location = new System.Drawing.Point(14, 108);
            this.label_4.Name = "label_4";
            this.label_4.Size = new System.Drawing.Size(67, 15);
            this.label_4.TabIndex = 5;
            this.label_4.Text = "3. Function";
            // 
            // label_5
            // 
            this.label_5.AutoSize = true;
            this.label_5.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.label_5.Location = new System.Drawing.Point(14, 154);
            this.label_5.Name = "label_5";
            this.label_5.Size = new System.Drawing.Size(45, 15);
            this.label_5.TabIndex = 7;
            this.label_5.Text = "4. Start";
            // 
            // button_start
            // 
            this.button_start.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.button_start.Location = new System.Drawing.Point(17, 172);
            this.button_start.Name = "button_start";
            this.button_start.Size = new System.Drawing.Size(100, 22);
            this.button_start.TabIndex = 8;
            this.button_start.Text = "Start";
            this.button_start.UseVisualStyleBackColor = true;
            this.button_start.Click += new System.EventHandler(this.button_start_Click);
            // 
            // timer_sendPkt
            // 
            this.timer_sendPkt.Interval = 1000;
            this.timer_sendPkt.Tick += new System.EventHandler(this.timer_sendPkt_Tick);
            // 
            // radioButton_factory_default
            // 
            this.radioButton_factory_default.AutoSize = true;
            this.radioButton_factory_default.Checked = true;
            this.radioButton_factory_default.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.radioButton_factory_default.Location = new System.Drawing.Point(17, 127);
            this.radioButton_factory_default.Name = "radioButton_factory_default";
            this.radioButton_factory_default.Size = new System.Drawing.Size(106, 19);
            this.radioButton_factory_default.TabIndex = 9;
            this.radioButton_factory_default.TabStop = true;
            this.radioButton_factory_default.Text = "Factory Default";
            this.radioButton_factory_default.UseVisualStyleBackColor = true;
            // 
            // button_stop
            // 
            this.button_stop.Location = new System.Drawing.Point(130, 172);
            this.button_stop.Name = "button_stop";
            this.button_stop.Size = new System.Drawing.Size(111, 22);
            this.button_stop.TabIndex = 10;
            this.button_stop.Text = "Stop";
            this.button_stop.UseVisualStyleBackColor = true;
            this.button_stop.Click += new System.EventHandler(this.button_stop_Click);
            // 
            // groupBox_login
            // 
            this.groupBox_login.Controls.Add(this.button_login);
            this.groupBox_login.Controls.Add(this.textBox_pw);
            this.groupBox_login.Controls.Add(this.textBox_user);
            this.groupBox_login.Controls.Add(this.label_pw);
            this.groupBox_login.Controls.Add(this.label_user);
            this.groupBox_login.Location = new System.Drawing.Point(429, 15);
            this.groupBox_login.Name = "groupBox_login";
            this.groupBox_login.Size = new System.Drawing.Size(153, 194);
            this.groupBox_login.TabIndex = 13;
            this.groupBox_login.TabStop = false;
            this.groupBox_login.Text = "     Login     ";
            // 
            // button_login
            // 
            this.button_login.Location = new System.Drawing.Point(20, 157);
            this.button_login.Name = "button_login";
            this.button_login.Size = new System.Drawing.Size(75, 22);
            this.button_login.TabIndex = 4;
            this.button_login.Text = "Login";
            this.button_login.UseVisualStyleBackColor = true;
            this.button_login.Click += new System.EventHandler(this.button_login_Click);
            // 
            // textBox_pw
            // 
            this.textBox_pw.Location = new System.Drawing.Point(20, 114);
            this.textBox_pw.Name = "textBox_pw";
            this.textBox_pw.PasswordChar = '*';
            this.textBox_pw.Size = new System.Drawing.Size(114, 20);
            this.textBox_pw.TabIndex = 3;
            this.textBox_pw.Text = "Motorola";
            // 
            // textBox_user
            // 
            this.textBox_user.Location = new System.Drawing.Point(20, 49);
            this.textBox_user.Name = "textBox_user";
            this.textBox_user.Size = new System.Drawing.Size(114, 20);
            this.textBox_user.TabIndex = 2;
            this.textBox_user.Text = "administrator";
            this.textBox_user.TextChanged += new System.EventHandler(this.textBox_user_TextChanged);
            // 
            // label_pw
            // 
            this.label_pw.AutoSize = true;
            this.label_pw.Location = new System.Drawing.Point(20, 87);
            this.label_pw.Name = "label_pw";
            this.label_pw.Size = new System.Drawing.Size(53, 13);
            this.label_pw.TabIndex = 1;
            this.label_pw.Text = "Password";
            // 
            // label_user
            // 
            this.label_user.AutoSize = true;
            this.label_user.Location = new System.Drawing.Point(20, 27);
            this.label_user.Name = "label_user";
            this.label_user.Size = new System.Drawing.Size(29, 13);
            this.label_user.TabIndex = 0;
            this.label_user.Text = "User";
            // 
            // Form_main
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(594, 453);
            this.Controls.Add(this.groupBox_login);
            this.Controls.Add(this.button_stop);
            this.Controls.Add(this.radioButton_factory_default);
            this.Controls.Add(this.button_start);
            this.Controls.Add(this.label_5);
            this.Controls.Add(this.label_4);
            this.Controls.Add(this.textBox_mac);
            this.Controls.Add(this.label_3);
            this.Controls.Add(this.comboBox_if);
            this.Controls.Add(this.label_net_if);
            this.Controls.Add(this.listBox_msg);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.MaximizeBox = false;
            this.Name = "Form_main";
            this.Text = "PMP320 Factory Default Tool (Modified by Ben)";
            this.Load += new System.EventHandler(this.Form_main_Load);
            this.groupBox_login.ResumeLayout(false);
            this.groupBox_login.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

		}

        private void textBox_user_TextChanged(object sender, EventArgs e)
        {

        }

        private void Form_main_Load(object sender, EventArgs e)
        {

        }
    }
}
