ACK checking
From MikroTik Wiki
I have developed this script to check ALL wireless interfaces that´s running in ap-mode, you can set the ACK MAX value and if you want the user to be removed or inly listing, here´s the code:
To install:
- Create a new script in system -> Scripts - Run it by: / system script run <name> - If fine, adjust the vars and test again. - Create a Schedule entry for run this script.
#Script ACK-Check v0.1
#
#Lista as estacoes que estao com ACK acima do limite com opcao para desconecta-las
#
# Autor: Alexandre Jeronimo Correa <ajcorrea@gmail.com>
# 20/11/2009 - 01:03am
#
#Instrucoes de uso:
# -- Adicionar o codigo completo em SYSTEM >> SCRIPTS
# -- Por padrao o script nao vai derrubar nenhuma estacao, rode o script padrao antes de
# configurar a variavel cut para 1, tendo certeza que o script esta OK.
# -- O script pode ser executado pelo botao "run script" ou via linha de comando.
# "/ system script run <nome do script>
# -- O script so funciona em interfaces que o modo de operacao seja AP-BRIDGE
# -- Testado nas versoes 3.25 até 3.30
#
#Informacoes:
#
#Variavel ack -> deve ter o valor do ack MAXIMO permitido.
#Variavel cut -> deve ser 0 ou 1, 0 somente mostra, 1 mostra e desconecta a estacao.
##################################################################
#Configuracoes das variaveis
:local ack 50;
:local cut 0;
############ Script - NAO ALTERAR #####################################
:local mac "";
:local uack "";
:local removido "";
:log warning ("[ackchk] Procurando clientes com ACK maior que " . $ack);
#pega a lista de interfaces AP wireless ativas, e que tenham ack dinamico
:foreach i in=[ / interface wireless find mode="ap-bridge" ack-timeout="dynamic" running] do={
:local intname [ / interface wireless get $i name ];
:log warning (" Interface: " . $intname);
:foreach x in=[/interface wireless registration-table find interface=$intname] do={
:set uack [/interface wireless registration-table get $x ack-timeout];
:set removido "";
:if ($uack > $ack) do={
:set mac [ / interface wireless registration-table get $x mac-address];
:if ($cut = 1) do= {
:set removido " removido...";
/ interface wireless registration-table remove $x;
};
:log warning (" mac: " . $mac . "@" . $intname . " [" . $uack . "]" . $removido);
};
};
};
############ FIM #####################################