コード例 #1
0
ファイル: ARPReader.cs プロジェクト: onixion/MAD
 private static void SteadyStartsFunktion(object jsArg)
 {
     while (true)
     {
         JobSystem _js = (JobSystem)jsArg;
         FloodStart();
         _js.SyncNodes(ModelHost.hostList);
         Thread.Sleep(3000);
     }
 }
コード例 #2
0
        private void InvokeArpReader()
        {
            try
            {
                ARPReader.srcAddress = IPAddress.Parse(textBoxLocalIP.Text);
                ARPReader.netAddress = IPAddress.Parse(textBoxNetwork.Text);
                ARPReader.subnetMask = Convert.ToUInt32(comboBoxSubnetmask.SelectedItem);
                if (this.comboBoxNWD.Text != "Default")
                {
                    ARPReader.networkInterface = Convert.ToUInt16(this.comboBoxNWD.SelectedItem.ToString()) - (uint)1;
                }

                if (checkBoxOneScan.Checked)
                {
                    ARPReader.SetWindow(this);
                    ARPReader.FloodStart();
                    _js.SyncNodes(ModelHost.hostList);
                    ARPReader.ResetWindow();
                }

                else
                {
                    ARPReader.SteadyStart(_js);
                    GUILogic.SteadyActivated = true;
                    _mw.buttonScan.Enabled   = false;
                }
                validEntering = true;
            }

            catch
            {
                MessageBox.Show("Please check the fields again, your enterings seem to be incorrect", "Ups...Something went wrong", MessageBoxButtons.OK, MessageBoxIcon.Error);
                validEntering = false;
            }


            return;
        }
コード例 #3
0
        public override string Execute(int consoleWidth)
        {
            ARPReader.srcAddress = (IPAddress)pars.GetPar("l").argValues[0];
            ARPReader.netAddress = (IPAddress)pars.GetPar("n").argValues[0];
            ARPReader.subnetMask = (uint)pars.GetPar("s").argValues[0];

            if (OParUsed("i"))
            {
                ARPReader.networkInterface = (uint)pars.GetPar("i").argValues[0] - 1;
            }

            if (OParUsed("o"))
            {
                ARPReader.FloodStart();
                _js.SyncNodes(ModelHost.hostList);
                return("<color><blue>Successfully performed Scan");
            }
            else
            {
                ARPReader.SteadyStart(_js);
                return("<color><blue> Started steady arp reader");
            }
        }
コード例 #4
0
 public override string Execute(int consoleWidth)
 {
     _js.SyncNodes(ModelHost.hostList);
     return("<color><blue> Sync done");
 }
コード例 #5
0
 public override string Execute(int consoleWidth)
 {
     ARPReader.CheckStart();
     _js.SyncNodes(ModelHost.hostList);
     return("<color><blue>Updated list");
 }
コード例 #6
0
ファイル: DHCPReader.cs プロジェクト: onixion/MAD
        private void ProcessData()
        {
            try
            {
                if (NetworkHelper.IsDhcp(_data) && NetworkHelper.IsDhcpRequest(_data))
                {
                    ModelHost _tmpModel = new ModelHost();
                    _tmpModel.hostMac  = NetworkHelper.getPhysicalAddressStringFromDhcp(_data);
                    _tmpModel.macGiven = true;

                    for (uint i = NetworkHelper.DHCP_COOKIE_POSITION; i < _data.Length; i++)
                    {
                        switch (Convert.ToUInt16(_data[i]))
                        {
                        case 50:
                            byte[] _ipBytes = new byte[4];

                            for (uint ii = 0; ii < 4; ii++)
                            {
                                _ipBytes[ii] = _data[i + 2 + ii];
                            }

                            _tmpModel.ipGiven = true;
                            _tmpModel.hostIP  = new IPAddress(_ipBytes);

                            continue;

                        case 55:
                            i = 1 + i + _data[i + 1];

                            continue;

                        case 12:

                            byte _nameLength = _data[i + 1];
                            _tmpModel.hostName = "";
                            try
                            {
                                for (uint iii = 1; iii <= _nameLength; iii++)
                                {
                                    _tmpModel.hostName += (char)_data[i + 1 + iii];
                                    _tmpModel.nameGiven = true;
                                }
                            }
                            catch
                            {
                            }
                            continue;

                        default:

                            break;
                        }
                    }

                    if (ModelHost.Exists(_tmpModel))
                    {
                        if (_tmpModel.nameGiven)
                        {
                            ModelHost.UpdateHost(_tmpModel, _tmpModel.hostIP, _tmpModel.hostName);
                        }
                        else
                        {
                            ModelHost.UpdateHost(_tmpModel, _tmpModel.hostIP);
                        }
                    }
                    else
                    {
                        ModelHost.AddToList(_tmpModel);
                    }

                    _js.SyncNodes(ModelHost.hostList);
                }
            }
            catch
            {
            }
        }