Walter.Web.FireWall.DiskLogger 2024.6.28.953

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
dotnet add package Walter.Web.FireWall.DiskLogger --version 2024.6.28.953
NuGet\Install-Package Walter.Web.FireWall.DiskLogger -Version 2024.6.28.953
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="Walter.Web.FireWall.DiskLogger" Version="2024.6.28.953" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Walter.Web.FireWall.DiskLogger --version 2024.6.28.953
#r "nuget: Walter.Web.FireWall.DiskLogger, 2024.6.28.953"
#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 Walter.Web.FireWall.DiskLogger as a Cake Addin
#addin nuget:?package=Walter.Web.FireWall.DiskLogger&version=2024.6.28.953

// Install Walter.Web.FireWall.DiskLogger as a Cake Tool
#tool nuget:?package=Walter.Web.FireWall.DiskLogger&version=2024.6.28.953

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 Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
2024.6.28.953 32 6/28/2024
2023.11.13.1117 404 11/13/2023
2023.10.26.1502 306 10/29/2023
2023.10.12.1926 376 10/12/2023
2023.9.14.812 407 9/14/2023
2023.9.7.1748 418 9/7/2023
2023.9.7.1241 416 9/7/2023
2023.9.6.1001 396 9/6/2023
2023.9.5.1246 407 9/5/2023
2023.9.5.1032 406 9/5/2023
2023.8.31.1522 445 8/31/2023
2023.8.29.1040 426 8/29/2023
2023.8.17.901 481 8/17/2023
2023.8.9.1314 463 8/9/2023
2023.8.2.750 572 8/2/2023
2023.7.12.830 458 7/12/2023
2023.7.5.1419 584 7/6/2023
2023.6.14.1628 520 6/14/2023
2023.6.11.1304 584 6/11/2023
2023.5.30.1640 590 5/30/2023
2023.5.4.1552 616 5/4/2023
2023.5.1.1524 641 5/1/2023
2023.4.29.910 645 4/29/2023
2023.4.12.1236 634 4/12/2023
2023.3.22.1456 638 3/22/2023
2023.3.14.1356 673 3/14/2023
2023.3.1.810 675 3/1/2023
2023.2.25.11857 724 2/25/2023
2023.2.22.27 695 2/22/2023
2023.2.15.1413 735 2/15/2023
2023.2.11.1628 745 2/11/2023
2023.1.11.534 768 1/11/2023
2022.12.30.711 731 12/30/2022
2022.12.15.1108 773 12/15/2022
2022.12.14.648 758 12/14/2022
2022.11.27.1059 804 11/27/2022
2022.11.21.338 781 11/21/2022
2022.11.14.1819 775 11/14/2022
2022.11.13.917 767 11/13/2022
2022.10.31.740 855 11/1/2022
2022.10.15.652 844 10/15/2022
2022.10.1.810 956 10/1/2022
2022.9.26.1444 921 9/26/2022
2022.9.14.1508 982 9/14/2022
2022.9.14.809 1,030 9/14/2022
2022.9.8.1009 1,030 9/8/2022
2022.8.20.1007 985 8/20/2022
2022.8.1.1 1,012 7/31/2022
2022.7.1300 1,058 7/1/2022
2022.7.31.1016 956 7/31/2022
2022.7.15.841 1,014 7/15/2022
2022.6.21.647 974 6/21/2022
2022.5.18.638 975 5/19/2022
2022.5.16.853 1,040 5/19/2022
2022.5.16.816 990 5/16/2022
2022.5.4.1010 1,034 5/4/2022
2022.4.10.947 1,069 4/10/2022
2022.4.10.925 1,089 4/10/2022
2022.4.10.828 1,087 4/10/2022
2022.4.1.1545 1,123 4/1/2022
2022.3.31.823 1,060 3/31/2022
2022.3.26.1103 1,050 3/26/2022
2022.3.26.820 1,149 3/26/2022
2022.3.25.840 1,077 3/26/2022
2022.2.16.1131 1,136 2/17/2022
2022.2.16.834 1,231 2/17/2022
2022.2.5.1114 1,215 2/5/2022
2022.1.17.1158 1,122 1/17/2022
2022.1.10.1505 1,229 1/10/2022
2022.1.10.537 1,157 1/10/2022
2022.1.5.1139 1,266 1/8/2022
2021.12.28.1452 1,328 12/28/2021
2021.12.16.812 1,113 12/16/2021
2021.11.23.1528 7,360 11/24/2021
2021.11.21.925 1,255 11/22/2021
2021.11.19.1503 1,447 11/22/2021
2021.11.19.847 1,429 11/19/2021
2021.11.18.1824 1,204 11/16/2021
2021.11.10.852 1,232 11/10/2021
2021.11.9.2021 1,389 11/9/2021
2021.11.8.2109 902 11/9/2021
2021.11.8.1612 959 11/8/2021
2021.11.7.1021 1,006 11/8/2021
2021.11.3.1612 1,043 11/4/2021
2021.11.1.1102 1,071 11/1/2021
2021.10.25.1206 1,103 10/25/2021
2021.10.23.1310 1,056 10/25/2021
2021.10.19.1522 1,035 10/19/2021
2021.10.16.1325 1,053 10/18/2021
2021.10.6.1546 943 10/6/2021
2021.10.5.1450 1,153 10/5/2021
2021.10.4.1155 1,090 10/5/2021
2021.10.1.753 1,078 10/1/2021
2021.9.27.1005 985 9/28/2021
2021.9.26.1913 1,074 9/26/2021
2021.9.19.1015 1,123 9/19/2021
2021.9.17.1702 1,050 9/17/2021
2021.9.17.1449 958 9/17/2021
2021.9.13.1600 1,047 9/13/2021
2021.9.12.1100 1,118 9/13/2021
2021.9.11.2004 1,114 9/11/2021
2021.9.9.1110 1,118 9/9/2021
2021.9.7.1901 1,219 9/8/2021
2021.9.7.1121 1,084 9/7/2021
2021.9.6.1518 1,083 9/7/2021
2021.9.4.1124 1,250 9/4/2021
2021.9.2.708 1,029 9/4/2021
2021.9.0.1259 1,106 9/2/2021
2021.8.2200 984 8/23/2021
2021.8.2100 983 8/23/2021
2021.8.22.900 1,081 8/22/2021
2021.8.18.1500 1,135 8/18/2021
2021.8.18.930 1,171 8/18/2021
2021.8.14.1600 1,065 8/16/2021
2021.8.9.1105 1,019 8/9/2021
2021.8.8.1612 1,101 8/8/2021
2021.8.8.1138 1,179 8/8/2021
2021.8.6.1044 1,115 8/6/2021
2021.8.4.1355 1,129 8/5/2021
2021.7.30.2118 1,229 7/31/2021
2021.7.27.926 1,049 7/28/2021
2021.7.23.931 1,112 7/26/2021
2021.7.22.1456 1,016 7/23/2021
2021.7.15.1547 1,260 7/15/2021
2021.7.13.812 1,134 7/13/2021
2021.7.8.1527 1,157 7/10/2021
2021.7.5.1649 1,038 7/5/2021
2021.6.29.1453 1,070 6/30/2021
2021.6.26.1753 1,249 6/27/2021
2021.6.25.1849 1,310 6/25/2021
2021.6.24.1518 1,075 6/24/2021
2021.6.20.729 1,090 6/20/2021
2021.6.15.2006 1,102 6/15/2021
2021.6.14.2025 1,076 6/15/2021
2021.6.13.2035 1,124 6/14/2021
2021.6.12.1154 1,143 6/13/2021
2021.6.9.1120 1,028 6/9/2021
2021.6.3.1509 1,052 6/3/2021
2021.5.31.1533 1,144 5/31/2021
2021.5.31.1415 1,088 5/31/2021
2021.5.24.1128 1,066 5/24/2021
2021.5.24.1019 1,069 5/24/2021
2021.5.12.1054 1,006 5/12/2021
2021.5.12.637 1,129 5/12/2021
2021.5.10.1442 1,227 5/11/2021
2021.5.8.1226 1,020 5/8/2021
2021.5.6.2037 1,011 5/6/2021
2021.5.5.1901 1,042 5/6/2021
2021.5.3.1621 1,069 5/4/2021
2021.5.1.905 1,045 5/1/2021
2021.4.28.1511 978 4/28/2021
2021.4.20.1520 1,056 4/21/2021
2021.4.16.738 984 4/21/2021
2021.4.14.1216 1,149 4/16/2021
2021.4.9.1538 1,058 4/13/2021
2021.4.8.947 1,078 4/13/2021
2021.4.6.1235 1,071 4/6/2021
2021.4.5.1653 1,028 4/5/2021
2021.4.1.913 968 4/1/2021
2021.3.31.2003 1,041 4/1/2021
2021.3.18.1622 1,048 3/18/2021
2021.3.3.1259 1,046 3/3/2021
2021.3.2.1415 1,134 3/2/2021
2021.3.1.11 1,104 2/28/2021
2021.3.1.1 1,075 2/27/2021
2021.3.1 1,067 2/27/2021
2021.2.23.6 1,101 2/23/2021
2021.2.21.1 1,020 2/21/2021
2021.2.20.1 1,090 2/20/2021
2021.2.19.2 1,029 2/19/2021
2021.2.18.6 1,087 2/19/2021
2021.2.16.1 1,079 2/16/2021
2021.2.15.3 1,098 2/15/2021
2021.2.15.1 1,091 2/14/2021
2021.2.14.3 1,024 2/14/2021
2021.2.12.6 1,041 2/12/2021
2021.2.12.2 1,037 2/12/2021
2021.2.11.1 1,129 2/11/2021
2021.2.10.1 1,080 2/10/2021
2021.2.8.1 1,134 2/9/2021
2021.2.7.2 1,110 2/7/2021
2021.2.7.1 1,078 2/6/2021
2020.12.27.6 1,153 12/27/2020
2020.12.27.1 1,117 12/27/2020
2020.12.26.7 1,152 12/27/2020
2020.12.26.5 1,077 12/27/2020
2020.12.26.3 1,117 12/27/2020
2020.12.19.1 1,204 12/19/2020
2020.12.16.1 1,059 12/16/2020
2020.12.15.1 1,140 12/15/2020
2020.12.14.5 1,108 12/14/2020
2020.12.14.4 1,128 12/14/2020
2020.12.14.3 1,094 12/14/2020
2020.12.5.1 1,152 12/5/2020
2020.12.4.4 1,160 12/4/2020
2020.12.4.3 1,117 12/4/2020
2020.12.4.1 1,170 12/4/2020
2020.12.3.1 1,102 12/3/2020
2020.12.2.4 1,133 12/2/2020
2020.12.2.3 1,166 12/2/2020
2020.12.1.1 1,176 12/1/2020
2020.11.28.1 1,123 11/28/2020
2020.11.27.2 1,147 11/27/2020
2020.11.27.1 1,164 11/27/2020
2020.11.25.1 1,108 11/25/2020
2020.11.22.3 1,167 11/23/2020
2020.11.20.1 1,227 11/21/2020
2020.11.19.3 1,179 11/19/2020
2020.11.19.1 1,196 11/19/2020
2020.11.18.2 1,213 11/18/2020
2020.11.17.2 1,207 11/17/2020
2020.11.17.1 1,115 11/17/2020
2020.11.15.1 1,205 11/15/2020
2020.11.14.1 1,214 11/14/2020
2020.11.13.2 1,122 11/13/2020
2020.11.13.1 1,152 11/13/2020
2020.11.12.1 1,146 11/12/2020
2020.11.11.1 1,148 11/11/2020
2020.11.8.1 1,245 11/8/2020
2020.11.7.1 1,203 11/7/2020
2020.11.5.1 1,117 11/5/2020
2020.11.3.1 1,193 11/3/2020
2020.11.1.3 1,163 11/1/2020
2020.11.1.2 1,225 11/1/2020
2020.11.1.1 1,129 11/1/2020
2020.10.30.1 1,231 11/1/2020
2020.10.15.3 1,210 10/15/2020
2020.10.15.2 1,180 10/15/2020
2020.10.14.1 1,174 10/14/2020
2020.10.13.1 1,197 10/13/2020
2020.10.12.2 1,230 10/12/2020
2020.10.12.1 1,163 10/12/2020
2020.10.10.1 1,319 10/10/2020
2020.10.9.6 1,139 10/9/2020
2020.10.9.2 1,135 10/9/2020
2020.10.9.1 1,190 10/9/2020
2020.10.8.1 1,167 10/8/2020
2020.10.6.8 1,230 10/7/2020
2020.10.6.6 1,122 10/7/2020
2020.10.6.5 1,258 10/7/2020
2020.10.6.4 1,141 10/7/2020
2020.10.6.3 1,230 10/7/2020
2020.10.6.2 1,239 10/7/2020
2020.10.6.1 1,189 10/7/2020
2020.10.5.1 1,174 10/6/2020
2020.10.1.3 1,156 10/1/2020
2020.10.1.2 1,158 10/1/2020
2020.10.1.1 1,142 10/1/2020
2020.9.29.10 1,180 9/29/2020
2020.9.29.9 1,192 9/29/2020
2020.9.28.2 1,191 9/28/2020
2020.9.28.1 1,228 9/28/2020
2020.9.25.1 1,313 9/26/2020
2020.9.24.2 1,128 9/24/2020
2020.9.24 1,174 9/24/2020
2020.9.23.2 1,171 9/23/2020
2020.9.23.1 1,188 9/23/2020
2020.9.22.1 1,246 9/22/2020
2020.9.21.1 1,178 9/21/2020
2020.9.17.2 1,205 9/17/2020
2020.9.16.1 1,198 9/16/2020
2020.9.16 1,140 9/16/2020

Major releases that add functionality other than optimization and minor bug fixing
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