0

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.

2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.