Walter.Web.FireWall.DiskLogger
2025.9.1452
Prefix Reserved
dotnet add package Walter.Web.FireWall.DiskLogger --version 2025.9.1452
NuGet\Install-Package Walter.Web.FireWall.DiskLogger -Version 2025.9.1452
<PackageReference Include="Walter.Web.FireWall.DiskLogger" Version="2025.9.1452" />
<PackageVersion Include="Walter.Web.FireWall.DiskLogger" Version="2025.9.1452" />
<PackageReference Include="Walter.Web.FireWall.DiskLogger" />
paket add Walter.Web.FireWall.DiskLogger --version 2025.9.1452
#r "nuget: Walter.Web.FireWall.DiskLogger, 2025.9.1452"
#:package Walter.Web.FireWall.DiskLogger@2025.9.1452
#addin nuget:?package=Walter.Web.FireWall.DiskLogger&version=2025.9.1452
#tool nuget:?package=Walter.Web.FireWall.DiskLogger&version=2025.9.1452
Windows firewall management
You can use the windows firewall from as shown in this class The NuGet package uses the PowerShell command s in combination with a file watcher but there are several ways to interact with a physical firewall from code
/*
To use windows Firewall com object add a reference to %system32%\FirewallAPI.dll
*/
class FireWallHelper
{
const string guidFWPolicy2 = "{E2B3C97F-6AE1-41AC-817A-F6F92166D7DD}";
const string guidRWRule = "{2C5BC43E-3369-4C33-AB0C-BE9469677AF4}";
static Type typeFWPolicy2;
static Type typeFWRule;
static INetFwPolicy2 fwPolicy2;
static FireWallHelper()
{
typeFWPolicy2 = Type.GetTypeFromCLSID(new Guid(guidFWPolicy2));
typeFWRule = Type.GetTypeFromCLSID(new Guid(guidRWRule));
fwPolicy2 = (INetFwPolicy2)Activator.CreateInstance(typeFWPolicy2);
}
public static bool IsPortOpen(int port)
{
EnsureSetup();
Type progID = Type.GetTypeFromProgID("HNetCfg.FwMgr");
INetFwMgr firewall = Activator.CreateInstance(progID) as INetFwMgr;
INetFwOpenPorts ports = firewall.LocalPolicy.CurrentProfile.GloballyOpenPorts;
IEnumerator portEnumerate = ports.GetEnumerator();
while ((portEnumerate.MoveNext()))
{
INetFwOpenPort currentPort = portEnumerate.Current as INetFwOpenPort;
if (currentPort.Port == port)
return true;
}
return false;
}
static INetFwRule MakeRule(IPAddress remoteIP, string ruleName = null)
{
INetFwRule rule = (INetFwRule)Activator.CreateInstance(typeFWRule);
rule.Name = ruleName ?? $"Inbound block IP {remoteIP}";
rule.Description = $"Block inbound traffic from {remoteIP} over TCP port";
rule.Protocol = (int)NET_FW_IP_PROTOCOL_.NET_FW_IP_PROTOCOL_ANY;
rule.RemoteAddresses = remoteIP.ToString();
rule.Direction = NET_FW_RULE_DIRECTION_.NET_FW_RULE_DIR_IN;
rule.Enabled = true;
rule.Grouping = "@firewallapi.dll,-23255";
rule.Profiles = fwPolicy2.CurrentProfileTypes;
return rule;
}
static INetFwRule MakeRule(int port, IPAddress remoteIP, string ruleName = null)
{
INetFwRule rule = (INetFwRule)Activator.CreateInstance(typeFWRule);
rule.Name = ruleName ?? $"Inbound block IP {remoteIP}";
rule.Description = $"Block inbound traffic from {remoteIP} over TCP port {port}";
rule.Protocol = (int)NET_FW_IP_PROTOCOL_.NET_FW_IP_PROTOCOL_ANY;
rule.LocalPorts = port.ToString();
rule.RemoteAddresses = remoteIP.ToString();
rule.Direction = NET_FW_RULE_DIRECTION_.NET_FW_RULE_DIR_IN;
rule.Enabled = true;
rule.Grouping = "@firewallapi.dll,-23255";
rule.Profiles = fwPolicy2.CurrentProfileTypes;
return rule;
}
public static void OpenPort(int port, IPAddress remoteIP, string ruleName = null)
{
EnsureSetup();
var newRule = MakeRule(port, remoteIP, ruleName);
newRule.Enabled = false;
newRule.Action = NET_FW_ACTION_.NET_FW_ACTION_ALLOW;
fwPolicy2.Rules.Add(newRule);
}
public static void ClosePort(int port, IPAddress remoteIP, string ruleName)
{
EnsureSetup();
var newRule = MakeRule(port, remoteIP, ruleName);
newRule.Action = NET_FW_ACTION_.NET_FW_ACTION_BLOCK;
fwPolicy2.Rules.Add(newRule);
}
public static void CloseIP(IPAddress remoteIP, string ruleName)
{
EnsureSetup();
var newRule = MakeRule(remoteIP, ruleName);
newRule.Action = NET_FW_ACTION_.NET_FW_ACTION_BLOCK;
fwPolicy2.Rules.Add(newRule);
}
public static void OpenIP(IPAddress remoteIP, string ruleName)
{
EnsureSetup();
var newRule = MakeRule(remoteIP, ruleName);
newRule.Action = NET_FW_ACTION_.NET_FW_ACTION_ALLOW;
fwPolicy2.Rules.Add(newRule);
}
public static void OpenPort(int port, string applicationName)
{
EnsureSetup();
if (IsPortOpen(port))
return;
INetFwOpenPort openPort = GetInstance("INetOpenPort") as INetFwOpenPort;
openPort.Port = port;
openPort.Protocol = NET_FW_IP_PROTOCOL_.NET_FW_IP_PROTOCOL_TCP;
openPort.Name = applicationName;
INetFwOpenPorts openPorts = sm_fwProfile.GloballyOpenPorts;
openPorts.Add(openPort);
}
public static void ClosePort(int port)
{
EnsureSetup();
if (!IsPortOpen(port))
return;
INetFwOpenPorts ports = sm_fwProfile.GloballyOpenPorts;
ports.Remove(port, NET_FW_IP_PROTOCOL_.NET_FW_IP_PROTOCOL_TCP);
}
private static object GetInstance(string typeName)
{
Type tpResult = null;
switch (typeName)
{
case "INetFwMgr":
tpResult = Type.GetTypeFromCLSID(new Guid("{304CE942-6E39-40D8-943A-B913C40C9CD4}"));
return Activator.CreateInstance(tpResult);
case "INetAuthApp":
tpResult = Type.GetTypeFromCLSID(new Guid("{EC9846B3-2762-4A6B-A214-6ACB603462D2}"));
return Activator.CreateInstance(tpResult);
case "INetOpenPort":
tpResult = Type.GetTypeFromCLSID(new Guid("{0CA545C6-37AD-4A6C-BF92-9F7610067EF5}"));
return Activator.CreateInstance(tpResult);
default:
throw new Exception("Unknown type name: " + typeName);
}
}
private static void EnsureSetup()
{
if (sm_fwProfile != null)
return;
INetFwMgr fwMgr = GetInstance("INetFwMgr") as INetFwMgr;
sm_fwProfile = fwMgr.LocalPolicy.CurrentProfile;
}
private static INetFwProfile sm_fwProfile = null;
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net8.0-windows7.0 is compatible. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net9.0-windows7.0 is compatible. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Walter.Web.FireWall (>= 2025.9.1452)
-
net8.0-windows7.0
- Walter.Web.FireWall (>= 2025.9.1452)
-
net9.0
- Walter.Web.FireWall (>= 2025.9.1452)
-
net9.0-windows7.0
- Walter.Web.FireWall (>= 2025.9.1452)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2025.9.1452 | 207 | 9/28/2025 |
| 2025.8.13.1223 | 233 | 8/13/2025 |
| 2025.7.30.1003 | 160 | 7/30/2025 |
| 2025.7.10.1347 | 220 | 7/10/2025 |
| 2025.6.30.1407 | 212 | 7/1/2025 |
| 2025.6.12.1057 | 387 | 6/12/2025 |
| 2025.4.17.1816 | 296 | 4/17/2025 |
| 2025.3.13.1323 | 256 | 3/13/2025 |
| 2025.2.26.1642 | 175 | 2/26/2025 |
| 2025.2.25.1033 | 191 | 2/26/2025 |
| 2025.2.24.1556 | 207 | 2/25/2025 |
| 2025.2.16.1149 | 203 | 2/19/2025 |
| 2025.2.15.1316 | 210 | 2/15/2025 |
| 2025.1.16.1410 | 180 | 1/16/2025 |
| 2025.1.4.1941 | 218 | 1/4/2025 |
| 2025.1.2.1544 | 197 | 1/3/2025 |
| 2024.12.14.838 | 189 | 12/14/2024 |
| 2024.12.9.1107 | 214 | 12/13/2024 |
Major releases that add functionality other than optimization and minor bug fixing
16 Feb 2025
- Update to .Net 9 SP1
15 November 2024
- Remove support for deprecated framework (6,7) due to the CVE warnings in Microsoft Nuget
packages and no migration options
- Add support for .Net 9
12 October 2023
- Build using SDK-7.0.402 and SDK-6.0.415
- Update Package references
14 June 2023
- Update due to SDK Update 7.0.304, and 6.0.410
12 April 2023
- Update to a new .net 7.0.5 SDK release
14 Mar 2023
- Update NuGet package refferences
22 Feb 2023
- Axel Imani Release (Go live)
15 February 2023
- Update to .net 6.0.406 and 7.0.3
11 January 2023
- update to 7.0.2, 6.0.13 SDK and build tools for 17.4.4
14 December 2022
- Update to .Net SDK 3.1.426, 6.0.404 and 7.0.101
14 November 2022
- Update NuGet Packages
6 November 2022
- Add support for .Net 7
15 November 2022
- Update NuGet package references
1 October 2022
- Update build with new SDK
- Update code sign certificates
14 September 2022
- Update to include new package 6.0.X and Microsoft CVE-2022-38013
02 September 2022
- Please make sure to update servers using this packages due to a security bug in .net
> System.Security.Cryptography.Xml 4.5.0 Moderate https://github.com/advisories/GHSA-2m65-m22p-9wjw
> System.Text.Encodings.Web 4.5.0 Critical https://github.com/advisories/GHSA-ghhp-997w-qr28
15 June 2022
- Update to support .net 6.0.7 and 3.1.27
- Update package references
4 May 2022
- Update NuGet References
15 March 2022
- update to 6.0.3
16 December 2021
- Update to .Net SDK update 14 December for .NET CORE 3.1.416, and .NET 5.0.404 and 6.0.101
9 November 2021
- Fix package dependency on vulnerable packages from Microsoft by upgrading vulnerable packages
08 November 2021
- Update to .Net NuGet packages .NET 6.0.0, .NET 5.0.403 and core 3.1.415
19 September
- Update NuGet packages release for .Net 5.0.10
8 Aug 2021
- update to .NET 6.0 SDK (v6.0.100-preview.6)
30 June 2021
- Add .Net 6.0 binaries to the NuGet package
15 June 2021
- Update to .Net Core 3.1.17 and .Net 5.0.8 SDK
09 June 2021
- Update to .Net SDK 5.0.301 and 3.1.410
31 April 2021
- Update debugger display to improve debugging experience
- Update on incident and communication interfaces
- Improved IFireWall WHOIS query method and include ISP counters
12 April 2021
- Update to new code base after .net security violation fix
22 March 2021
- Performance update
05 March 2021
- Update package reference
12 February 2021
- Framework extension changes
- Update package references
02 January 2021
- Updated terms and conditions to REL. 2021.01.02
29 December 2020
- Update package reference
23 December 2020
- Update package reference
19 December 2020
- Update package references
14 December 2020
- Update package references
12 December 2020
- Update package references
- Compile with Language version 9.0
04 December 2020
- Update package references
22 November 2020
- Update compiler hints improving .net Core 3.1 and .Net 5.0 compiled binaries
11 November 2020
- Update packages and support .Net 5.0
08 November 2020
- Update signatures and NuGet package references
14 October 2020
- Update to .net core 3.1.4
05 October 2020
- Update terms
- update NuGet package references
16 September 2020
- Add post processes support via options
- separate the Firewall integrated disk logging infrastructure to an external NuGet package to align licensing