mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
daily-psk: use named array
This commit is contained in:
parent
286e3d9cf9
commit
0e83d2e317
4 changed files with 16 additions and 36 deletions
|
@ -66,15 +66,9 @@ $WaitFullyConnected;
|
|||
/caps-man/access-list/set $AccList private-passphrase=$NewPsk;
|
||||
|
||||
:if ([ :len [ /caps-man/actual-interface-configuration/find where configuration.ssid=$Ssid !disabled ] ] > 0) do={
|
||||
:foreach SeenSsid in=$Seen do={
|
||||
:if ($SeenSsid = $Ssid) do={
|
||||
$LogPrintExit2 debug $0 ("Already sent a mail for SSID " . $Ssid . ", skipping.") false;
|
||||
:set Skip 1;
|
||||
}
|
||||
}
|
||||
|
||||
:if ($Skip = 0) do={
|
||||
:set Seen ($Seen, $Ssid);
|
||||
:if ($Seen->$Ssid = 1) do={
|
||||
$LogPrintExit2 debug $0 ("Already sent a mail for SSID " . $Ssid . ", skipping.") false;
|
||||
} else={
|
||||
:local Link ($DailyPskQrCodeUrl . \
|
||||
"?scale=8&level=1&ssid=" . [ $UrlEncode $Ssid ] . "&pass=" . [ $UrlEncode $NewPsk ]);
|
||||
$SendNotification2 ({ origin=$0; \
|
||||
|
@ -84,6 +78,7 @@ $WaitFullyConnected;
|
|||
[ $FormatLine "PSK" $NewPsk ] . "\n" . \
|
||||
[ $FormatLine "Date" $Date ] . "\n\n" . \
|
||||
"A client device specific rule must not exist!"); link=$Link });
|
||||
:set ($Seen->$Ssid) 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,15 +65,9 @@ $WaitFullyConnected;
|
|||
/interface/wireless/access-list/set $AccList private-pre-shared-key=$NewPsk;
|
||||
|
||||
:if ([ :len [ /interface/wireless/find where name=$IntName !disabled ] ] = 1) do={
|
||||
:foreach SeenSsid in=$Seen do={
|
||||
:if ($SeenSsid = $Ssid) do={
|
||||
$LogPrintExit2 debug $0 ("Already sent a mail for SSID " . $Ssid . ", skipping.") false;
|
||||
:set Skip 1;
|
||||
}
|
||||
}
|
||||
|
||||
:if ($Skip = 0) do={
|
||||
:set Seen ($Seen, $Ssid);
|
||||
:if ($Seen->$Ssid = 1) do={
|
||||
$LogPrintExit2 debug $0 ("Already sent a mail for SSID " . $Ssid . ", skipping.") false;
|
||||
} else={
|
||||
:local Link ($DailyPskQrCodeUrl . \
|
||||
"?scale=8&level=1&ssid=" . [ $UrlEncode $Ssid ] . "&pass=" . [ $UrlEncode $NewPsk ]);
|
||||
$SendNotification2 ({ origin=$0; \
|
||||
|
@ -83,6 +77,7 @@ $WaitFullyConnected;
|
|||
[ $FormatLine "PSK" $NewPsk ] . "\n" . \
|
||||
[ $FormatLine "Date" $Date ] . "\n\n" . \
|
||||
"A client device specific rule must not exist!"); link=$Link });
|
||||
:set ($Seen->$Ssid) 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,15 +81,9 @@ $WaitFullyConnected;
|
|||
:if ([ :len [ /caps-man/actual-interface-configuration/find where configuration.ssid=$Ssid !disabled ] ] > 0) do={
|
||||
:if ([ :len [ /interface/wifiwave2/actual-configuration/find where configuration.ssid=$Ssid ] ] > 0) do={
|
||||
:if ([ :len [ /interface/wireless/find where name=$IntName !disabled ] ] = 1) do={
|
||||
:foreach SeenSsid in=$Seen do={
|
||||
:if ($SeenSsid = $Ssid) do={
|
||||
$LogPrintExit2 debug $0 ("Already sent a mail for SSID " . $Ssid . ", skipping.") false;
|
||||
:set Skip 1;
|
||||
}
|
||||
}
|
||||
|
||||
:if ($Skip = 0) do={
|
||||
:set Seen ($Seen, $Ssid);
|
||||
:if ($Seen->$Ssid = 1) do={
|
||||
$LogPrintExit2 debug $0 ("Already sent a mail for SSID " . $Ssid . ", skipping.") false;
|
||||
} else={
|
||||
:local Link ($DailyPskQrCodeUrl . \
|
||||
"?scale=8&level=1&ssid=" . [ $UrlEncode $Ssid ] . "&pass=" . [ $UrlEncode $NewPsk ]);
|
||||
$SendNotification2 ({ origin=$0; \
|
||||
|
@ -99,6 +93,7 @@ $WaitFullyConnected;
|
|||
[ $FormatLine "PSK" $NewPsk ] . "\n" . \
|
||||
[ $FormatLine "Date" $Date ] . "\n\n" . \
|
||||
"A client device specific rule must not exist!"); link=$Link });
|
||||
:set ($Seen->$Ssid) 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,15 +66,9 @@ $WaitFullyConnected;
|
|||
/interface/wifiwave2/access-list/set $AccList passphrase=$NewPsk;
|
||||
|
||||
:if ([ :len [ /interface/wifiwave2/actual-configuration/find where configuration.ssid=$Ssid ] ] > 0) do={
|
||||
:foreach SeenSsid in=$Seen do={
|
||||
:if ($SeenSsid = $Ssid) do={
|
||||
$LogPrintExit2 debug $0 ("Already sent a mail for SSID " . $Ssid . ", skipping.") false;
|
||||
:set Skip 1;
|
||||
}
|
||||
}
|
||||
|
||||
:if ($Skip = 0) do={
|
||||
:set Seen ($Seen, $Ssid);
|
||||
:if ($Seen->$Ssid = 1) do={
|
||||
$LogPrintExit2 debug $0 ("Already sent a mail for SSID " . $Ssid . ", skipping.") false;
|
||||
} else={
|
||||
:local Link ($DailyPskQrCodeUrl . \
|
||||
"?scale=8&level=1&ssid=" . [ $UrlEncode $Ssid ] . "&pass=" . [ $UrlEncode $NewPsk ]);
|
||||
$SendNotification2 ({ origin=$0; \
|
||||
|
@ -84,6 +78,7 @@ $WaitFullyConnected;
|
|||
[ $FormatLine "PSK" $NewPsk ] . "\n" . \
|
||||
[ $FormatLine "Date" $Date ] . "\n\n" . \
|
||||
"A client device specific rule must not exist!"); link=$Link });
|
||||
:set ($Seen->$Ssid) 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue