Tuesday, 16 October 2012

How To Close Ports on Your PC

This'll only work for windows users (unless your unix version OS has netsh).
it's actually quite simple. here's the command for it:

" netsh firewall delete portopening TCP portnumber "

i wrote it all out in a vbs script for you so that it's
automatically run-able. as well as a batch script. so here you are fellas:

.VBS Script

set ss = createobject("wscript.shell")
set ws = wscript
dim PORT
PORT = InputBox("Enter the port you wish to close:")
ss.run "netsh.exe"
ws.sleep 1000
ss.sendkeys "firewall delete portopening TCP " & PORT
ss.sendkeys "{enter}"
ws.sleep 500
'ss.sendkeys "exit"
'ss.sendkeys "{enter}"

.BAT Script

@echo off
title Port Closer
echo Port Closer
set /p port=Type the port number you wish to close here:
netsh firewall delete portopening TCP %port%
msg /w * Port %port% has been closed.