mirror of
https://github.com/gbudny93/RouterOS_Useful_Scripts.git
synced 2025-07-10 10:14:31 +02:00
Initial commit. First release
This commit is contained in:
parent
42c708dcef
commit
d9da45266f
2 changed files with 57 additions and 0 deletions
31
RouterOS_Auto_Firmware_Upgrade.rsc
Normal file
31
RouterOS_Auto_Firmware_Upgrade.rsc
Normal file
|
@ -0,0 +1,31 @@
|
|||
# RouterOS Fucntion
|
||||
# Copyright (c) Grzegorz Budny
|
||||
# Checks if latest firmware is available. Installs it and sends email notification
|
||||
|
||||
:global AutoFirmwareUpgrade do={
|
||||
|
||||
:local currentFirmware [system routerboard get current-firmware];
|
||||
:local upgradeFirmware [system routerboard get upgrade-firmware];
|
||||
:local systemName [/system identity get value-name=name];
|
||||
|
||||
:if ($currentFirmware != $upgradeFirmware) do={
|
||||
|
||||
:log info ("...:::New firmware version found. Upgrading from ".$currentFirmware." to ".$upgradeFirmware.":::...");
|
||||
/system routerboard upgrade;
|
||||
|
||||
:delay 2;
|
||||
|
||||
/tool e-mail send server=$smtpServer port=$smtpPort from=($systemName.$domain) \
|
||||
to=$recipient subject=("Update available on ".$systemName) \
|
||||
body=($systemName." is upgrading to ".$upgradeFirmware.". \
|
||||
\nfirmware version. System is rebooting.");
|
||||
|
||||
:delay 2;
|
||||
|
||||
/system reboot;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$AutoFirmwareUpgrade smtpServer=smtpServer smtpPort=smtpPort domain=example.com \
|
||||
recipient=recipient@example.com;
|
26
RouterOS_PortKnock.rsc
Normal file
26
RouterOS_PortKnock.rsc
Normal file
|
@ -0,0 +1,26 @@
|
|||
# RouterOS Function
|
||||
# Copyright (c) Grzegorz Budny
|
||||
# Port Knock from RouterOS
|
||||
|
||||
:global PortKnock do={
|
||||
|
||||
|
||||
:foreach sourceAddress, destinationPort in $base do={
|
||||
|
||||
:log info "...:::Port Knocking Sequance Started:::...";
|
||||
:log warning ("Knocking to ".$destinationAddress." on port ".$destinationPort." from ".$sourceAddress);
|
||||
|
||||
/system ssh src-address=$sourceAddress port=$destinationPort address=$destinationAddress;
|
||||
|
||||
|
||||
}
|
||||
|
||||
:log info ("...:::Port Knocking Finished check access to ".$destinationAddress);
|
||||
|
||||
}
|
||||
|
||||
:global knockBase {"sourceIP1"="port23"; \
|
||||
"sourceIP2"="port22" \
|
||||
};
|
||||
|
||||
$PortKnock base=$knockBase destinationAddress=destinationIP;
|
Loading…
Add table
Add a link
Reference in a new issue