Skip to content

Instantly share code, notes, and snippets.

@elico
elico / wol-device.rsc
Created November 10, 2024 21:20
An example on how to send WOL packet on a RouterOS device on all ports
{
:local nasMacAddress "AA:BB:CC:11:22:33";
/interface
:foreach iface in=[find] do={
:local interfaceName [get $iface name];
/tool/wol interface=$interfaceName mac=$nasMacAddress;
}
}
cmdkey /generic:TERMSRV/192.168.1.100 /user:owner /pass:test1234
@elico
elico / allow-icmpv4-windows.bat
Created November 7, 2024 15:45
Allow ICMPv4 ping on Windows 10 /11 firewall
netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol="icmpv4:8,any" dir=in action=allow
rem "Win server 2022 standard VDYBN-27WPP-V4HQT-9VMD4-VMK7H"
rem "Win server 2022 DC WX4NM-KYWYW-QJJR4-XV3QB-6VM33"
rem "Windows 10/11 pro W269N-WFGWX-YVC9B-4J6C9-T83GX"
rem "Windows 10/11 pro for workstation NRG8B-VKK3Q-CXVCJ-9G2XF-6Q84J"
slmgr /ipk NRG8B-VKK3Q-CXVCJ-9G2XF-6Q84J
slmgr /skms kms.internal.ip-com.co.il
{
if ( ([ /interface/lte/monitor lte1 once as-value ]->"functionality") = "full" ) do={
if ( ([ /interface/lte/monitor lte1 once as-value ]->"access-technology") = "LTE" ) do={
:log info "LTE Connection";
if ( ([ /interface/lte/monitor lte1 once as-value ]->"rsrp") < -95 ) do={
:log info "Low LTE reception";
} else={
:log info "HIGH LTE reception";
}
} else={
$path = "C:\Users\eliez"
### First give system permissions
$identity = "SYSTEM"
$acl = Get-Acl -Path $path
$ace = New-Object System.Security.Accesscontrol.FileSystemAccessRule ($identity, "FullControl", "Allow")
$acl.AddAccessRule($ace)
Set-Acl -Path $path -AclObject $acl
#!/usr/bin/env sh
IPVERSION="$1"
INTERFACE="$2"
case ${IPVERSION} in
4|v4|ipv4|ip4|6|v6|ipv6|ip6)
;;
*)
echo "Missing ip version to remove: 4 or 6"
exit 1
{
:local BridgeName "switch1"
/interface bridge add name=$BridgeName
:for LoopCount from=1 to=24 do={
:put "working on: ether$LoopCount";
/interface bridge port add bridge=$BridgeName interface="ether$LoopCount"
}
}
#!/usr/bin/env sh
apk update
apk add openvswitch openvswitch-bash-completion bash bash-completion openvswitch-doc openvswitch-openrc vim tcpdump ruby ruby-rdoc git
sed -i -e "s@mouse\=a@mouse=r@g" /usr/share/vim/vim*/defaults.vim
grep "mouse=a" /usr/share/vim/vim*/defaults.vim
grep "auto switch0" /etc/network/interfaces >/dev/null
RES="$?"
@elico
elico / email-backup.rsc.j2
Created June 14, 2024 13:35
a simple backup script for RouterOS V7.x
{
:do {
:log info "STARTING BACKUP";
:global customerIdentificationVar;
:local customerIdentification "{{ customer_identifictation }}";
if ( [:len $customerIdentificationVar] > 0 ) do={
:set customerIdentification "$customerIdentificationVar";