Is it possible to block all incoming and outgoing traffic on a Windows XP host via batch file?
Bonus question, I only want to allow 1 outgoing port and all traffic going over that port.
Is it possible to block all incoming and outgoing traffic on a Windows XP host via batch file?
Bonus question, I only want to allow 1 outgoing port and all traffic going over that port.
Use netsh advfirewall firewall
command to configure windows firewall.
See http://technet.microsoft.com/en-us/library/dd734783.aspx#BKMK_3_add for details.
The only method that occurs to me directly via bat file is using netsh commands to severely restrict the internal network settings... filtering and such. I'm still not convinced this will work the way you want. I'm not sure why you would use a bat file method when you could just use a software firewall and just whitelist the traffic as you see fit. However, you may be able to enable or disable a firewall configuration with a bat file that could have the desired effect.
Even if there would be such a command (and there isn't), then you can't block outgoing traffic, as only the newer Windows versions have outgoing firewall support. Use a recent version of Windows.
netsh advfirewall firewall add rule name="BlockPort01" protocol=TCP dir=out remoteport=01 action=block