Advertisement
quetree

Untitled

Aug 24th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.31 KB | None | 0 0
  1. :local dhcpIP [/ip address get [find interface="$nameETH"] address];
  2. :local dhcpIP [put [:pick $dhcpIP 0 [:find $dhcpIP "/"]]];
  3. :local macID "00:89:f4:a1:2e:4d";
  4. :local wlanID "SBASBA00040/TLK-WI32385762-0001:DEWIKU@wifi.id";
  5.  
  6. :local dhcpGW [/ip dhcp-client get [find interface="$nameETH"] gateway];
  7. :if ([:len $dhcpIP] = 0) do={
  8. :log error ("Interface $nameETH cannot obtained IP address --- refreshing...");
  9. /ip dhcp-client release [find interface="$nameETH"];
  10. };
  11. :if ([:len $dhcpIP] != 0) do={
  12. /system scheduler remove [find name="$nameSCH"];
  13. :log error ("DIAL UP");
  14. :delay 1s;
  15. :do {
  16. /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;
  17. :if ([/ping address=$dhcpGW interface="$nameETH" count=2] = 0) do={
  18. :log error ("holy sh*t! --- login failed ...");
  19. /ip dhcp-client release [find interface="$nameETH"];
  20. };
  21. :if ([/ping address=$dhcpGW interface="$nameETH" count=2] != 0) do={
  22. :log warning ("CONECTED");
  23. /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"
  24. :local yuuy [/interface wireless get [find name="$nameETH"] comment];
  25. :local yuuy1 " $yuuy";
  26. :local yuuy2;
  27. :for i from=0 to=([:len $yuuy1] - 1) do={
  28. :local char [:pick $yuuy1 $i];
  29. :if ($char = " ") do={:set $char "\\ "};
  30. :set yuuy2 ($yuuy2 . $char);
  31. };
  32. :local commentintf $yuuy2;
  33. :local arraycomment [:toarray [:pick $commentintf ([:find $commentintf " "]+1) [:len $commentintf]]];
  34. :local comdate [:pick $arraycomment 7];
  35. :local comtime [:pick $arraycomment 8];
  36. :local date [/system clock get date];
  37. :local time [/system clock get time];
  38. :if ($yuuy = 0) do={
  39. /interface wireless set [find name="$nameETH"] comment="prev login: $date $time - last login: $date $time";
  40. };
  41. :if ($yuuy != 0) do={
  42. /interface wireless set [find name="$nameETH"] comment="prev login: $comdate $comtime - last login: $date $time";
  43. };
  44. };
  45. } on-error={
  46. :log error ("fatal error --- cannot fetch login page ...");
  47. /ip dhcp-client release [find interface="$nameETH"];
  48. };
  49. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement