0% found this document useful (0 votes)
90 views2 pages

WMS WiFi Auto-Reconnect Script

The document contains local variables and code to automatically reconnect a WiFi connection if ping tests fail by disabling/enabling the interface, fetching an authentication URL, and logging the results. It will retry up to 3 times and include mac/ip addresses and authentication details in the logs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
90 views2 pages

WMS WiFi Auto-Reconnect Script

The document contains local variables and code to automatically reconnect a WiFi connection if ping tests fail by disabling/enabling the interface, fetching an authentication URL, and logging the results. It will retry up to 3 times and include mac/ip addresses and authentication details in the logs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

:local currentQueue 0;

:local nolock true;


:local gurl "[Link]
:local guxx "[Link]
:local username "";
:local password "";
:local int "wms2";
:local gwp "WAG-D5-RKT";
:local mdlan "MRMJS00101-N/TLK-CI-99984:CANDRA_INTERNET@[Link]";
:local type "WMS";

:while (true) do={


:do {
:delay 15s;
:if ([/ping address=[Link] count=1] = 0) do={
:set currentQueue ($currentQueue +1);

:if ($currentQueue > 3) do={


:if (nolock) do={
:set nolock false;

:global gip [/ip address get [/ip address find interface=$int] address];
:global gip [put [:pick $gip 0 [:find $gip "/"]]];
:global gmc [/interface wireless get $int mac-address];
:global vrab "ipc=$gip&gw_id=$gwp&mac=$gmc&redirect=$guxx&wlan=$mdlan";
:global url "$gurl/authnew/login/check_login.php\?$vrab";
:global post "username=$username@spin2&password=$password";

:if ($type = "WMS") do={


:set username "azmiyah"
:set password "azmiyah"
:set url "$gurl/wms/auth/authnew/autologin/[Link]\?$vrab"
:set post
"username_=$username&[email protected]&password=$password"
};

log warning ("Internet Mati Memulai Koneksi Ulang | $gip | $gmc | $type |
$currentQueue");
:set currentQueue 0;

:do {
/interface disable $int
:delay 15s;
/interface enable $int
:delay 15s
} on-error={
log warning ("Error set");
};

:do {
:local result [/tool fetch http-method=post http-data=$post url=$url http-
header-field="User-Agent: Mozilla/5.0" as-value output=user];
:if ([:find ($result->"data") "Sukses"] >= 0) do={
log info ("WIFI Kembali Normal")
} else={
:if (($result->"data") = "") do={
log info ("Wifi sudah konek");
} else={
log warning ($result->"data")
};
};
} on-error={
log warning ("Error Cek Internet");
};

:set nolock true;

} else={
log warning ("Lock Proses");
};

};

} else {
# log info ("Wifi Normal");
:set currentQueue 0;
};

} on-error={
log warning ("Error big");
:set currentQueue ($currentQueue +1);
};
}

You might also like