So I am trying to make a script that blocks a specific IP on my firewall.
I found that the Powershell command is:
New-NetFirewallRule -DisplayName "Name of Scope" -Direction Outbound –LocalPort Any -Protocol TCP -Action Block -RemoteAddress 11.11.11.11/32
Now I'm not sure if that shell command is good or not but It's just what I found.
Now to execute a powershell command through python I read that I need to use either os.system()
or subprocess.Popen
.
Would anyone be kind enough to tell me how to perform this task please since what I tried didn't work.