mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
add script 'accesslist-duplicates'
This commit is contained in:
parent
434590d207
commit
d68a1def31
4 changed files with 83 additions and 1 deletions
2
Makefile
2
Makefile
|
@ -1,4 +1,4 @@
|
|||
GENERATE = collect-wireless-mac.capsman collect-wireless-mac.local dhcp-lease-comment.capsman dhcp-lease-comment.local
|
||||
GENERATE = *.capsman *.local
|
||||
|
||||
all: $(GENERATE) README.html
|
||||
|
||||
|
|
27
accesslist-duplicates.capsman
Normal file
27
accesslist-duplicates.capsman
Normal file
|
@ -0,0 +1,27 @@
|
|||
#
|
||||
# RouterOS script: accesslist-duplicates.capsman
|
||||
# Copyright (c) 2018 Christian Hesse <mail@eworm.de>
|
||||
#
|
||||
# print duplicate antries in wireless access list
|
||||
#
|
||||
# !! Do not edit this file, it is generated from template!
|
||||
|
||||
:local seen [ :toarray "" ];
|
||||
:local shown [ :toarray "" ];
|
||||
|
||||
:foreach acclist in=[ / caps-man access-list find where mac-address!="00:00:00:00:00:00" ] do={
|
||||
:local mac [ / caps-man access-list get $acclist mac-address ];
|
||||
:foreach "seen-mac" in=$seen do={
|
||||
:if ($"seen-mac" = $mac) do={
|
||||
:local skip 0;
|
||||
:foreach "shown-mac" in=$shown do={
|
||||
:if ($"shown-mac" = $mac) do={ :set skip 1; }
|
||||
}
|
||||
:if ($skip = 0) do={
|
||||
/ caps-man access-list print where mac-address=$mac;
|
||||
:set $shown ( $shown , $mac );
|
||||
}
|
||||
}
|
||||
}
|
||||
:set $seen ( $seen , $mac );
|
||||
}
|
27
accesslist-duplicates.local
Normal file
27
accesslist-duplicates.local
Normal file
|
@ -0,0 +1,27 @@
|
|||
#
|
||||
# RouterOS script: accesslist-duplicates.local
|
||||
# Copyright (c) 2018 Christian Hesse <mail@eworm.de>
|
||||
#
|
||||
# print duplicate antries in wireless access list
|
||||
#
|
||||
# !! Do not edit this file, it is generated from template!
|
||||
|
||||
:local seen [ :toarray "" ];
|
||||
:local shown [ :toarray "" ];
|
||||
|
||||
:foreach acclist in=[ / interface wireless access-list find where mac-address!="00:00:00:00:00:00" ] do={
|
||||
:local mac [ / interface wireless access-list get $acclist mac-address ];
|
||||
:foreach "seen-mac" in=$seen do={
|
||||
:if ($"seen-mac" = $mac) do={
|
||||
:local skip 0;
|
||||
:foreach "shown-mac" in=$shown do={
|
||||
:if ($"shown-mac" = $mac) do={ :set skip 1; }
|
||||
}
|
||||
:if ($skip = 0) do={
|
||||
/ interface wireless access-list print where mac-address=$mac;
|
||||
:set $shown ( $shown , $mac );
|
||||
}
|
||||
}
|
||||
}
|
||||
:set $seen ( $seen , $mac );
|
||||
}
|
28
accesslist-duplicates.template
Normal file
28
accesslist-duplicates.template
Normal file
|
@ -0,0 +1,28 @@
|
|||
#
|
||||
# RouterOS script: accesslist-duplicates%TEMPL%
|
||||
# Copyright (c) 2018 Christian Hesse <mail@eworm.de>
|
||||
#
|
||||
# print duplicate antries in wireless access list
|
||||
#
|
||||
# !! This is just a template! Replace '%PATH%' with 'caps-man'
|
||||
# !! or 'interface wireless'!
|
||||
|
||||
:local seen [ :toarray "" ];
|
||||
:local shown [ :toarray "" ];
|
||||
|
||||
:foreach acclist in=[ / %PATH% access-list find where mac-address!="00:00:00:00:00:00" ] do={
|
||||
:local mac [ / %PATH% access-list get $acclist mac-address ];
|
||||
:foreach "seen-mac" in=$seen do={
|
||||
:if ($"seen-mac" = $mac) do={
|
||||
:local skip 0;
|
||||
:foreach "shown-mac" in=$shown do={
|
||||
:if ($"shown-mac" = $mac) do={ :set skip 1; }
|
||||
}
|
||||
:if ($skip = 0) do={
|
||||
/ %PATH% access-list print where mac-address=$mac;
|
||||
:set $shown ( $shown , $mac );
|
||||
}
|
||||
}
|
||||
}
|
||||
:set $seen ( $seen , $mac );
|
||||
}
|
Loading…
Reference in a new issue