SHARE
TWEET

Mikrotik port knocking

a guest Mar 23rd, 2020 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. # Script to perform ICMP port knocking
  4. #
  5. # Firewall filters for Mikrotik:
  6. # add action=add-src-to-address-list address-list=tmp_remote address-list-timeout=3m chain=input comment="icmp port knocking" packet-size=125 protocol=icmp src-address-list=icmp_stage2
  7. # add action=add-src-to-address-list address-list=icmp_stage2 address-list-timeout=3s chain=input packet-size=124 protocol=icmp src-address-list=icmp_stage1
  8. # add action=add-src-to-address-list address-list=icmp_stage1 address-list-timeout=3s chain=input packet-size=123 protocol=icmp
  9. #
  10. # Made by: Sunn3h < m [at] sunneh.ru >
  11. #
  12. # Code stylized according to:
  13. # https://google.github.io/styleguide/shell.xml
  14.  
  15. readonly DEST="$1"
  16.  
  17. if [[ -z "${DEST}" ]]; then
  18.   echo "Usage: $0 destination"
  19.   exit
  20. fi
  21.  
  22. now() {
  23.   date +'%Y-%m-%dT%H:%M:%S%z'
  24. }
  25.  
  26. while true; do
  27.     echo "[$(now)]: Ping..."
  28.     ping "${DEST}" -s 95 -c1 -W1 2>&1 >/dev/null
  29.     ping "${DEST}" -s 96 -c1 -W1 2>&1 >/dev/null
  30.     ping "${DEST}" -s 97 -c1 -W1 2>&1 >/dev/null
  31.     sleep 60
  32. done
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top