Coder Social home page Coder Social logo

janisstreib / captive.d Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 1.0 7 KB

A collection of (shell) scripts for captive portal logins

License: BSD 3-Clause "New" or "Revised" License

Python 93.67% Shell 6.33%
captive-portal wifi network-manager wifionice oebb avm

captive.d's Introduction

captive.d

captive.d is a collection of scripts to log in to captive portals automatically.

Feel free to PR additional scripts.

Dependencies

Some scripts are implemented using bash and curl. Others require more complex oprtations and are implememted in python3 using requests and BeautifulSoup 4 (bs4).

Integration in dispatcher.d (example)

> cat /etc/NetworkManager/dispatcher.d/02-captive
#!/bin/bash
INTERFACE=$1
STATE=$2
if [[ $INTERFACE = 'wlp3s0' &&  $STATE = 'up' ]]; then
	PORTALCHECK=`curl http://portalcheck.yellowant.de`
	if [[ "$PORTALCHECK" != "success" ]]; then
		echo "Captive Portal detected!"
		SSID=`nmcli -t -f active,ssid dev wifi | egrep '^yes' | cut -d: -f2`
		echo "SSID: $SSID"
		if [[ -f "/etc/NetworkManager/dispatcher.d/captive.d/${SSID}" ]]; then
			if [[ "$SSID" =~ [a-zA-Z0-9\!-:space:]* ]]; then
				echo "Running command \"/etc/NetworkManager/dispatcher.d/captive.d/$SSID\""
				. "/etc/NetworkManager/dispatcher.d/captive.d/$SSID"
              			  # Optional: connect to VPN
              			  # nmcli connection up vpn
			else
				echo "Invalid SSID!"
			fi
		else
			echo "No profile found."
		fi
	fi
fi

captive.d's People

Contributors

felixdoerre avatar janisstreib avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

felixdoerre

captive.d's Issues

LICENSE/COPYING

Hi,
I find your snippets great! Can you please add license or copying file so I can write a small package for my distribution?

Kind regards,
Nils

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.