nix-configs/other/scripts/networkhooks/WIFIonICE.nu

23 lines
924 B
Plaintext
Raw Permalink Normal View History

2023-10-28 22:25:06 +02:00
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p curl htmlq
# echo "Fetching cookie and CSRF token..."
# form=$(curl --silent --location --junk-session-cookies --cookie-jar /tmp/wifionice "https://login.wifionice.de/en/" --resolve login.wifionice.de:443:10.101.64.10 -i | htmlq "input")
# keys=$(htmlq "input" --attribute "name" <<< "$form")
# values=$(htmlq "input" --attribute "value" <<< "$form")
# payload=$(paste --delimiters="=" <(echo "$keys") <(echo "$values") | tr "\n" "&")
# echo "Payload: \"$payload\""
# echo "POSTing payload..."
# curl --cookie /tmp/wifionice "https://login.wifionice.de/en/" --resolve login.wifionice.de:443:10.101.64.10 -d "$payload"
def main [
interface: string
type: string
] {
let form = curl --silent --location --junk-session-cookies --cookie-jar /tmp/wifionice 'https://login.wifionice.de/en/' --resolve 'login.wifionice.de:443:10.101.64.10' -i | htmlq 'input';
# TODO
}