void ReleaseDesignerOutlets()
        {
            if (AttackSwitch != null)
            {
                AttackSwitch.Dispose();
                AttackSwitch = null;
            }

            if (HostTable != null)
            {
                HostTable.Dispose();
                HostTable = null;
            }

            if (IpColumn != null)
            {
                IpColumn.Dispose();
                IpColumn = null;
            }

            if (MacColumn != null)
            {
                MacColumn.Dispose();
                MacColumn = null;
            }

            if (RefreshButton != null)
            {
                RefreshButton.Dispose();
                RefreshButton = null;
            }
        }
Пример #2
0
 partial void onTableSelection(NSObject sender)
 {
     for (var i = 0; i < HostTable.DataSource.GetRowCount(HostTable); i++)
     {
         ((HostTableDataSource)HostTable.DataSource).Hosts[i].IsSelected = HostTable.IsRowSelected(i);
     }
 }
        /// <summary>
        /// Creates a new instance of this class, listening to the given interface
        /// </summary>
        /// <param name="wpcInterface">A WinPcapInterface which defines the interface to listen to</param>
        public EthernetInterface(WinPcapInterface wpcInterface)
        {
            if (InterfaceConfiguration.GetAdapterTypeForInterface(wpcInterface.Name) != System.Net.NetworkInformation.NetworkInterfaceType.Ethernet &&
                InterfaceConfiguration.GetAdapterTypeForInterface(wpcInterface.Name) != System.Net.NetworkInformation.NetworkInterfaceType.Ethernet3Megabit &&
                InterfaceConfiguration.GetAdapterTypeForInterface(wpcInterface.Name) != System.Net.NetworkInformation.NetworkInterfaceType.FastEthernetFx &&
                InterfaceConfiguration.GetAdapterTypeForInterface(wpcInterface.Name) != System.Net.NetworkInformation.NetworkInterfaceType.FastEthernetT &&
                InterfaceConfiguration.GetAdapterTypeForInterface(wpcInterface.Name) != System.Net.NetworkInformation.NetworkInterfaceType.GigabitEthernet &&
                InterfaceConfiguration.GetAdapterTypeForInterface(wpcInterface.Name) != System.Net.NetworkInformation.NetworkInterfaceType.Wireless80211)
            {
                throw new ArgumentException("Only enabled ethernet interfaces are supported at the moment.");
            }
            if (wpcInterface.Name == null)
            {
                throw new ArgumentException("Cannot create an interface instance for an interface not properly recognised by WinPcap.");
            }

            bPromiscousMode          = true;
            oInterfaceStartStopLock  = new object();
            AddressResolutionMethod  = AddressResolution.NDP;
            bExcludeOwnTraffic       = true;
            bExcludeLocalHostTraffic = true;
            arpHostTable             = new HostTable();
            lmacSpoofAdresses        = new List <MACAddress>();
            bRun             = false;
            bShutdownPending = false;

            qFrameQueue       = new Queue <byte[]>();
            bIsRunning        = false;
            areWorkToDo       = new AutoResetEvent(false);
            this.wpcInterface = wpcInterface;
            wpcDevice         = new WinPcapDotNet();

            this.maMacAddress = InterfaceConfiguration.GetMacAddressForInterface(wpcInterface.Name);
            this.aType        = InterfaceConfiguration.GetAdapterTypeForInterface(wpcInterface.Name);
            this.MTU          = InterfaceConfiguration.GetMtuForInterface(wpcInterface.Name) - 18; //Reserve 18 bytes for our ethernet-header

            IPAddress[]  arip   = InterfaceConfiguration.GetIPAddressesForInterface(wpcInterface.Name);
            Subnetmask[] smMask = InterfaceConfiguration.GetIPSubnetsForInterface(wpcInterface.Name);

            for (int iC1 = 0; iC1 < arip.Length && iC1 < smMask.Length; iC1++)
            {
                this.AddAddress(arip[iC1], smMask[iC1]);
            }

            ipStandardgateways.AddRange(InterfaceConfiguration.GetIPStandardGatewaysForInterface(wpcInterface.Name));
            this.strDNSName   = Dns.GetHostName();
            PrimaryMACAddress = this.MACAddress;
        }
Пример #4
0
        public static string ToUIString(this HostTable hostTable)
        {
            switch (hostTable)
            {
            case HostTable.Sys:
                return(SharedResources.HostTableSys);

            case HostTable.Categories:
                return(SharedResources.HostTableCategories);

            case HostTable.Props:
                return(SharedResources.HostTableProps);

            case HostTable.Labs:
                return(SharedResources.HostTableLabs);

            case HostTable.LabProps:
                return(SharedResources.HostTableLabProps);

            case HostTable.Users:
                return(SharedResources.HostTableUsers);

            case HostTable.Roles:
                return(SharedResources.HostTableRoles);

            case HostTable.Login:
                return(SharedResources.HostTableLogin);

            case HostTable.PropStatusChanges:
                return(SharedResources.HostTablePropStatusChanges);

            case HostTable.Materials:
                return(SharedResources.HostTableMaterials);

            case HostTable.RepositoryMaterials:
                return(SharedResources.HostTableRepositoryMaterials);

            case HostTable.Items:
                return(SharedResources.HostTableItems);

            case HostTable.RepositoryItems:
                return(SharedResources.HostTableRepositoryItems);

            default:
                return(SharedResources.HostTableUnknown);
            }
        }
Пример #5
0
 private void UpdateTable()
 {
     while (true)
     {
         InvokeOnMainThread(() =>
         {
             if (Core.Core.Instance.PendingScanThread > 0)
             {
                 RefreshButton.Title = Core.Core.Instance.PendingScanThread + " replies left";
             }
             else
             {
                 RefreshButton.Title = "Refresh";
             }
             if (HostTable.SelectedRowCount == 0)
             {
                 HostTable.ReloadData();
             }
         });
         Thread.Sleep(2000);
     }
 }