Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wi-Fi tethering - how to get list of connected clients

Is there any way to get a the list of connected MAC addresses when my phone is on Wi-Fi tethering mode?

like image 796
Fiur Avatar asked Apr 03 '12 15:04

Fiur


2 Answers

Firstly, you must have a rooted device. When it's done just read dnsmasq.leases file. Usually it is placed at: /data/misc/dhcp/dnsmasq.leases. A structure of the file is pretty simple - each line is a summary of a connected user. The summary has several fields including MAC. I didn't find a possibility to get MAC without root. Please correct me if I'm wrong.

like image 172
Pavel Avatar answered Oct 20 '22 07:10

Pavel


Reading /proc/net/arp would provide the information for both static and DHCP clients that have communicated with the device during the last 60 seconds (configured in /proc/sys/net/ipv4/neigh/wl0.1/gc_stale_time where wl0.1 is the wireless network interface on my phone).

It is available for non-root users too.

like image 41
Roman Avatar answered Oct 20 '22 08:10

Roman