captive is a tiny cmdline tool to check if the system it is running on has working Internet access. Useful to detect captive portals on public WiFis and corporate networks. Checks http://captive.apple.com (which powers the Captive Portal Assistant on Apple devices).
Intended to be used in shell scripts: Single binary/no dependencies, cross-platform and returns the online status as exit code.
Run captive (there are no parameters). It will return with exit code 0 when online or exit code 1 when offline.
$ captive
online
$ echo $? #check exit code
0
$ ifconfig eth0 down #break Internet connection
$ captive
offline
$ echo $? #check exit code
1
docker run --rm chko/captive
Content type
Image
Digest
Size
3.6 MB
Last updated
over 6 years ago
docker pull chko/captive