commands.sh (949B)
1 #!/bin/sh 2 # 3 # This work is public domain. 4 # Still try to copy me if you can. 5 # by 20h 6 # 7 8 set -x 9 cat windows-telemetry-base-*.txt \ 10 | sort \ 11 | uniq > windows-telemetry-merged.txt 12 13 dig +short -f windows-telemetry-merged.txt \ 14 | grep -v '\.$' > windows-telemetry-merged-ips.txt 15 16 cat windows-telemetry-merged-ips.txt \ 17 | sed 's,\(.*\),/ip firewall address-list add list=windows-telemetry address=\1,' \ 18 > windows-telemetry-merged-ips-commands.txt 19 set +x 20 21 printf "The commands for Mikrotik are now at: %s\n" \ 22 "windows-telemetry-merged-ips-commands.txt" 23 printf "\n" 24 printf "Use the command below to apply them:\n" 25 printf "\n" 26 printf "cat windows-telemetry-merged-ips-commands.txt " 27 printf "| ssh admin@Mikrotik-IP\n" 28 printf "\n" 29 printf "Then add the list 'windows-telemetry' in a blocking chain:\n" 30 printf "\n" 31 printf "echo '/ip firewall filter add chain=output dst-address-list=" 32 printf "windows-telemetry action=drop' | ssh admin@Mikrotik-IP\n" 33