def __init__(self, *args, **kwargs): form.Form.__init__(self, *args, **kwargs) #~ self.list_view.SetItemCount(len(captions)) #~ self.list_view.SetRedraw(1) lvcolumn = comctl.LVCOLUMN(comctl.LVCF_TEXT | comctl.LVCF_WIDTH, 0, 300, 'item') self.list_view.InsertColumn(0, lvcolumn) lvcolumn = comctl.LVCOLUMN(comctl.LVCF_TEXT | comctl.LVCF_WIDTH, 0, 100, 'value') self.list_view.InsertColumn(1, lvcolumn) item_flags = comctl.LVIF_TEXT | comctl.LVIF_DI_SETITEM items = [] for i in range(len(captions)): item = comctl.LVITEM(item_flags) item.iItem = i item.pszText = captions[i] self.list_view.InsertItem(item) # now setup second column of current row, change iSubItem item.iSubItem = 1 item.pszText = 'value %d' % i self.list_view.SetItem(item) items.append(item) dwRetval, pStats = GetUdpStatistics() if dwRetval != NO_ERROR: print('GetUdpStatistics failed with error %d' % dwRetval) else: items[0].pszText = '%d' % pStats.dwInDatagrams items[1].pszText = '%d' % pStats.dwNoPorts items[2].pszText = '%d' % pStats.dwInErrors items[3].pszText = '%d' % pStats.dwOutDatagrams items[4].pszText = '%d' % pStats.dwNumAddrs for item in items: self.list_view.SetItem(item)
def ShowResource(self, count_entries, lpNetResource): for i in range(count_entries): item = comctl.LVITEM(self.item_flags) item.iItem = self.global_index item.pszText = lpNetResource[i].lpRemoteName self.list_view.InsertItem(item) item.iSubItem = 1 item.pszText = lpNetResource[i].lpLocalName self.list_view.SetItem(item) self.global_index += 1
def __init__(self, *args, **kwargs): form.Form.__init__(self, *args, **kwargs) #~ self.list_view.SetItemCount(len(captions)) #~ self.list_view.SetRedraw(1) lvcolumn = comctl.LVCOLUMN(comctl.LVCF_TEXT|comctl.LVCF_WIDTH, 0, 500, 'item') self.list_view.InsertColumn(0, lvcolumn) lvcolumn = comctl.LVCOLUMN(comctl.LVCF_TEXT|comctl.LVCF_WIDTH, 0, 100, 'value') self.list_view.InsertColumn(1, lvcolumn) item_flags = comctl.LVIF_TEXT|comctl.LVIF_DI_SETITEM items = [] for i in range(len(captions)): item = comctl.LVITEM(item_flags) item.iItem = i item.pszText = captions[i] self.list_view.InsertItem(item) # now setup second column of current row, change iSubItem item.iSubItem = 1 item.pszText = 'value %d' % i self.list_view.SetItem(item) items.append(item) dwRetval, pStats = GetIpStatistics() if dwRetval != NO_ERROR: print('GetIpStatistics call failed with %d' % dwRetval) else: if hasattr(pStats, 'dwForwarding'): items[0].pszText = '%d' % pStats.dwForwarding else: items[0].pszText = '(%d) %d' % (pStats.u.dwOldFieldName, pStats.u.enumNewFieldName) items[1].pszText = '%d' % pStats.dwDefaultTTL items[2].pszText = '%d' % pStats.dwInReceives items[3].pszText = '%d' % pStats.dwInHdrErrors items[4].pszText = '%d' % pStats.dwInAddrErrors items[5].pszText = '%d' % pStats.dwForwDatagrams items[6].pszText = '%d' % pStats.dwInUnknownProtos items[7].pszText = '%d' % pStats.dwInDiscards items[8].pszText = '%d' % pStats.dwInDelivers items[9].pszText = '%d' % pStats.dwOutRequests items[10].pszText = '%d' % pStats.dwRoutingDiscards items[11].pszText = '%d' % pStats.dwOutDiscards items[12].pszText = '%d' % pStats.dwOutNoRoutes items[13].pszText = '%d' % pStats.dwReasmTimeout items[14].pszText = '%d' % pStats.dwReasmReqds items[15].pszText = '%d' % pStats.dwReasmOks items[16].pszText = '%d' % pStats.dwReasmFails items[17].pszText = '%d' % pStats.dwFragOks items[18].pszText = '%d' % pStats.dwFragFails items[19].pszText = '%d' % pStats.dwFragCreates items[20].pszText = '%d' % pStats.dwNumIf items[21].pszText = '%d' % pStats.dwNumAddr items[22].pszText = '%d' % pStats.dwNumRoutes for item in items: self.list_view.SetItem(item)
def __init__(self, *args, **kwargs): form.Form.__init__(self, *args, **kwargs) #~ self.list_view.SetItemCount(len(captions)) #~ self.list_view.SetRedraw(1) lvcolumn = comctl.LVCOLUMN(comctl.LVCF_TEXT | comctl.LVCF_WIDTH, 0, 500, 'item') self.list_view.InsertColumn(0, lvcolumn) lvcolumn = comctl.LVCOLUMN(comctl.LVCF_TEXT | comctl.LVCF_WIDTH, 0, 100, 'value') self.list_view.InsertColumn(1, lvcolumn) item_flags = comctl.LVIF_TEXT | comctl.LVIF_DI_SETITEM items = [] for i in range(len(captions)): item = comctl.LVITEM(item_flags) item.iItem = i item.pszText = captions[i] self.list_view.InsertItem(item) # now setup second column of current row, change iSubItem item.iSubItem = 1 item.pszText = 'value %d' % i self.list_view.SetItem(item) items.append(item) dwRetval, DestIP, SrcIP, pMacAddr, PhyAddrLen = SendARP() print dwRetval, DestIP, SrcIP, pMacAddr, PhyAddrLen if dwRetval != NO_ERROR: print('SendARP call failed with %d' % dwRetval) if dwRetval == ERROR_GEN_FAILURE: print( 'A device attached to the system is not functioning. This error is returned on Windows Server 2003 and earlier when an ARP reply to the SendARP request was not received. This error can occur if destination IPv4 address could not be reached because it is not on the same subnet or the destination computer is not operating.' ) else: items[0].pszText = '%d' % DestIP items[1].pszText = '%d' % SrcIP items[2].pszText = '%d' % pMacAddr items[3].pszText = '%d' % PhyAddrLen for item in items: self.list_view.SetItem(item)
def __init__(self, *args, **kwargs): form.Form.__init__(self, *args, **kwargs) #~ self.list_view.SetItemCount(len(captions)) #~ self.list_view.SetRedraw(1) lvcolumn = comctl.LVCOLUMN(comctl.LVCF_TEXT | comctl.LVCF_WIDTH, 0, 400, 'item') self.list_view.InsertColumn(0, lvcolumn) lvcolumn = comctl.LVCOLUMN(comctl.LVCF_TEXT | comctl.LVCF_WIDTH, 0, 100, 'value') self.list_view.InsertColumn(1, lvcolumn) item_flags = comctl.LVIF_TEXT | comctl.LVIF_DI_SETITEM items = [] for i in range(len(captions)): item = comctl.LVITEM(item_flags) item.iItem = i item.pszText = captions[i] self.list_view.InsertItem(item) # now setup second column of current row, change iSubItem item.iSubItem = 1 item.pszText = 'value %d' % i self.list_view.SetItem(item) items.append(item) dwRetval, FixedInfo, buf_len = GetNetworkParams() if dwRetval != NO_ERROR: print('GetNetworkParams failed with error %d' % dwRetval) else: items[0].pszText = FixedInfo.HostName items[1].pszText = FixedInfo.DomainName dns_server_list = FixedInfo.DnsServerList.IpAddress.String pIPAddr = FixedInfo.DnsServerList.Next while pIPAddr: dns_server_list += '; ' + pIPAddr[0].IpAddress.String pIPAddr = pIPAddr.Next items[2].pszText = dns_server_list for item in items: self.list_view.SetItem(item)
def __init__(self, *args, **kwargs): form.Form.__init__(self, *args, **kwargs) #~ self.list_view.SetItemCount(len(captions)) #~ self.list_view.SetRedraw(1) lvcolumn = comctl.LVCOLUMN(comctl.LVCF_TEXT | comctl.LVCF_WIDTH, 0, 150, 'item') self.list_view.InsertColumn(0, lvcolumn) lvcolumn = comctl.LVCOLUMN(comctl.LVCF_TEXT | comctl.LVCF_WIDTH, 0, 350, 'value') self.list_view.InsertColumn(1, lvcolumn) item_flags = comctl.LVIF_TEXT | comctl.LVIF_DI_SETITEM items = [] for i in range(len(captions)): item = comctl.LVITEM(item_flags) item.iItem = i item.pszText = captions[i] self.list_view.InsertItem(item) # now setup second column of current row, change iSubItem item.iSubItem = 1 item.pszText = 'value %d' % i self.list_view.SetItem(item) items.append(item) #~ dwRetval, adapter_addresses, size = GetAdaptersAddresses(family = GAA_FLAG_SKIP_UNICAST | GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_DNS_SERVER, flags = 2)#AF_INET) dwRetval, adapter_addresses, size = GetAdaptersAddresses(0, 0, None) if dwRetval != NO_ERROR: print('Call to GetAdaptersAddresses failed with error: %d' % dwRetval) if dwRetval == ERROR_NO_DATA: print('No addresses were found for the requested parameters') else: print('Error description: "%s"' % FormatError(dwRetval)) else: items[0].pszText = adapter_addresses.AdapterName items[1].pszText = adapter_addresses.DnsSuffix items[2].pszText = adapter_addresses.Description items[3].pszText = adapter_addresses.FriendlyName physical_address_as_string, i = '', 0 if adapter_addresses.PhysicalAddressLength: for value in adapter_addresses.PhysicalAddress: # MAC Address if i <= adapter_addresses.PhysicalAddressLength: physical_address_as_string += '%.2X-' % value else: physical_address_as_string += '%.2X' % value i += 1 items[4].pszText = physical_address_as_string items[5].pszText = '%d' % adapter_addresses.PhysicalAddressLength items[6].pszText = '%d' % adapter_addresses.Flags items[7].pszText = '%d' % adapter_addresses.Mtu type_as_string = 'Unknown type %d' % adapter_addresses.IfType if adapter_addresses.IfType == MIB_IF_TYPE_OTHER: type_as_string = 'Other' elif adapter_addresses.IfType == MIB_IF_TYPE_ETHERNET: type_as_string = 'Ethernet' elif adapter_addresses.IfType == MIB_IF_TYPE_TOKENRING: type_as_string = 'Token Ring' elif adapter_addresses.IfType == MIB_IF_TYPE_FDDI: type_as_string = 'FDDI' elif adapter_addresses.IfType == MIB_IF_TYPE_PPP: type_as_string = 'PPP' elif adapter_addresses.IfType == MIB_IF_TYPE_LOOPBACK: type_as_string = 'Lookback' elif adapter_addresses.IfType == MIB_IF_TYPE_SLIP: type_as_string = 'Slip' items[8].pszText = type_as_string items[9].pszText = '%d' % adapter_addresses.OperStatus items[10].pszText = '%d' % adapter_addresses.Ipv6IfIndex items[11].pszText = ''.join( ['%d' % value for value in adapter_addresses.ZoneIndices]) for item in items: self.list_view.SetItem(item)
def __init__(self, *args, **kwargs): form.Form.__init__(self, *args, **kwargs) #~ self.list_view.SetItemCount(len(captions)) #~ self.list_view.SetRedraw(1) lvcolumn = comctl.LVCOLUMN(comctl.LVCF_TEXT | comctl.LVCF_WIDTH, 0, 120, 'item') self.list_view.InsertColumn(0, lvcolumn) lvcolumn = comctl.LVCOLUMN(comctl.LVCF_TEXT | comctl.LVCF_WIDTH, 0, 400, 'value') self.list_view.InsertColumn(1, lvcolumn) item_flags = comctl.LVIF_TEXT | comctl.LVIF_DI_SETITEM items = [] for i in range(len(captions)): item = comctl.LVITEM(item_flags) item.iItem = i item.pszText = captions[i] self.list_view.InsertItem(item) # now setup second column of current row, change iSubItem item.iSubItem = 1 item.pszText = 'value %d' % i self.list_view.SetItem(item) items.append(item) dwRetval, adapter_info, size = GetAdaptersInfo() if dwRetval != NO_ERROR: print('GetAdaptersInfo call failed with %d' % dwRetval) else: items[0].pszText = '%d' % adapter_info.ComboIndex items[1].pszText = adapter_info.AdapterName items[2].pszText = adapter_info.Description items[3].pszText = '%d' % adapter_info.AddressLength physical_address_as_string, i = '', 0 for value in adapter_info.Address: # MAC Address if i <= adapter_info.AddressLength: physical_address_as_string += '%.2X-' % value else: physical_address_as_string += '%.2X' % value i += 1 items[4].pszText = physical_address_as_string items[5].pszText = '%d' % adapter_info.Index type_as_string = 'Unknown type %d' % adapter_info.Type if adapter_info.Type == MIB_IF_TYPE_OTHER: type_as_string = 'Other' elif adapter_info.Type == MIB_IF_TYPE_ETHERNET: type_as_string = 'Ethernet' elif adapter_info.Type == MIB_IF_TYPE_TOKENRING: type_as_string = 'Token Ring' elif adapter_info.Type == MIB_IF_TYPE_FDDI: type_as_string = 'FDDI' elif adapter_info.Type == MIB_IF_TYPE_PPP: type_as_string = 'PPP' elif adapter_info.Type == MIB_IF_TYPE_LOOPBACK: type_as_string = 'Lookback' elif adapter_info.Type == MIB_IF_TYPE_SLIP: type_as_string = 'Slip' items[6].pszText = type_as_string items[7].pszText = '%d' % adapter_info.DhcpEnabled #~ items[8].pszText = adapter_info.CurrentIpAddress[0].IpAddress.String items[8].pszText = repr(adapter_info.CurrentIpAddress) items[9].pszText = adapter_info.IpAddressList.IpAddress.String items[10].pszText = adapter_info.GatewayList.IpAddress.String items[11].pszText = adapter_info.DhcpServer.IpAddress.String items[12].pszText = repr(adapter_info.HaveWins) items[13].pszText = adapter_info.PrimaryWinsServer.IpAddress.String items[ 14].pszText = adapter_info.SecondaryWinsServer.IpAddress.String items[15].pszText = '%d' % adapter_info.LeaseObtained items[16].pszText = '%d' % adapter_info.LeaseExpires for item in items: self.list_view.SetItem(item)