I'm building an email sending software and user's requirement is, this program would be able to get and change the MAC address of the system. I searched over internet and found how can we get MAC address using java. Here I found a sample code that list all MAC addresses of the system. Using this code I have my output like this.
Current IP address : 169.254.74.152
Current MAC address : 00-27-10-52-D6-49
Current MAC address : 70-F3-95-82-2A-85
Current MAC address : 0A-00-27-00-00-11
Current MAC address : 0A-00-27-00-00-12
Current MAC address : 00-27-10-52-D6-48
BUILD SUCCESSFUL (total time: 2 seconds)
This output include MAC addresses of
1. Wireless LAN adapter WiFi
2. Wireless LAN adapter Local Area connection
3. Ethernet adapter Bluetooth
4. Ethernet adapter Virtual-box
It shows the same output irrespective of whether I'm connected to internet or not. So my question is how can I determine the one I'm connected with i.e. If I'm connected and using WiFi internet I need WiFi MAC and if I'm connected using Network Cable I need that.
And also tell how to change/spoof that MAC address using Java.