Code: Select all
#Name of our wlan, if you have not modified these values in the mk, leave the default variable
:local DenWlan "wlan";
#In this variable, the numbers of the exit interfaces for which you want to change the mac-address are placed.
#More can be added or removed, always respecting the format shown in the example.
:local ListaDeIn [("1","2","3","4","5")];
#///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
:local hex 0123456789ABCDEF;
:local cantPing 3;
:local InterfazSaliente;
:local direccionPing;
:log warning "Global MAC change started";
:local tonum do={
:local in ($1->0)
:local j
:for i from=0 to=([:len $in]-1) do={
:local t
:set t [:pick $in $i]
:if ($t!=" ") do={:set $j "$j$t"}
}
:set j ([:tonum $j])
:return $j
}
:local fabM {"1CCB99";"60E3AC";"58F102";"54271E";"40D3AE";"24920E";"BCB308";"1CABA7";"5C70A3";"2C0E3D"};
:local r;
:local rs;
:local posA;
:local posB;
:local i7;
:local i8;
:local i9;
:local i10;
:local longA;
:local macLista;
:for i from=0 to=([:len $ListaDeIn] - 1) do={
:set $InterfazSaliente ($DenWlan.($ListaDeIn->$i));
:set r [/interface ethernet get ether1 tx-bytes];
:set r [$tonum $r];
:set rs (:tostr $r);
:set posA [:pick $rs 2];
:set posB [:tonum $posA];
:set i7 (($r/16)-(($r/16)/16)*16);
:set i8 ($r-($r/16)*16);
:set r [/interface ethernet get ether1 tx-bytes];
:set r [$tonum $r];
:set i9 (($r/14)-(($r/14)/14)*14);
:set i10 ($r-($r/14)*14);
:set longA ($fabM->$posB) ;
:set macLista ($longA.[:tostr [:pick $hex $i7]].[:tostr [:pick $hex $i8]].[:tostr [:pick $hex $i9]].[:tostr [:pick $hex $i10]].[:tostr [:pick B]].[:tostr [:pick 0]]);
/interface wireless set mac-address=$macLista [find where name=$InterfazSaliente];
:log warning ("Interface MAC address ".$InterfazSaliente." changed to ".$macLista);
:delay 1;
}
:log warning "All MACS changed";