0

I'm using hostApd to develop a captive portal. My machine provides à Wifi (password free), and I plan the clients to get a popup saying "hello". You know, like the popup of wifi providers, asking for credits or login...

(note: I want to open my machine local website when clients - iPad clients btw - connect the wifi. I don't care of making them pay or login).

How can I do such a thing, please ? One says the OS detects it by tryoing to ping google.com or so on, if not, it knows the portail is captive and display a html popup. Which url ? ...

Thanks

ArchiT3K
  • 577
  • See for related answer https://unix.stackexchange.com/questions/212871/captive-portal-detection-popup-implementation/421402#421402 – Rui F Ribeiro Feb 02 '18 at 19:49

2 Answers2

1

Please also investigate (and participate in) the IETF CAPPORT WG. https://datatracker.ietf.org/wg/capport/about/

New ICMPs, HTTP replies and DHCP responses will become available. As the Internet moves to HTTPS, many current methods will cease to work.

mcr
  • 153
  • 7
  • Indeed it is happening https://unix.stackexchange.com/questions/212871/captive-portal-detection-popup-implementation/421402#421402 +1 – Rui F Ribeiro Feb 02 '18 at 19:48
0
if ping -q -w 1 -c 1 $(ip r | grep default | cut -d ' ' -f 3) > /dev/null; then
    wget "http://clients3.google.com/generate_204?" -O /dev/null 2>&1 | grep "204 No Content" > /dev/null
    if [[ $? -ne 0 ]]; then
      # Perform login
    fi
fi

Reference:

  • thanks a lot, but this works only for Android, am i right ? and shouldnt the OS, by not getting 204 Ok, detect it is captive ? --- anyway, i can intercept ping, and then ?... I cannot enforce Android to display the splash... thanks though – ArchiT3K Jun 30 '15 at 10:22