Getting MAC address in Android 6.0

Please refer to Android 6.0 Changes. To provide users with greater data protection, starting in this release, Android removes programmatic access to the device’s local hardware identifier for apps using the Wi-Fi and Bluetooth APIs. The WifiInfo.getMacAddress() and the BluetoothAdapter.getAddress() methods now return a constant value of 02:00:00:00:00:00. To access the hardware identifiers of nearby … Read more

How to get MAC address of your machine using a C program?

Much nicer than all this socket or shell madness is simply using sysfs for this: the file /sys/class/net/eth0/address carries your mac adress as simple string you can read with fopen()/fscanf()/fclose(). Nothing easier than that. And if you want to support other network interfaces than eth0 (and you probably want), then simply use opendir()/readdir()/closedir() on /sys/class/net/.

Programmatically getting the MAC of an Android device

As was already pointed out in the comment, the MAC address can be received via the WifiManager. WifiManager manager = (WifiManager) getSystemService(Context.WIFI_SERVICE); WifiInfo info = manager.getConnectionInfo(); String address = info.getMacAddress(); Also do not forget to add the appropriate permissions into your AndroidManifest.xml <uses-permission android:name=”android.permission.ACCESS_WIFI_STATE”/> Please refer to Android 6.0 Changes. To provide users with greater … Read more

Why do some mac-addresses repeat so often?

This example in particular (58-2C-80-13-92-63) is a USB Ethernet chip made by Huawei. Looks like they’re being lazy and reusing the MAC. Examples from Google: [50413.229125] cdc_ether 2-1:1.0: eth1: register ‘cdc_ether’ at usb-0000:00:1d.7-1, CDC Ethernet Device, 58:2c:80:13:92:63 … [ 122.660069] huawei_cdc_ncm 3-3:1.1 wwan0: register ‘huawei_cdc_ncm’ at usb-0000:00:14.0-3, Huawei CDC NCM device, 58:2c:80:13:92:63 The others could … Read more

MAC addresses in JavaScript

I concur with all the previous answers that it would be a privacy/security vulnerability if you would be able to do this directly from Javascript. There are two things I can think of: Using Java (with a signed applet) Using signed Javascript, which in FF (and Mozilla in general) gets higher privileges than normal JS … Read more