mirror of
https://forge.katzen.cafe/schrottkatze/nix-configs.git
synced 2024-11-27 15:18:45 +01:00
41 lines
1,016 B
Plaintext
41 lines
1,016 B
Plaintext
|
def main [
|
||
|
interface: string
|
||
|
type: string
|
||
|
] {
|
||
|
if not ($type == 'up') {
|
||
|
exit
|
||
|
};
|
||
|
|
||
|
mullvad disconnect;
|
||
|
let page = http get 'http://172.0.0.1/';
|
||
|
|
||
|
let hotspot_ip = $page | htmlq 'input[name=uamip]' -a 'value';
|
||
|
let hotspot_port = $page | htmlq 'input[name=uamport]' -a 'value';
|
||
|
|
||
|
let pl_data = $page
|
||
|
| htmlq input -a name -r input[name=button]
|
||
|
| lines
|
||
|
| wrap name
|
||
|
| merge (
|
||
|
$page
|
||
|
| htmlq input -a value
|
||
|
| lines
|
||
|
| wrap value
|
||
|
)
|
||
|
| drop 1;
|
||
|
|
||
|
let payload = $pl_data
|
||
|
| each {|kv| [
|
||
|
($kv.name | url encode --all)
|
||
|
($kv.value | url encode --all) ]
|
||
|
| str join '='
|
||
|
} | str join '&';
|
||
|
|
||
|
let res = curl --insecure --resolve $"www.hotsplots.de:($hotspot_port):($hotspot_ip)" -H 'Content-Type: application/x-www-form-urlencoded' "https://www.hotsplots.de/auth/login.php" --data-raw $"($payload)" ;
|
||
|
|
||
|
let url = $res | htmlq 'meta[http-equiv=refresh]' -a 'content' | parse '0;url={url}';
|
||
|
|
||
|
http get $url.url.0;
|
||
|
mullvad connect;
|
||
|
}
|