Skip to content

Instantly share code, notes, and snippets.

@akbaryahya
Last active November 13, 2023 13:38
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 9 You must be signed in to fork a gist
  • Save akbaryahya/c0b0d937473a757e5867134ea5532a6c to your computer and use it in GitHub Desktop.
Save akbaryahya/c0b0d937473a757e5867134ea5532a6c to your computer and use it in GitHub Desktop.
Script Auto Login Wifi.id dengan Mikrotik
:local currentQueue 0;
:local nolock true;
:local gurl "https://welcome2.wifi.id";
:local guxx "http://www.msftconnecttest.com/redirect";
:local username "";
:local password "";
:local int "WIFI";
:local gwp "WAG-DX-PTR";
:local mdlan "MSTMA000xx-N/TLK-CI-xx33x:xxx";
:local type "WzMS";
:while (true) do={
:do {
:delay 10;
:if ([/ping address=8.8.8.8 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 "xxx"
:set password "xxx"
:set url "$gurl/wms/auth/authnew/autologin/quarantine.php\?$vrab"
:set post "username_=$username&username=$username.uZLs%40freeMS&password=$password"
};
log warning ("Internet Mati Memulai Koneksi Ulang | $gip | $gmc | $type | $currentQueue");
:set currentQueue 0;
:do {
/interface disable $int
:delay 5;
/interface enable $int
:delay 10
} on-error={
log warning ("Error set");
};
:do {
:local result [/tool fetch http-method=post http-data=$post url=$url http-header-field="User-Agent: Indihomo" 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);
};
}
@Choirrulloh
Copy link

Terima kasih mas, scriptnya work.

Ini jika saya perhatikan kurang lebih 1 menit pengecekan scriptnya. Bisakah saya ubah menjadi 10 detik?

@DzikrRully
Copy link

Om, bagaimana untuk login pakai komunitas smartbisnis?

@tatangsy
Copy link

mas kira yang dirubahnya apa saja ya..
maaf saya orang yg masih awam..
terima kasih

@tony-el
Copy link

tony-el commented Oct 31, 2020

masih work kah??

@Tjandra-91
Copy link

maksih bang scr-nya mantap tapi setelah beberapa minggu
log warningnya LOCK PROSES dan jadi g conenct gmna itu bang ya??
barang kali ada ada pencerahannnya bang akbar

@WhyredHuang
Copy link

Thanks Bro, Script ini masih work (Voucer Wifi.id & SmartBisnis) & hanya butuh beberapa edit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment