What
is firewall?
A firewall is software that checks information
coming from the Internet or a network, and then either blocks it or allows it
to pass through to your computer, depending on your firewall settings. It
blocks potentially harmful software components from reaching your computer.
To communicate any executable with the internet,
a rule to be added in the firewall. There are two types of rules based on the
orientation of communication
A.
Inbound Rule: Applies when data
communication is ‘In to Out’ form
B.
Outbound Rule: Applies when data
communication is ‘Out to In’ form
Unlike traditional Vb Scripting method,
Command line method for adding the firewall rule is efficient and easy.
Command Line to add firewall rule:
Netsh.exe advfirewall firewall add rule name="<Rule
Name>" program="<FilePath>" protocol=tcp dir=in
enable=yes action=allow profile=Private
Parameter Description:
·
Name=<Name of the rule you want >
·
program=<”Path of the
executable”>
·
protocol=tcp or udp
·
dir=Inbound(in) or outbound(out) rule
·
enable=yes or no
·
action=allow or block or custom
· profile=Private and/or public and/or domain (To add rule in more than one profile use “,” E.g.: profile=private, domain )
Note: Rule can’t be
added for both the protocols at one time, to do so use separate command with
protocol value replaced. Same applies for “dir” and “action” tags.
Command
Line to Remove firewall rule:
Netsh.exe
advfirewall firewall delete rule "<Rule Name>"
To verify the successful rule addition, type
“wf.msc” in Run
does that mean it can delete multiple rules with * and ? specials? - yanger 7 years ago