shell - Lua script over Mikrotic routers -
i new lua take easy me. have following code should ran mikrotik router
. possibly tell me does?
:local content :local #for each mangle in list :foreach in=[/ip firewall mangle find comment !=""] do={ #pull comment out of queue , divide accordingly :set content [/ip firewall mangle $i comment] :if ([:find $content "!"] != "") do={ :local pos1 [:find $content "!"] :local pos4 [:len $content] :local pos2 ([:find [:pick $content ($pos1+1) $pos4] "!"]+($pos1+1)) :local pos3 ([:find [:pick $content ($pos2+1) $pos4] "!"]+($pos2+1))
this mikrotik script search rules comments in firewall mangle rules, , find comments exclamation points "!".
the variables pos1
pos2
pos3
first, second , third location of !
in comments.
for instance: if there comment this: a!b!cde!fg
variables be:
pos1=1 pos2=3 pos3=7
the location starts zero, first location 0 , second 1!
Comments
Post a Comment