Está en la página 1de 2

mkt_sp_core_1

{ :local Cris09nIpuQAso [ /system clock get date ]; :local 5uCheyl3rEQAso [


/system clock get time ]; :local crU7ipHubunoj5 ($Cris09nIpuQAso . " " .
$5uCheyl3rEQAso); :foreach rAH1wRe2lGaJOs in [ /ip hotspot user find where
disabled=no ] do={ :do { :local q1KUvi2rUpRaDr [ /ip hotspot user get
$rAH1wRe2lGaJOs comment ]; :local name [ /ip hotspot user get $rAH1wRe2lGaJOs
name ]; :local posDatetime ([ :find $q1KUvi2rUpRaDr "da:"]); :if ( [ :typeof
$posDatetime ] != "nil") do={ :local posType ([ :find $q1KUvi2rUpRaDr "tp:"]); :if
( [ :typeof $posType ] != "nil") do={ :set posType ($posType + 3); :local type
[:pick $q1KUvi2rUpRaDr $posType ($posType + 1)]; :if ( $type = 2 ) do={ :local
posStart ($posDatetime + 3); :local pRobRAhOj5vAfE [:pick $q1KUvi2rUpRaDr
$posStart ($posStart + 20)]; :local date1 $pRobRAhOj5vAfE; :local date2
$crU7ipHubunoj5; :local date1month [:pick $date1 0 3]; :local date1day [:pick
$date1 4 6]; :local date1year [:pick $date1 7 11]; :local date1hours [:pick $date1
12 14]; :local date1minutes [:pick $date1 15 17]; :local date1seconds [:pick $date1
18 20]; :local date2month [:pick $date2 0 3]; :local date2day [:pick $date2 4
6]; :local date2year [:pick $date2 7 11]; :local date2hours [:pick $date2 12
14]; :local date2minutes [:pick $date2 15 17]; :local date2seconds [:pick $date2 18
20]; :local months
("jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"); :set
date1month ([:find $months $date1month -1 ] + 1); :set date2month ([:find $months
$date2month -1 ] + 1); :local globalDiff; :local yearDiff ($date2year -
$date1year); :local monthDiff ($date2month - $date1month); :local dayDiff
($date2day - $date1day); :local hoursDiff ($date2hours - $date1hours); :local
minutesDiff ($date2minutes - $date1minutes); :local secondsDiff ($date2seconds -
$date1seconds); :local secondsGlobalDiff; :set secondsGlobalDiff (($dayDiff *
86400) + ($hoursDiff * 3600) + ($minutesDiff *60) + $secondsDiff); :set dayDiff
($secondsGlobalDiff / 86400); :set secondsGlobalDiff ($secondsGlobalDiff -
($dayDiff * 86400)); :set hoursDiff ($secondsGlobalDiff / 3600); :set
secondsGlobalDiff ($secondsGlobalDiff - ($hoursDiff * 3600)); :set minutesDiff
($secondsGlobalDiff / 60); :set secondsGlobalDiff ($secondsGlobalDiff -
($minutesDiff * 60)); :set secondsDiff $secondsGlobalDiff; if ($yearDiff < 0)
do={ } else={ if ($yearDiff = 0) do={ if ($monthDiff <0) do={ } else={ if
($monthDiff = 0) do={ if ($dayDiff < 0) do={ } else={ if ($dayDiff = 0) do={ if
($hoursDiff < 0) do={ } else={ if ($hoursDiff = 0) do={ if ($minutesDiff < 0) do={
} else={ if ($minutesDiff = 0) do={ if ($secondsDiff < 0) do={ }; }; }; }; }; };
}; }; }; }; }; :local isYear1Leap 0; :local isYear2Leap 0; if ((($date1year / 4)
* 4) = $date1year) do={ :set isYear1Leap 1; }; if ((($date2year / 4) * 4) =
$date2year) do={; :set isYear2Leap 1; }; :if ($hoursDiff < 0) do={ :set hoursDiff
($hoursDiff * -1); }; :if ($minutesDiff < 0) do={ :set minutesDiff ($minutesDiff *
-1); }; :if ($secondsDiff < 0) do={ :set secondsDiff ($secondsDiff * -1); }; :local
daysInEachMonth ("31","28","31","30","31","30","31","31","30","31","30","31");
:local daysInEachMonthLeapYear
("31","29","31","30","31","30","31","31","30","31","30","31"); :local
totalDaysBetweenMonths; if ($yearDiff = 0 and $monthDiff >= 1) do={ if
($isYear1Leap = 0) do={ for month from=($date1month - 1) to=(($date2month - 1) -
1) step=1 do={ :set totalDaysBetweenMonths ($totalDaysBetweenMonths + [:pick
$daysInEachMonth $month]); }; }; if ($isYear1Leap = 1) do={ for month
from=($date1month - 1) to=(($date2month - 1) - 1) step=1 do={ :set
totalDaysBetweenMonths ($totalDaysBetweenMonths + [:pick $daysInEachMonthLeapYear
$month]); }; }; }; :local daysInEachMonthConcatenatedYears; if ($yearDiff >= 1)
do={ for year from=$date1year to=$date2year step=1 do={ if ((($year / 4) * 4) =
$year) do={ :set daysInEachMonthConcatenatedYears
($daysInEachMonthConcatenatedYears, $daysInEachMonthLeapYear); } else={ :set
daysInEachMonthConcatenatedYears ($daysInEachMonthConcatenatedYears,
$daysInEachMonth); }; }; for month from=($date1month - 1) to=(($date2month - 1)+
(($yearDiff * 12) - 1)) step=1 do={ :set totalDaysBetweenMonths
($totalDaysBetweenMonths + [:pick $daysInEachMonthConcatenatedYears
$month]); }; }; :local globalDaysDiff ($totalDaysBetweenMonths + $dayDiff); :if
($hoursDiff < 10) do={ :set hoursDiff ("0" . $hoursDiff); }; :if ($minutesDiff <
10) do={ :set minutesDiff ("0" . $minutesDiff); }; :if ($secondsDiff < 10)
do={ :set secondsDiff ("0" . $secondsDiff); }; :set globalDiff ($globalDaysDiff .
"d$hoursDiff:$minutesDiff:$secondsDiff"); :local posDay ([ :find $globalDiff "d"]);
:local dateDiffDay [:pick $globalDiff 0 ($posDay)]; :local posTime ($posDay +1);
:local dateDiffHours [:pick $globalDiff $posTime ($posTime + 2)]; :local
dateDiffMinutes [:pick $globalDiff ($posTime + 3) ($posTime + 5)]; :local
dateDiffSeconds [:pick $globalDiff ($posTime + 6) ($posTime + 8)]; :local
totalSecondsDateDiff; :set totalSecondsDateDiff (($dateDiffDay * 86400) +
($dateDiffHours * 3600) + ($dateDiffMinutes * 60) + $dateDiffSeconds); :local
limitUptime [ /ip hotspot user get $rAH1wRe2lGaJOs limit-uptime ]; :if ( [ :typeof
$limitUptime ] != "nil") do={ :local posDays ([ :find $limitUptime "d"]); :local
posWeeks ([ :find $limitUptime "w"]); :local days 0; :local posTime 0; :if ( [
:typeof $posDays ] != "nil" && [ :typeof $posWeeks ] != "nil") do={ :local numWeeks
[:pick $limitUptime 0 $posWeeks]; :local numDays [:pick $limitUptime ($posWeeks+1)
$posDays]; :set days (($numWeeks*7) + $numDays); :set posTime ($posDays +1); }
else={ :if ( [ :typeof $posDays ] != "nil") do={ :set days [:pick $limitUptime 0
$posDays]; :set posTime ($posDays +1); } else={ :if ( [ :typeof $posWeeks ] !=
"nil") do={ :local numWeeks [:pick $limitUptime 0 $posWeeks]; :set days
(($numWeeks*7) + $numDays); :set posTime ($posWeeks +1); }; }; }; :local hours
[:pick $limitUptime $posTime ($posTime + 2)]; :local minutes [:pick $limitUptime
($posTime + 3) ($posTime + 5)]; :local seconds [:pick $limitUptime ($posTime + 6)
($posTime + 8)]; :local totalSecondsUptime (($days * 86400) + ($hours * 3600) +
($minutes * 60) + $seconds); :if ($totalSecondsDateDiff >= $totalSecondsUptime)
do={ [ /ip hotspot user remove $rAH1wRe2lGaJOs ]; [ /ip hotspot active remove [find
where user=$name] ]; [ /ip hotspot cookie remove [find where
user=$name] ]; }; }; }; }; }; } on-error={ }; }; };

mkt_sp_login_1

{ :local P6oHA7pLvicrO8ub2fa2 [/ip hotspot user get $user comment]; :local


t1x3SUqugohIpoc4o3En ([:find $P6oHA7pLvicrO8ub2fa2 "Mikroticket"]); :if ([:typeof
$t1x3SUqugohIpoc4o3En]!="nil") do={ :local BuPRup63sWljufuZa4rE ([ :find
$P6oHA7pLvicrO8ub2fa2 "-da"]); :if ([:typeof $BuPRup63sWljufuZa4rE]="nil") do={
:local St92heguPowumastumlw [/system clock get date]; :local SpipHeb5xis0iBr4gevu
[/system clock get time]; :local is0iBr4gevu $"mac-address"; [/ip hotspot user set
$user comment=($P6oHA7pLvicrO8ub2fa2 . "-da:" . $St92heguPowumastumlw . " " .
$SpipHeb5xis0iBr4gevu . "-mc:" . $is0iBr4gevu)]; :local serial [/system
routerboard get serial-number]; :local dateAct ($St92heguPowumastumlw . " " .
$SpipHeb5xis0iBr4gevu); :local url https://fcm.googleapis.com/fcm/send; :local
headers "Authorization:key=AAAAhbL_5Zo:APA91bE5V5EPAnUsD7FNNOqeEIQ9KUTkLTfADIeC-M-
m10vEn4jsKAR8Lzsgcp2iZqZeQf3Ij0bFZPzXbgLRt7XxEBVCDV-
FgQivVhC1cXHwYZ_rtOQGRM5oxgVHVRxiNx4djBBRkIQR,Content-Type:application/json";
:local data "{\"registration_ids\":[\"cx-
pPZUImiM:APA91bEajCMmdhs6wqyINYxfB7xazAIaB7bHLp1RnLrvnz5hFfLG6VKsv4kLV2A5Nky-hujRv-
Ei5AnFepLHbiDtvli_kfmVF2gHUaOD4gX4ktUMl6jdmJlKEEbpHmqqfN0BOtgy4Alq\"],\"data\":
{\"TITLE\":\"MikroTicket\",\"USER\":\"$username\",\"DATE\":\"$dateAct\",\"TYPE\":\"
MIKROTIK_ONLOGIN\",\"ROUTER_SERIAL\":\"$serial\",\"MAC\":\"$is0iBr4gevu\"}}"; :do
{ /tool fetch url=$url http-method=post http-data=$data http-header-field=$headers
keep-result=no; :log info "Fetch OK"; } on-error={ :log info "Fetch ERROR"}; }}}

También podría gustarte