When an external WIFI adaptor is plugged into a Pi and the PI boots, there are 2 network connections listed:
wlan0 and wlan1. The trouble is, it seems to be arbitrary which is assigned to the internal network card, and which is assigned to the external card: sometimes the internal card gets wlan0, and sometimes the external card.
One way round this is to disable the internal network adaptor, then wlan0 will always be the external network adaptor. Problem here is you might need both, for example the external might be in monitor mode with Kismet, and the internal used to wirelessly connect to the Raspberry Pi and read the collected data remotely.
Another way is to switch on predictable network connections or whatever it's called, and get the MAC address of the network adaptor appended to the network connection. I have trouble with this when you use airmon-ng to put the card into monitor mode.
QUESTION: Given a network connection reference like wlan0, is there a way to find out the hardware it's bound to? Ideally, I'd like to write a Python script that would, given a network connection, tell you the hardware it was associated with.
lsusb gives you the connected USB hardware. Would it be possible given this to find by a combination of ifconfig and iwconfig etc, the given WIFI card hardware?
Something like: getWlanHardwareRef("wlan0", "Ralink123.xxxx") true true if wlan0 is bound to a WIFI adaptor with hardware reference "RAlink123.xxxx", false if not.
Then you could call this for all the given network connections available and determine which was the external card.
I'm not asking for the Python script, but a suggestion as to commands that could be called to return the network connection associated with specific USB adaptor hardware.
Any ideas anyone?