예제 #1
0
        /// <summary>
        ///
        /// </summary>
        public void reloadDGVValues()
        {
            String        lType   = String.Empty;
            String        lIP     = String.Empty;
            String        lMAC    = String.Empty;
            String        lVendor = String.Empty;
            String        lNote   = String.Empty;
            SystemDetails lSysDetails;

            SystemFingerprint.TaskFacadeFingerprint lTaskFacadeFingerprint = SystemFingerprint.TaskFacadeFingerprint.getInstance();

            try
            {
                for (int i = 0; i < DGV_Targets.Rows.Count; i++)
                {
                    try
                    {
                        lMAC = DGV_Targets.Rows[i].Cells["MAC"].Value.ToString();


                        // Reset Fingerprint value
                        try
                        {
                            if ((lSysDetails = lTaskFacadeFingerprint.getSystemDetails(lMAC)) != null)
                            {
                                DGV_Targets.Rows[i].Cells["LastScanDate"].Value = lSysDetails.ScanDate;
                            }
                        }
                        catch (Exception lEx)
                        {
                            LogConsole.Main.LogConsole.pushMsg(String.Format("ARPScan: {0}", lEx.Message));
                        }

                        // Reset Note value
                        try
                        {
                            if ((lNote = lTaskFacadeFingerprint.getSystemNote(lMAC)) != null)
                            {
                                DGV_Targets.Rows[i].Cells["Note"].Value         = lNote;
                                DGV_Targets.Rows[i].Cells["vendor"].ToolTipText = lNote;
                            }
                        }
                        catch (Exception lEx)
                        {
                            LogConsole.Main.LogConsole.pushMsg(String.Format("ARPScan: {0}", lEx.Message));
                        }
                    }
                    catch (Exception lEx)
                    {
                        LogConsole.Main.LogConsole.pushMsg(String.Format("ARPScan: {0}", lEx.Message));
                    }
                } // foreach (DataG...
            }
            catch (Exception lEx)
            {
                LogConsole.Main.LogConsole.pushMsg(String.Format("ARPScan: {1}", lEx.Message));
            }
        }
예제 #2
0
        public void updateTextBox(String pData)
        {
            if (InvokeRequired)
            {
                BeginInvoke(new updateTextBoxDelegate(updateTextBox), new object[] { pData });
                return;
            }

            String        lType   = String.Empty;
            String        lIP     = String.Empty;
            String        lMAC    = String.Empty;
            String        lVendor = String.Empty;
            SystemDetails lSysDetails;
            String        lNote = String.Empty;

            SystemFingerprint.TaskFacadeFingerprint lTaskFacadeFingerprint = SystemFingerprint.TaskFacadeFingerprint.getInstance();


            try
            {
                String    lData       = String.Empty;
                XDocument lXMLContent = XDocument.Parse(pData);

                var lPacketEntries = from lService in lXMLContent.Descendants("arp")
                                     select new
                {
                    Type = lService.Element("type").Value,
                    IP   = lService.Element("ip").Value,
                    MAC  = lService.Element("mac").Value
                };

                if (lPacketEntries != null)
                {
                    foreach (var lEntry in lPacketEntries)
                    {
                        try
                        {
                            lType = lEntry.Type;
                            lIP   = lEntry.IP;
                            lMAC  = lEntry.MAC;

                            // Determine vendor
                            lVendor = MACVendor.getInstance().getVendorByMAC(lMAC);

                            if (lIP != mGatewayIP && lIP != mLocalIP)
                            {
                                mTargetList.Add(lIP);

                                lSysDetails = lTaskFacadeFingerprint.getSystemDetails(lMAC);
                                lNote       = lTaskFacadeFingerprint.getFingerprintNote(lMAC);
                                mTargetRecord.Add(new TargetRecord(lIP, lMAC, lVendor, lSysDetails.ScanDate, lNote));
                            } // if (lIP != mGa...
                        }
                        catch (Exception lEx)
                        {
                            LogConsole.Main.LogConsole.pushMsg(String.Format("ARPScan: {0}", lEx.Message));
                        }
                    } // foreach (var lEnt...
                }     // if (lv1s ...
            }
            catch (Exception lEx)
            {
                LogConsole.Main.LogConsole.pushMsg(lEx.StackTrace);
            }
        }