Skip to content

Instantly share code, notes, and snippets.

@khnwr
Created June 19, 2021 17:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save khnwr/1869a0d8c40076acdeccb8ae1062cf30 to your computer and use it in GitHub Desktop.
Save khnwr/1869a0d8c40076acdeccb8ae1062cf30 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Auto login venue wms password only
x=`ping -c1 8.8.8.8 2>&1 | grep 100%`
if [ ! "$x" = "" ]; then
echo "Gagal ping 8.8.8.8, mencoba restart interfave WWAN"
ifup wwan && echo "interface WWAN sukses direstart." || echo "Interface WWAN gagal di restart."
sleep 10
landing_url=$(curl -Ls -H "$ua" -o ./landing_page.html -w %{url_effective} http://8.8.8.8)
echo "landing_url: $landing_url"
username="koncobolo22"
password="koncobolo22"
ua="User-Agent: Mozilla/5.0 (Linux; Android 6.0; Redmi Note 4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.181 Mobile Safari/537.36"
autologin_time="86000"
auth_base_url="https://welcome2.wifi.id/wms/"
auth_url=$auth_base_url$(cat ~//landing_page.html | grep -o -P "(?<=url: ').*(?=',)")
wms_id="@wms"$(cat ~//landing_page.html | grep -o -P "(?<=@wms).*(?='\))")
echo "LOG AUTO LOGIN"
echo "auth_base_url: $auth_base_url"
echo "auth_url: $auth_url"
echo "wms_id: $wms_id"
rand_key=$(openssl rand -hex 2)
username_key=$username"."$rand_key$wms_id
echo "username_key:$username_key"
data="username_=$username&autologin_time=$autologin_time&username=$username_key&password=$password"
echo "Post data \"$data\""
curl -v -H "Referer: $landing_url" -H "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" -H "$ua" -o ./login_result.txt -X POST -d "$data" "$auth_url"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment