Mikrotik Rambo Script

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 8

/interface ovpn-client

add connect-to=sg-3.hostddns.us mac-address=02:11:37:B5:B0:13 name=ovpn-out1 \


password=R1i2c3022908 [email protected]
/interface bridge
add admin-mac=E4:8D:8C:CF:2F:2D auto-mac=no comment=defconf name=bridge
add name=bridgeHS
/interface wireless
set [ find default-name=wlan1 ] antenna-gain=2 band=2ghz-onlyn country=\
philippines disabled=no distance=indoors frequency=2462 frequency-mode=\
regulatory-domain installation=indoor mode=ap-bridge ssid="Rmabo Hotspot" \
wireless-protocol=802.11
/interface list
add comment=defconf name=WAN
add comment=defconf name=LAN
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip hotspot profile
add dns-name=rik.com hotspot-address=10.0.0.1 name=hsprof1
/ip hotspot user profile
set [ find default=yes ] on-login=":put (\",remc,0,30d,0,,Disable,\"); {:local\
\_date [ /system clock get date ];:local year [ :pick \$date 7 11 ];:local\
\_month [ :pick \$date 0 3 ];:local comment [ /ip hotspot user get [/ip ho\
tspot user find where name=\"\$user\"] comment]; :local ucode [:pic \$comm\
ent 0 2]; :if (\$ucode = \"vc\" or \$ucode = \"up\" or \$comment = \"\") d\
o={ /sys sch add name=\"\$user\" disable=no start-date=\$date interval=\"3\
0d\"; :delay 2s; :local exp [ /sys sch get [ /sys sch find where name=\"\$\
user\" ] next-run]; :local getxp [len \$exp]; :if (\$getxp = 15) do={ :loc\
al d [:pic \$exp 0 6]; :local t [:pic \$exp 7 16]; :local s (\"/\"); :loca\
l exp (\"\$d\$s\$year \$t\"); /ip hotspot user set comment=\$exp [find whe\
re name=\"\$user\"];}; :if (\$getxp = 8) do={ /ip hotspot user set comment\
=\"\$date \$exp\" [find where name=\"\$user\"];}; :if (\$getxp > 15) do={ \
/ip hotspot user set comment=\$exp [find where name=\"\$user\"];}; /sys sc\
h remove [find where name=\"\$user\"]; :local mac \$\"mac-address\"; :loca\
l time [/system clock get time ]; /system script add name=\"\$date-|-\$tim\
e-|-\$user-|-0-|-\$address-|-\$mac-|-30d-|-default-|-\$comment\" owner=\"\
\$month\$year\" source=\$date comment=mikhmon}}" parent-queue=none \
transparent-proxy=yes
add name=1H on-login=":put (\",remc,5,1h,5,,Disable,\"); {:local date [ /syste\
m clock get date ];:local year [ :pick \$date 7 11 ];:local month [ :pick \
\$date 0 3 ];:local comment [ /ip hotspot user get [/ip hotspot user find \
where name=\"\$user\"] comment]; :local ucode [:pic \$comment 0 2]; :if (\
\$ucode = \"vc\" or \$ucode = \"up\" or \$comment = \"\") do={ /sys sch ad\
d name=\"\$user\" disable=no start-date=\$date interval=\"1h\"; :delay 2s;\
\_:local exp [ /sys sch get [ /sys sch find where name=\"\$user\" ] next-r\
un]; :local getxp [len \$exp]; :if (\$getxp = 15) do={ :local d [:pic \$ex\
p 0 6]; :local t [:pic \$exp 7 16]; :local s (\"/\"); :local exp (\"\$d\$s\
\$year \$t\"); /ip hotspot user set comment=\$exp [find where name=\"\$use\
r\"];}; :if (\$getxp = 8) do={ /ip hotspot user set comment=\"\$date \$exp\
\" [find where name=\"\$user\"];}; :if (\$getxp > 15) do={ /ip hotspot use\
r set comment=\$exp [find where name=\"\$user\"];}; /sys sch remove [find \
where name=\"\$user\"]; :local mac \$\"mac-address\"; :local time [/system\
\_clock get time ]; /system script add name=\"\$date-|-\$time-|-\$user-|-5\
-|-\$address-|-\$mac-|-1h-|-1H-|-\$comment\" owner=\"\$month\$year\" sourc\
e=\$date comment=mikhmon}}" parent-queue=none transparent-proxy=yes
add name=3H on-login=":put (\",remc,10,3h,10,,Disable,\"); {:local date [ /sys\
tem clock get date ];:local year [ :pick \$date 7 11 ];:local month [ :pic\
k \$date 0 3 ];:local comment [ /ip hotspot user get [/ip hotspot user fin\
d where name=\"\$user\"] comment]; :local ucode [:pic \$comment 0 2]; :if \
(\$ucode = \"vc\" or \$ucode = \"up\" or \$comment = \"\") do={ /sys sch a\
dd name=\"\$user\" disable=no start-date=\$date interval=\"3h\"; :delay 2s\
; :local exp [ /sys sch get [ /sys sch find where name=\"\$user\" ] next-r\
un]; :local getxp [len \$exp]; :if (\$getxp = 15) do={ :local d [:pic \$ex\
p 0 6]; :local t [:pic \$exp 7 16]; :local s (\"/\"); :local exp (\"\$d\$s\
\$year \$t\"); /ip hotspot user set comment=\$exp [find where name=\"\$use\
r\"];}; :if (\$getxp = 8) do={ /ip hotspot user set comment=\"\$date \$exp\
\" [find where name=\"\$user\"];}; :if (\$getxp > 15) do={ /ip hotspot use\
r set comment=\$exp [find where name=\"\$user\"];}; /sys sch remove [find \
where name=\"\$user\"]; :local mac \$\"mac-address\"; :local time [/system\
\_clock get time ]; /system script add name=\"\$date-|-\$time-|-\$user-|-1\
0-|-\$address-|-\$mac-|-3h-|-3H-|-\$comment\" owner=\"\$month\$year\" sour\
ce=\$date comment=mikhmon}}" parent-queue=none transparent-proxy=yes
add name=4H on-login=":put (\",remc,15,4h,15,,Disable,\"); {:local date [ /sys\
tem clock get date ];:local year [ :pick \$date 7 11 ];:local month [ :pic\
k \$date 0 3 ];:local comment [ /ip hotspot user get [/ip hotspot user fin\
d where name=\"\$user\"] comment]; :local ucode [:pic \$comment 0 2]; :if \
(\$ucode = \"vc\" or \$ucode = \"up\" or \$comment = \"\") do={ /sys sch a\
dd name=\"\$user\" disable=no start-date=\$date interval=\"4h\"; :delay 2s\
; :local exp [ /sys sch get [ /sys sch find where name=\"\$user\" ] next-r\
un]; :local getxp [len \$exp]; :if (\$getxp = 15) do={ :local d [:pic \$ex\
p 0 6]; :local t [:pic \$exp 7 16]; :local s (\"/\"); :local exp (\"\$d\$s\
\$year \$t\"); /ip hotspot user set comment=\$exp [find where name=\"\$use\
r\"];}; :if (\$getxp = 8) do={ /ip hotspot user set comment=\"\$date \$exp\
\" [find where name=\"\$user\"];}; :if (\$getxp > 15) do={ /ip hotspot use\
r set comment=\$exp [find where name=\"\$user\"];}; /sys sch remove [find \
where name=\"\$user\"]; :local mac \$\"mac-address\"; :local time [/system\
\_clock get time ]; /system script add name=\"\$date-|-\$time-|-\$user-|-1\
5-|-\$address-|-\$mac-|-4h-|-4H-|-\$comment\" owner=\"\$month\$year\" sour\
ce=\$date comment=mikhmon}}" parent-queue=none transparent-proxy=yes
add name=5H on-login=":put (\",remc,20,5h,20,,Disable,\"); {:local date [ /sys\
tem clock get date ];:local year [ :pick \$date 7 11 ];:local month [ :pic\
k \$date 0 3 ];:local comment [ /ip hotspot user get [/ip hotspot user fin\
d where name=\"\$user\"] comment]; :local ucode [:pic \$comment 0 2]; :if \
(\$ucode = \"vc\" or \$ucode = \"up\" or \$comment = \"\") do={ /sys sch a\
dd name=\"\$user\" disable=no start-date=\$date interval=\"5h\"; :delay 2s\
; :local exp [ /sys sch get [ /sys sch find where name=\"\$user\" ] next-r\
un]; :local getxp [len \$exp]; :if (\$getxp = 15) do={ :local d [:pic \$ex\
p 0 6]; :local t [:pic \$exp 7 16]; :local s (\"/\"); :local exp (\"\$d\$s\
\$year \$t\"); /ip hotspot user set comment=\$exp [find where name=\"\$use\
r\"];}; :if (\$getxp = 8) do={ /ip hotspot user set comment=\"\$date \$exp\
\" [find where name=\"\$user\"];}; :if (\$getxp > 15) do={ /ip hotspot use\
r set comment=\$exp [find where name=\"\$user\"];}; /sys sch remove [find \
where name=\"\$user\"]; :local mac \$\"mac-address\"; :local time [/system\
\_clock get time ]; /system script add name=\"\$date-|-\$time-|-\$user-|-2\
0-|-\$address-|-\$mac-|-5h-|-5H-|-\$comment\" owner=\"\$month\$year\" sour\
ce=\$date comment=mikhmon}}" parent-queue=none transparent-proxy=yes
add name=6H on-login=":put (\",remc,25,6h,25,,Disable,\"); {:local date [ /sys\
tem clock get date ];:local year [ :pick \$date 7 11 ];:local month [ :pic\
k \$date 0 3 ];:local comment [ /ip hotspot user get [/ip hotspot user fin\
d where name=\"\$user\"] comment]; :local ucode [:pic \$comment 0 2]; :if \
(\$ucode = \"vc\" or \$ucode = \"up\" or \$comment = \"\") do={ /sys sch a\
dd name=\"\$user\" disable=no start-date=\$date interval=\"6h\"; :delay 2s\
; :local exp [ /sys sch get [ /sys sch find where name=\"\$user\" ] next-r\
un]; :local getxp [len \$exp]; :if (\$getxp = 15) do={ :local d [:pic \$ex\
p 0 6]; :local t [:pic \$exp 7 16]; :local s (\"/\"); :local exp (\"\$d\$s\
\$year \$t\"); /ip hotspot user set comment=\$exp [find where name=\"\$use\
r\"];}; :if (\$getxp = 8) do={ /ip hotspot user set comment=\"\$date \$exp\
\" [find where name=\"\$user\"];}; :if (\$getxp > 15) do={ /ip hotspot use\
r set comment=\$exp [find where name=\"\$user\"];}; /sys sch remove [find \
where name=\"\$user\"]; :local mac \$\"mac-address\"; :local time [/system\
\_clock get time ]; /system script add name=\"\$date-|-\$time-|-\$user-|-2\
5-|-\$address-|-\$mac-|-6h-|-6H-|-\$comment\" owner=\"\$month\$year\" sour\
ce=\$date comment=mikhmon}}" parent-queue=none transparent-proxy=yes
add name=24H on-login=":put (\",remc,30,24h,30,,Disable,\"); {:local date [ /s\
ystem clock get date ];:local year [ :pick \$date 7 11 ];:local month [ :p\
ick \$date 0 3 ];:local comment [ /ip hotspot user get [/ip hotspot user f\
ind where name=\"\$user\"] comment]; :local ucode [:pic \$comment 0 2]; :i\
f (\$ucode = \"vc\" or \$ucode = \"up\" or \$comment = \"\") do={ /sys sch\
\_add name=\"\$user\" disable=no start-date=\$date interval=\"24h\"; :dela\
y 2s; :local exp [ /sys sch get [ /sys sch find where name=\"\$user\" ] ne\
xt-run]; :local getxp [len \$exp]; :if (\$getxp = 15) do={ :local d [:pic \
\$exp 0 6]; :local t [:pic \$exp 7 16]; :local s (\"/\"); :local exp (\"\$\
d\$s\$year \$t\"); /ip hotspot user set comment=\$exp [find where name=\"\
\$user\"];}; :if (\$getxp = 8) do={ /ip hotspot user set comment=\"\$date \
\$exp\" [find where name=\"\$user\"];}; :if (\$getxp > 15) do={ /ip hotspo\
t user set comment=\$exp [find where name=\"\$user\"];}; /sys sch remove [\
find where name=\"\$user\"]; :local mac \$\"mac-address\"; :local time [/s\
ystem clock get time ]; /system script add name=\"\$date-|-\$time-|-\$user\
-|-30-|-\$address-|-\$mac-|-24h-|-24H-|-\$comment\" owner=\"\$month\$year\
\" source=\$date comment=mikhmon}}" parent-queue=none transparent-proxy=\
yes
add name=7Days on-login=":put (\",remc,150,7d,150,,Disable,\"); {:local date [\
\_/system clock get date ];:local year [ :pick \$date 7 11 ];:local month \
[ :pick \$date 0 3 ];:local comment [ /ip hotspot user get [/ip hotspot us\
er find where name=\"\$user\"] comment]; :local ucode [:pic \$comment 0 2]\
; :if (\$ucode = \"vc\" or \$ucode = \"up\" or \$comment = \"\") do={ /sys\
\_sch add name=\"\$user\" disable=no start-date=\$date interval=\"7d\"; :d\
elay 2s; :local exp [ /sys sch get [ /sys sch find where name=\"\$user\" ]\
\_next-run]; :local getxp [len \$exp]; :if (\$getxp = 15) do={ :local d [:\
pic \$exp 0 6]; :local t [:pic \$exp 7 16]; :local s (\"/\"); :local exp (\
\"\$d\$s\$year \$t\"); /ip hotspot user set comment=\$exp [find where name\
=\"\$user\"];}; :if (\$getxp = 8) do={ /ip hotspot user set comment=\"\$da\
te \$exp\" [find where name=\"\$user\"];}; :if (\$getxp > 15) do={ /ip hot\
spot user set comment=\$exp [find where name=\"\$user\"];}; /sys sch remov\
e [find where name=\"\$user\"]; :local mac \$\"mac-address\"; :local time \
[/system clock get time ]; /system script add name=\"\$date-|-\$time-|-\$u\
ser-|-150-|-\$address-|-\$mac-|-7d-|-7Days-|-\$comment\" owner=\"\$month\$\
year\" source=\$date comment=mikhmon}}" parent-queue=none \
transparent-proxy=yes
add name=1month on-login=":put (\",remc,500,30d,500,,Disable,\"); {:local date\
\_[ /system clock get date ];:local year [ :pick \$date 7 11 ];:local mont\
h [ :pick \$date 0 3 ];:local comment [ /ip hotspot user get [/ip hotspot \
user find where name=\"\$user\"] comment]; :local ucode [:pic \$comment 0 \
2]; :if (\$ucode = \"vc\" or \$ucode = \"up\" or \$comment = \"\") do={ /s\
ys sch add name=\"\$user\" disable=no start-date=\$date interval=\"30d\"; \
:delay 2s; :local exp [ /sys sch get [ /sys sch find where name=\"\$user\"\
\_] next-run]; :local getxp [len \$exp]; :if (\$getxp = 15) do={ :local d \
[:pic \$exp 0 6]; :local t [:pic \$exp 7 16]; :local s (\"/\"); :local exp\
\_(\"\$d\$s\$year \$t\"); /ip hotspot user set comment=\$exp [find where n\
ame=\"\$user\"];}; :if (\$getxp = 8) do={ /ip hotspot user set comment=\"\
\$date \$exp\" [find where name=\"\$user\"];}; :if (\$getxp > 15) do={ /ip\
\_hotspot user set comment=\$exp [find where name=\"\$user\"];}; /sys sch \
remove [find where name=\"\$user\"]; :local mac \$\"mac-address\"; :local \
time [/system clock get time ]; /system script add name=\"\$date-|-\$time-\
|-\$user-|-500-|-\$address-|-\$mac-|-30d-|-1month-|-\$comment\" owner=\"\$\
month\$year\" source=\$date comment=mikhmon}}" parent-queue=none \
transparent-proxy=yes
/ip pool
add name=default-dhcp ranges=192.168.88.10-192.168.88.254
add name=hs ranges=10.0.0.5-10.0.0.50
add comment=PPPoE name=pppoe-clients ranges=192.168.0.254-192.168.5.5
/ip dhcp-server
add address-pool=default-dhcp disabled=no interface=bridge name=defconf
add address-pool=hs disabled=no interface=bridgeHS name=hotspot
/ip hotspot
add address-pool=hs disabled=no interface=bridgeHS name=hotspot1 profile=\
hsprof1
/ppp profile
add dns-server=192.168.5.1,8.8.8.8 local-address=192.168.5.1 name=3mbps \
queue-type=default rate-limit=3M/3M remote-address=pppoe-clients
/interface bridge port
add bridge=bridge comment=defconf interface=ether2
add bridge=bridge comment=defconf interface=ether3
add bridge=bridgeHS comment=Hotspot interface=wlan1
add bridge=bridgeHS interface=ether4
/ip neighbor discovery-settings
set discover-interface-list=all
/interface list member
add comment=defconf interface=bridge list=LAN
add comment=defconf interface=ether1 list=WAN
/interface pppoe-server server
add authentication=pap disabled=no interface=bridgeHS one-session-per-host=\
yes service-name=pppoe-server
/ip address
add address=192.168.88.1/24 comment=defconf interface=bridge network=\
192.168.88.0
add address=10.0.0.1/24 interface=bridgeHS network=10.0.0.0
/ip dhcp-client
add comment=defconf dhcp-options=hostname,clientid disabled=no interface=\
ether1
/ip dhcp-server network
add address=10.0.0.0/24 comment=hotspot gateway=10.0.0.1
add address=192.168.88.0/24 comment=defconf gateway=192.168.88.1
/ip dns
set allow-remote-requests=yes
/ip dns static
add address=192.168.88.1 comment=defconf name=router.lan
/ip firewall filter
add action=passthrough chain=unused-hs-chain comment=\
"place hotspot rules here" disabled=yes
add action=accept chain=input comment=\
"defconf: accept established,related,untracked" connection-state=\
established,related,untracked
add action=drop chain=input comment="defconf: drop invalid" connection-state=\
invalid
add action=accept chain=input comment="defconf: accept ICMP" protocol=icmp
add action=accept chain=input comment=\
"defconf: accept to local loopback (for CAPsMAN)" dst-address=127.0.0.1
add action=drop chain=input comment="defconf: drop all not coming from LAN" \
in-interface-list=!LAN
add action=accept chain=forward comment="defconf: accept in ipsec policy" \
ipsec-policy=in,ipsec
add action=accept chain=forward comment="defconf: accept out ipsec policy" \
ipsec-policy=out,ipsec
add action=fasttrack-connection chain=forward comment="defconf: fasttrack" \
connection-state=established,related
add action=accept chain=forward comment=\
"defconf: accept established,related, untracked" connection-state=\
established,related,untracked
add action=drop chain=forward comment="defconf: drop invalid" \
connection-state=invalid
add action=drop chain=forward comment=\
"defconf: drop all from WAN not DSTNATed" connection-nat-state=!dstnat \
connection-state=new in-interface-list=WAN
/ip firewall nat
add action=passthrough chain=unused-hs-chain comment=\
"place hotspot rules here" disabled=yes
add action=masquerade chain=srcnat comment="defconf: masquerade" \
ipsec-policy=out,none out-interface-list=WAN
add action=masquerade chain=srcnat comment="masquerade hotspot network" \
src-address=10.0.0.0/24
add action=masquerade chain=srcnat comment=PPPoe src-address=192.168.5.0/24
/ip hotspot user
add name=admin
add comment="jan/03/1970 08:19:24" name=5333 password=5333 profile=24H \
server=hotspot1
add comment=vc-540-09.22.20- name=6844 password=6844 profile=24H server=\
hotspot1
add comment=vc-540-09.22.20- name=7524 password=7524 profile=24H server=\
hotspot1
add comment=vc-540-09.22.20- name=3669 password=3669 profile=24H server=\
hotspot1
add comment=vc-540-09.22.20- name=4829 password=4829 profile=24H server=\
hotspot1
/ppp secret
add name=sun password=rickylyn29 profile=3mbps service=pppoe
add name=globe password=rickylyn29 service=pppoe
/system clock
set time-zone-name=Asia/Manila
/system logging
add action=disk prefix=-> topics=hotspot,info,debug
/system ntp client
set enabled=yes primary-ntp=121.58.193.100
/system scheduler
add comment="Monitor Profile 1H" interval=2m54s name=1H on-event=":local datei\
nt do={:local montharray ( \"jan\",\"feb\",\"mar\",\"apr\",\"may\",\"jun\"\
,\"jul\",\"aug\",\"sep\",\"oct\",\"nov\",\"dec\" );:local days [ :pick \$d\
\_4 6 ];:local month [ :pick \$d 0 3 ];:local year [ :pick \$d 7 11 ];:loc\
al monthint ([ :find \$montharray \$month]);:local month (\$monthint + 1);\
:if ( [len \$month] = 1) do={:local zero (\"0\");:return [:tonum (\"\$year\
\$zero\$month\$days\")];} else={:return [:tonum (\"\$year\$month\$days\")]\
;}}; :local timeint do={ :local hours [ :pick \$t 0 2 ]; :local minutes [ \
:pick \$t 3 5 ]; :return (\$hours * 60 + \$minutes) ; }; :local date [ /sy\
stem clock get date ]; :local time [ /system clock get time ]; :local toda\
y [\$dateint d=\$date] ; :local curtime [\$timeint t=\$time] ; :foreach i \
in [ /ip hotspot user find where profile=\"1H\" ] do={ :local comment [ /i\
p hotspot user get \$i comment]; :local name [ /ip hotspot user get \$i na\
me]; :local gettime [:pic \$comment 12 20]; :if ([:pic \$comment 3] = \"/\
\" and [:pic \$comment 6] = \"/\") do={:local expd [\$dateint d=\$comment]\
\_; :local expt [\$timeint t=\$gettime] ; :if ((\$expd < \$today and \$exp\
t < \$curtime) or (\$expd < \$today and \$expt > \$curtime) or (\$expd = \
\$today and \$expt < \$curtime)) do={ [ /ip hotspot user remove \$i ]; [ /\
ip hotspot active remove [find where user=\$name] ];}}}" policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \
start-date=jan/02/1970 start-time=03:57:26
add comment="Monitor Profile 3H" interval=2m51s name=3H on-event=":local datei\
nt do={:local montharray ( \"jan\",\"feb\",\"mar\",\"apr\",\"may\",\"jun\"\
,\"jul\",\"aug\",\"sep\",\"oct\",\"nov\",\"dec\" );:local days [ :pick \$d\
\_4 6 ];:local month [ :pick \$d 0 3 ];:local year [ :pick \$d 7 11 ];:loc\
al monthint ([ :find \$montharray \$month]);:local month (\$monthint + 1);\
:if ( [len \$month] = 1) do={:local zero (\"0\");:return [:tonum (\"\$year\
\$zero\$month\$days\")];} else={:return [:tonum (\"\$year\$month\$days\")]\
;}}; :local timeint do={ :local hours [ :pick \$t 0 2 ]; :local minutes [ \
:pick \$t 3 5 ]; :return (\$hours * 60 + \$minutes) ; }; :local date [ /sy\
stem clock get date ]; :local time [ /system clock get time ]; :local toda\
y [\$dateint d=\$date] ; :local curtime [\$timeint t=\$time] ; :foreach i \
in [ /ip hotspot user find where profile=\"3H\" ] do={ :local comment [ /i\
p hotspot user get \$i comment]; :local name [ /ip hotspot user get \$i na\
me]; :local gettime [:pic \$comment 12 20]; :if ([:pic \$comment 3] = \"/\
\" and [:pic \$comment 6] = \"/\") do={:local expd [\$dateint d=\$comment]\
\_; :local expt [\$timeint t=\$gettime] ; :if ((\$expd < \$today and \$exp\
t < \$curtime) or (\$expd < \$today and \$expt > \$curtime) or (\$expd = \
\$today and \$expt < \$curtime)) do={ [ /ip hotspot user remove \$i ]; [ /\
ip hotspot active remove [find where user=\$name] ];}}}" policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \
start-date=jan/02/1970 start-time=02:35:19
add comment="Monitor Profile 4H" interval=2m19s name=4H on-event=":local datei\
nt do={:local montharray ( \"jan\",\"feb\",\"mar\",\"apr\",\"may\",\"jun\"\
,\"jul\",\"aug\",\"sep\",\"oct\",\"nov\",\"dec\" );:local days [ :pick \$d\
\_4 6 ];:local month [ :pick \$d 0 3 ];:local year [ :pick \$d 7 11 ];:loc\
al monthint ([ :find \$montharray \$month]);:local month (\$monthint + 1);\
:if ( [len \$month] = 1) do={:local zero (\"0\");:return [:tonum (\"\$year\
\$zero\$month\$days\")];} else={:return [:tonum (\"\$year\$month\$days\")]\
;}}; :local timeint do={ :local hours [ :pick \$t 0 2 ]; :local minutes [ \
:pick \$t 3 5 ]; :return (\$hours * 60 + \$minutes) ; }; :local date [ /sy\
stem clock get date ]; :local time [ /system clock get time ]; :local toda\
y [\$dateint d=\$date] ; :local curtime [\$timeint t=\$time] ; :foreach i \
in [ /ip hotspot user find where profile=\"4H\" ] do={ :local comment [ /i\
p hotspot user get \$i comment]; :local name [ /ip hotspot user get \$i na\
me]; :local gettime [:pic \$comment 12 20]; :if ([:pic \$comment 3] = \"/\
\" and [:pic \$comment 6] = \"/\") do={:local expd [\$dateint d=\$comment]\
\_; :local expt [\$timeint t=\$gettime] ; :if ((\$expd < \$today and \$exp\
t < \$curtime) or (\$expd < \$today and \$expt > \$curtime) or (\$expd = \
\$today and \$expt < \$curtime)) do={ [ /ip hotspot user remove \$i ]; [ /\
ip hotspot active remove [find where user=\$name] ];}}}" policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \
start-date=jan/02/1970 start-time=01:55:53
add comment="Monitor Profile 5H" interval=2m43s name=5H on-event=":local datei\
nt do={:local montharray ( \"jan\",\"feb\",\"mar\",\"apr\",\"may\",\"jun\"\
,\"jul\",\"aug\",\"sep\",\"oct\",\"nov\",\"dec\" );:local days [ :pick \$d\
\_4 6 ];:local month [ :pick \$d 0 3 ];:local year [ :pick \$d 7 11 ];:loc\
al monthint ([ :find \$montharray \$month]);:local month (\$monthint + 1);\
:if ( [len \$month] = 1) do={:local zero (\"0\");:return [:tonum (\"\$year\
\$zero\$month\$days\")];} else={:return [:tonum (\"\$year\$month\$days\")]\
;}}; :local timeint do={ :local hours [ :pick \$t 0 2 ]; :local minutes [ \
:pick \$t 3 5 ]; :return (\$hours * 60 + \$minutes) ; }; :local date [ /sy\
stem clock get date ]; :local time [ /system clock get time ]; :local toda\
y [\$dateint d=\$date] ; :local curtime [\$timeint t=\$time] ; :foreach i \
in [ /ip hotspot user find where profile=\"5H\" ] do={ :local comment [ /i\
p hotspot user get \$i comment]; :local name [ /ip hotspot user get \$i na\
me]; :local gettime [:pic \$comment 12 20]; :if ([:pic \$comment 3] = \"/\
\" and [:pic \$comment 6] = \"/\") do={:local expd [\$dateint d=\$comment]\
\_; :local expt [\$timeint t=\$gettime] ; :if ((\$expd < \$today and \$exp\
t < \$curtime) or (\$expd < \$today and \$expt > \$curtime) or (\$expd = \
\$today and \$expt < \$curtime)) do={ [ /ip hotspot user remove \$i ]; [ /\
ip hotspot active remove [find where user=\$name] ];}}}" policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \
start-date=jan/02/1970 start-time=02:42:42
add comment="Monitor Profile 6H" interval=2m37s name=6H on-event=":local datei\
nt do={:local montharray ( \"jan\",\"feb\",\"mar\",\"apr\",\"may\",\"jun\"\
,\"jul\",\"aug\",\"sep\",\"oct\",\"nov\",\"dec\" );:local days [ :pick \$d\
\_4 6 ];:local month [ :pick \$d 0 3 ];:local year [ :pick \$d 7 11 ];:loc\
al monthint ([ :find \$montharray \$month]);:local month (\$monthint + 1);\
:if ( [len \$month] = 1) do={:local zero (\"0\");:return [:tonum (\"\$year\
\$zero\$month\$days\")];} else={:return [:tonum (\"\$year\$month\$days\")]\
;}}; :local timeint do={ :local hours [ :pick \$t 0 2 ]; :local minutes [ \
:pick \$t 3 5 ]; :return (\$hours * 60 + \$minutes) ; }; :local date [ /sy\
stem clock get date ]; :local time [ /system clock get time ]; :local toda\
y [\$dateint d=\$date] ; :local curtime [\$timeint t=\$time] ; :foreach i \
in [ /ip hotspot user find where profile=\"6H\" ] do={ :local comment [ /i\
p hotspot user get \$i comment]; :local name [ /ip hotspot user get \$i na\
me]; :local gettime [:pic \$comment 12 20]; :if ([:pic \$comment 3] = \"/\
\" and [:pic \$comment 6] = \"/\") do={:local expd [\$dateint d=\$comment]\
\_; :local expt [\$timeint t=\$gettime] ; :if ((\$expd < \$today and \$exp\
t < \$curtime) or (\$expd < \$today and \$expt > \$curtime) or (\$expd = \
\$today and \$expt < \$curtime)) do={ [ /ip hotspot user remove \$i ]; [ /\
ip hotspot active remove [find where user=\$name] ];}}}" policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \
start-date=jan/02/1970 start-time=04:48:49
add comment="Monitor Profile default" interval=2m24s name=default on-event=":l\
ocal dateint do={:local montharray ( \"jan\",\"feb\",\"mar\",\"apr\",\"may\
\",\"jun\",\"jul\",\"aug\",\"sep\",\"oct\",\"nov\",\"dec\" );:local days [\
\_:pick \$d 4 6 ];:local month [ :pick \$d 0 3 ];:local year [ :pick \$d 7\
\_11 ];:local monthint ([ :find \$montharray \$month]);:local month (\$mon\
thint + 1);:if ( [len \$month] = 1) do={:local zero (\"0\");:return [:tonu\
m (\"\$year\$zero\$month\$days\")];} else={:return [:tonum (\"\$year\$mont\
h\$days\")];}}; :local timeint do={ :local hours [ :pick \$t 0 2 ]; :local\
\_minutes [ :pick \$t 3 5 ]; :return (\$hours * 60 + \$minutes) ; }; :loca\
l date [ /system clock get date ]; :local time [ /system clock get time ];\
\_:local today [\$dateint d=\$date] ; :local curtime [\$timeint t=\$time] \
; :foreach i in [ /ip hotspot user find where profile=\"default\" ] do={ :\
local comment [ /ip hotspot user get \$i comment]; :local name [ /ip hotsp\
ot user get \$i name]; :local gettime [:pic \$comment 12 20]; :if ([:pic \
\$comment 3] = \"/\" and [:pic \$comment 6] = \"/\") do={:local expd [\$da\
teint d=\$comment] ; :local expt [\$timeint t=\$gettime] ; :if ((\$expd < \
\$today and \$expt < \$curtime) or (\$expd < \$today and \$expt > \$curtim\
e) or (\$expd = \$today and \$expt < \$curtime)) do={ [ /ip hotspot user r\
emove \$i ]; [ /ip hotspot active remove [find where user=\$name] ];}}}" \
policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \
start-date=jan/02/1970 start-time=01:13:36
add comment="Monitor Profile 24H" interval=2m46s name=24H on-event=":local dat\
eint do={:local montharray ( \"jan\",\"feb\",\"mar\",\"apr\",\"may\",\"jun\
\",\"jul\",\"aug\",\"sep\",\"oct\",\"nov\",\"dec\" );:local days [ :pick \
\$d 4 6 ];:local month [ :pick \$d 0 3 ];:local year [ :pick \$d 7 11 ];:l\
ocal monthint ([ :find \$montharray \$month]);:local month (\$monthint + 1\
);:if ( [len \$month] = 1) do={:local zero (\"0\");:return [:tonum (\"\$ye\
ar\$zero\$month\$days\")];} else={:return [:tonum (\"\$year\$month\$days\"\
)];}}; :local timeint do={ :local hours [ :pick \$t 0 2 ]; :local minutes \
[ :pick \$t 3 5 ]; :return (\$hours * 60 + \$minutes) ; }; :local date [ /\
system clock get date ]; :local time [ /system clock get time ]; :local to\
day [\$dateint d=\$date] ; :local curtime [\$timeint t=\$time] ; :foreach \
i in [ /ip hotspot user find where profile=\"24H\" ] do={ :local comment [\
\_/ip hotspot user get \$i comment]; :local name [ /ip hotspot user get \$\
i name]; :local gettime [:pic \$comment 12 20]; :if ([:pic \$comment 3] = \
\"/\" and [:pic \$comment 6] = \"/\") do={:local expd [\$dateint d=\$comme\
nt] ; :local expt [\$timeint t=\$gettime] ; :if ((\$expd < \$today and \$e\
xpt < \$curtime) or (\$expd < \$today and \$expt > \$curtime) or (\$expd =\
\_\$today and \$expt < \$curtime)) do={ [ /ip hotspot user remove \$i ]; [\
\_/ip hotspot active remove [find where user=\$name] ];}}}" policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \
start-date=jan/02/1970 start-time=03:30:43
add comment="Monitor Profile 7Days" interval=2m43s name=7Days on-event=":local\
\_dateint do={:local montharray ( \"jan\",\"feb\",\"mar\",\"apr\",\"may\",\
\"jun\",\"jul\",\"aug\",\"sep\",\"oct\",\"nov\",\"dec\" );:local days [ :p\
ick \$d 4 6 ];:local month [ :pick \$d 0 3 ];:local year [ :pick \$d 7 11 \
];:local monthint ([ :find \$montharray \$month]);:local month (\$monthint\
\_+ 1);:if ( [len \$month] = 1) do={:local zero (\"0\");:return [:tonum (\
\"\$year\$zero\$month\$days\")];} else={:return [:tonum (\"\$year\$month\$\
days\")];}}; :local timeint do={ :local hours [ :pick \$t 0 2 ]; :local mi\
nutes [ :pick \$t 3 5 ]; :return (\$hours * 60 + \$minutes) ; }; :local da\
te [ /system clock get date ]; :local time [ /system clock get time ]; :lo\
cal today [\$dateint d=\$date] ; :local curtime [\$timeint t=\$time] ; :fo\
reach i in [ /ip hotspot user find where profile=\"7Days\" ] do={ :local c\
omment [ /ip hotspot user get \$i comment]; :local name [ /ip hotspot user\
\_get \$i name]; :local gettime [:pic \$comment 12 20]; :if ([:pic \$comme\
nt 3] = \"/\" and [:pic \$comment 6] = \"/\") do={:local expd [\$dateint d\
=\$comment] ; :local expt [\$timeint t=\$gettime] ; :if ((\$expd < \$today\
\_and \$expt < \$curtime) or (\$expd < \$today and \$expt > \$curtime) or \
(\$expd = \$today and \$expt < \$curtime)) do={ [ /ip hotspot user remove \
\$i ]; [ /ip hotspot active remove [find where user=\$name] ];}}}" \
policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \
start-date=jan/02/1970 start-time=03:25:40
add comment="Monitor Profile 1month" interval=2m38s name=1month on-event=":loc\
al dateint do={:local montharray ( \"jan\",\"feb\",\"mar\",\"apr\",\"may\"\
,\"jun\",\"jul\",\"aug\",\"sep\",\"oct\",\"nov\",\"dec\" );:local days [ :\
pick \$d 4 6 ];:local month [ :pick \$d 0 3 ];:local year [ :pick \$d 7 11\
\_];:local monthint ([ :find \$montharray \$month]);:local month (\$monthi\
nt + 1);:if ( [len \$month] = 1) do={:local zero (\"0\");:return [:tonum (\
\"\$year\$zero\$month\$days\")];} else={:return [:tonum (\"\$year\$month\$\
days\")];}}; :local timeint do={ :local hours [ :pick \$t 0 2 ]; :local mi\
nutes [ :pick \$t 3 5 ]; :return (\$hours * 60 + \$minutes) ; }; :local da\
te [ /system clock get date ]; :local time [ /system clock get time ]; :lo\
cal today [\$dateint d=\$date] ; :local curtime [\$timeint t=\$time] ; :fo\
reach i in [ /ip hotspot user find where profile=\"1month\" ] do={ :local \
comment [ /ip hotspot user get \$i comment]; :local name [ /ip hotspot use\
r get \$i name]; :local gettime [:pic \$comment 12 20]; :if ([:pic \$comme\
nt 3] = \"/\" and [:pic \$comment 6] = \"/\") do={:local expd [\$dateint d\
=\$comment] ; :local expt [\$timeint t=\$gettime] ; :if ((\$expd < \$today\
\_and \$expt < \$curtime) or (\$expd < \$today and \$expt > \$curtime) or \
(\$expd = \$today and \$expt < \$curtime)) do={ [ /ip hotspot user remove \
\$i ]; [ /ip hotspot active remove [find where user=\$name] ];}}}" \
policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \
start-date=jan/02/1970 start-time=04:35:44
/system script
add comment=mikhmon dont-require-permissions=no name="jan/02/1970-|-08:19:28-|\
-5333-|-30-|-10.0.0.50-|-E4:58:E7:87:DB:9D-|-24h-|-24H-|-vc-540-09.22.20-" \
owner=jan1970 policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=\
jan/02/1970
/tool mac-server
set allowed-interface-list=LAN
/tool mac-server mac-winbox
set allowed-interface-list=LAN

You might also like