Port Knock Script

To access TimeShare400’s servers you will need to copy and paste the .bat script below. Paste it into a NOTEPAD document.

REPLACE THE THREE INSTANCES OF “XXXXXX” WITH THE FQDN (i.e. machinename.TIMESHARE400.COM) OR IP ADDRESS THAT YOU USE FOR TELNET. Remember – FQDN is VERY strongly preferred in case we change VPN connections.

Save it to your desktop. BE SURE TO “SAVE AS” as shown below – with a .BAT extension, and with Save as type: set to All Files.

Once you have saved the .bat file, you can double-click it to run it. It takes about 90 seconds to run and opens your connectivity for 24 hours. Read the comments in the .bat file below for more information.

PLEASE NOTE – this script was updated on Aug 22, 2023, about a week after the original script was posted and emailed to everyone. A port number has been changed.

echo off
echo .
echo. (i.e. machinename.TIMESHARE400.COM)
echo . or IP address that you use for your connection to the TimeShare400 server.
echo .
echo . Please save this file somewhere convenient, such as your desktop.
echo . IMPORTANT – PLEASE SAVE AS Portnock.BAT (i.e remove the .txt at the end).
echo .
echo . To run this script, double click on the file on your desktop.
echo .
echo . Port knocking is a simple and effective additional firewall step. If you knock on the right
echo . ports in the right sequence, the firewall will open traffic from your current IP address.
echo .
echo . This process will knock on firewall ports at TimeShare400. It will take a minute or two.
echo . Once this is complete, the firewall will be opened from your current IP address for 24 hours.
echo . You can disconnect and reconnect within 24 hours without re-running this script.
echo .
echo . If you re-run this script before the 24 hours is up, your open time will be reset to 24 hours.
echo . So there is no harm in running this script every time you are preparing to connect.
echo .
echo . If you keep your connection open (for example if your Telnet connection remains connected
echo . and there is occasional traffic (or Keepalive is turned on) your connection should remain
echo . connected, even past the 24 hour mark. Once you disconnect, you will need to rerun this script
echo . in order to re-establish your connection to the TimeShare400 machine.
echo .
echo . Ignore the green box and the messages “Attempting TCP Connect”, “Waiting for response”
echo . and “Waiting for Echo Reply” that may appear.
echo .
echo . This process typically takes about 90 seconds.
echo .
echo .
echo Port Knock 1
powershell “test-netconnection XXXXXX -p 3579” > null
echo .
echo .
echo Port Knock 2
powershell “test-netconnection XXXXXX -p 44226” > null
echo .
echo .
echo Port Knock 3
powershell “test-netconnection XXXXXX -p 6310” > null

BEWARE… WordPress has a bad habit of converting quotes to “smart quotes” (curly left quotes and right quotes) which will screw up the script above. MS Word will do the same damage. We need plain old straight double quotes. I finally figured out how to get WP to stop “helping me” and leave the single quotes alone. If you have trouble running this batch file, look for the curly left and right quotes on the Powershell commands. Replace them with straight double quotes and you should be good to go.