winpcapy
winpcapy copied to clipboard
WinPcap - Open the right nic (Network Interface Card)
**Hi, I had on my computer 2 nics with same description. It could not distinguish between the two and opened always the first one. In winpcapy.py I saw it looks for match with the description only.
@classmethod
def get_matching_device(cls, glob=None):
for name, description in cls.list_devices().items():
if fnmatch.fnmatch(description, glob):
return name, description
return None, None
I've added a search with the name and left the search by description (for backward comparability purposes). Now you can look for your nic either with a name or with the description. Note that the name can includes the full GUID !!
@classmethod
def get_matching_device(cls, glob=None):
for name, description in cls.list_devices().items():
if fnmatch.fnmatch(name, glob) :
return name, description
for name, description in cls.list_devices().items():
if fnmatch.fnmatch(description, glob):
return name, description
return None, None