KempDec.NetWindowsFirewall.Legacy 1.0.1

Suggested Alternatives

KempDec.NetWindowsFirewall

dotnet add package KempDec.NetWindowsFirewall.Legacy --version 1.0.1
NuGet\Install-Package KempDec.NetWindowsFirewall.Legacy -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="KempDec.NetWindowsFirewall.Legacy" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add KempDec.NetWindowsFirewall.Legacy --version 1.0.1
#r "nuget: KempDec.NetWindowsFirewall.Legacy, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install KempDec.NetWindowsFirewall.Legacy as a Cake Addin
#addin nuget:?package=KempDec.NetWindowsFirewall.Legacy&version=1.0.1

// Install KempDec.NetWindowsFirewall.Legacy as a Cake Tool
#tool nuget:?package=KempDec.NetWindowsFirewall.Legacy&version=1.0.1

NetWindowsFirewall Legacy

NetWindowsFirewall Legacy é uma micro biblioetca com métodos auxiliares para gerenciar o Firewall do Windows para .NET Framework 4.8.

A biblioteca COM NetFwTypeLib é usada para gerenciar o Firewall do Windows pelo NetWindowsFirewall.

Veja NetWindowsFirewall para .NET 8 ou superior

Instalação

Instale a biblioteca a partir do NuGet.

Install-Package KempDec.NetWindowsFirewall.Legacy

Como usar

Você pode usar a instância estática, obtida através de NetWindowsFirewall.Instance, como no exemplo abaixo:

var ipAddress = IPAddress.Parse("127.0.0.1");

// Adiciona uma regra de bloqueio (de entrada) para o endereço de IP "127.0.1" no Firewall do Windows.
NetWindowsFirewall.Instance.AddBlockInIpRule($"IP {ipAddress} bloqueado", ipAddress);

// Adiciona uma regra de bloqueio (de saída) para o endereço de IP "127.0.0.1" no Firewall do Windows.
NetWindowsFirewall.Instance.AddBlockOutIpRule($"IP {ipAddress} bloqueado", ipAddress);

Ou você pode usar a partir de uma nova instância criada manualmente:

var ipAddress = IPAddress.Parse("127.0.0.1");
var netWindowsFirewall = new NetWindowsFirewall();

// Adiciona uma regra de bloqueio (de entrada) para o endereço de IP "127.0.1" no Firewall do Windows.
netWindowsFirewall.AddBlockInIpRule($"IP {ipAddress} bloqueado", ipAddress);

// Adiciona uma regra de bloqueio (de saída) para o endereço de IP "127.0.0.1" no Firewall do Windows.
netWindowsFirewall.AddBlockOutIpRule($"IP {ipAddress} bloqueado", ipAddress);

Colaboração

Ajude-nos a deixar a biblioteca de código aberto cada vez melhor, criando um pull request.

Autores

Licença

MIT

Product Compatible and additional computed target framework versions.
.NET Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.8

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on KempDec.NetWindowsFirewall.Legacy:

Package Downloads
TankShield.Legacy

TankShield Legacy é uma pequena biblioteca que pode ser usada para evitar ataques no jogo DDTank para .NET Framework 4.8.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 118 2/9/2024
1.0.0 104 2/9/2024