rewrite networking modules
This commit is contained in:
parent
49298541e5
commit
0bbb0aa204
11 changed files with 69 additions and 71 deletions
40
modules/net/dispatchers/hooks/WIFI@DB.nu
Executable file
40
modules/net/dispatchers/hooks/WIFI@DB.nu
Executable file
|
@ -0,0 +1,40 @@
|
|||
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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue