cocotte98
Posts: 2
Joined: Fri Jan 24, 2020 11:25 am

Know who is connected to my RaspAp access point

Mon Feb 24, 2020 11:18 am

Hi everyone,

I configured my Raspberry Pi 3 A+ 2018 in hotspot access point thanks to RaspAp.
In a Python programm, I need to know if someone is connected to this hotspot.

I did lot of research on this simple question but without successing ..

Do you have an idea of how I do for find a client connected list ?

Thanks for your time.

Have a nice day !!

epoch1970
Posts: 4465
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Know who is connected to my RaspAp access point

Mon Feb 24, 2020 12:36 pm

hostapd_cli can deliver information on connected clients.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

User avatar
DougieLawson
Posts: 37586
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Know who is connected to my RaspAp access point

Mon Feb 24, 2020 12:40 pm

If you're using dnsmasq for your DHCP server it has a couple of things that might help.

1. dhcp-script=<path> which defines a script to run for a new or old DHCP lease.

2.dhcp-leasefile=<path> which defines where DHCP leases are stored.

If you know a lease was issued and the lease time you can work out when a client connected. The dhcp-script gives you something to use for your own logging. You can't tell if a DHCP client is still connected unless you can ping their IP address.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
neilgl
Posts: 1612
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near Aston Martin factory

Re: Know who is connected to my RaspAp access point

Sat Feb 29, 2020 10:45 am

I use this to see the connected devices on WiFi wlan0

Code: Select all

iw dev wlan0 station dump
. You could adjust it to be in a python script?

cocotte98
Posts: 2
Joined: Fri Jan 24, 2020 11:25 am

Re: Know who is connected to my RaspAp access point

Mon Mar 02, 2020 8:41 am

Hi !

Thanks for answer, while searching for "hostapd_cli" I felt on "iw dev wlan0 station dump" and that works!!

Very helpfull

Have a nice day

Return to “Python”