Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :local dhcpIP [/ip address get [find interface="$nameETH"] address];
- :local dhcpIP [put [:pick $dhcpIP 0 [:find $dhcpIP "/"]]];
- :local macID "00:89:f4:a1:2e:4d";
- :local wlanID "SBASBA00040/TLK-WI32385762-0001:DEWIKU@wifi.id";
- :local dhcpGW [/ip dhcp-client get [find interface="$nameETH"] gateway];
- :if ([:len $dhcpIP] = 0) do={
- :log error ("Interface $nameETH cannot obtained IP address --- refreshing...");
- /ip dhcp-client release [find interface="$nameETH"];
- };
- :if ([:len $dhcpIP] != 0) do={
- /system scheduler remove [find name="$nameSCH"];
- :log error ("DIAL UP");
- :delay 1s;
- :do {
- /tool fetch http-header-field="User-Agent: Mozilla/4.0" http-method=post http-data="username=$userlogin&password=$passlogin" url=("https://welcome2.wifi.id/wms/auth/authnew/autologin/quarantine.php\?ipc=$dhcpIP&gw_id=$GWid&client_mac=$macID&wlan=$wlanID") keep-result=no;
- :if ([/ping address=$dhcpGW interface="$nameETH" count=2] = 0) do={
- :log error ("holy sh*t! --- login failed ...");
- /ip dhcp-client release [find interface="$nameETH"];
- };
- :if ([/ping address=$dhcpGW interface="$nameETH" count=2] != 0) do={
- :log warning ("CONECTED");
- /system scheduler add name="$nameSCH" interval=30s start-date=jan/01/1970 start-time=00:00:00 on-event=":if ([/ping address=$dhcpGW interface=\"$nameETH\" count=2] = 0) do={\r\n/ip dhcp-client release [find interface=\"$nameETH\"];\r\n};\r\n"
- :local yuuy [/interface wireless get [find name="$nameETH"] comment];
- :local yuuy1 " $yuuy";
- :local yuuy2;
- :for i from=0 to=([:len $yuuy1] - 1) do={
- :local char [:pick $yuuy1 $i];
- :if ($char = " ") do={:set $char "\\ "};
- :set yuuy2 ($yuuy2 . $char);
- };
- :local commentintf $yuuy2;
- :local arraycomment [:toarray [:pick $commentintf ([:find $commentintf " "]+1) [:len $commentintf]]];
- :local comdate [:pick $arraycomment 7];
- :local comtime [:pick $arraycomment 8];
- :local date [/system clock get date];
- :local time [/system clock get time];
- :if ($yuuy = 0) do={
- /interface wireless set [find name="$nameETH"] comment="prev login: $date $time - last login: $date $time";
- };
- :if ($yuuy != 0) do={
- /interface wireless set [find name="$nameETH"] comment="prev login: $comdate $comtime - last login: $date $time";
- };
- };
- } on-error={
- :log error ("fatal error --- cannot fetch login page ...");
- /ip dhcp-client release [find interface="$nameETH"];
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement