├── .gitignore ├── README.md ├── cs ├── AllExceptFilter │ ├── AllExceptFilter.csproj │ ├── App.config │ ├── Program.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── BlockerRequests │ ├── App.config │ ├── BlockerRequests.csproj │ ├── Program.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── EnterRegistrationData │ ├── App.config │ ├── EnterRegistrationData.csproj │ ├── Program.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── FilterAndRuleUpdate │ ├── App.config │ ├── FilterAndRuleUpdate.csproj │ ├── Program.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── FilterNodeLoader │ ├── App.config │ ├── FilterNodeLoader.csproj │ ├── Program.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── LimitForApplication │ ├── App.config │ ├── LimitForApplication.csproj │ ├── Program.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── LimitForComputer │ ├── App.config │ ├── LimitForComputer.csproj │ ├── Program.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── LimitForInternetZone │ ├── App.config │ ├── LimitForInternetZone.csproj │ ├── Program.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── NLApiSamples.sln ├── Permissions │ ├── App.config │ ├── Permissions.csproj │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── packages.config ├── QuotaWithRule │ ├── App.config │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── QuotaWithRule.csproj │ └── packages.config └── ScheduledRule │ ├── App.config │ ├── Program.cs │ ├── Properties │ └── AssemblyInfo.cs │ └── ScheduledRule.csproj └── ps └── permissions.ps1 /.gitignore: -------------------------------------------------------------------------------- 1 | ## BEGIN: My ignores 2 | 3 | # Build results 4 | [Vv]ista[Dd]ebug 5 | [Vv]ista[Rr]elease 6 | [Ww]in7[Dd]ebug 7 | [Ww]in7[Rr]elease 8 | [Ww]in8[Dd]ebug 9 | [Ww]in8[Rr]elease 10 | [Ww]in8.1[Dd]ebug 11 | [Ww]in8.1[Rr]elease 12 | [Ww]in10[Dd]ebug 13 | [Ww]in10[Rr]elease 14 | 15 | *.vcxproj.backup 16 | **/*.i.cache 17 | 18 | ## END: My ignores 19 | 20 | ## Ignore Visual Studio temporary files, build results, and 21 | ## files generated by popular Visual Studio add-ons. 22 | ## 23 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 24 | 25 | # User-specific files 26 | *.rsuser 27 | *.suo 28 | *.user 29 | *.userosscache 30 | *.sln.docstates 31 | 32 | # User-specific files (MonoDevelop/Xamarin Studio) 33 | *.userprefs 34 | 35 | # Build results 36 | [Dd]ebug/ 37 | [Dd]ebugPublic/ 38 | [Rr]elease/ 39 | [Rr]eleases/ 40 | x64/ 41 | x86/ 42 | [Aa][Rr][Mm]/ 43 | [Aa][Rr][Mm]64/ 44 | bld/ 45 | [Bb]in/ 46 | [Oo]bj/ 47 | [Ll]og/ 48 | 49 | # Visual Studio 2015/2017 cache/options directory 50 | .vs/ 51 | # Uncomment if you have tasks that create the project's static files in wwwroot 52 | #wwwroot/ 53 | 54 | # Visual Studio 2017 auto generated files 55 | Generated\ Files/ 56 | 57 | # MSTest test Results 58 | [Tt]est[Rr]esult*/ 59 | [Bb]uild[Ll]og.* 60 | 61 | # NUNIT 62 | *.VisualState.xml 63 | TestResult.xml 64 | 65 | # Build Results of an ATL Project 66 | [Dd]ebugPS/ 67 | [Rr]eleasePS/ 68 | dlldata.c 69 | 70 | # Benchmark Results 71 | BenchmarkDotNet.Artifacts/ 72 | 73 | # .NET Core 74 | project.lock.json 75 | project.fragment.lock.json 76 | artifacts/ 77 | 78 | # StyleCop 79 | StyleCopReport.xml 80 | 81 | # Files built by Visual Studio 82 | *_i.c 83 | *_p.c 84 | *_h.h 85 | *.ilk 86 | *.meta 87 | *.obj 88 | *.iobj 89 | *.pch 90 | *.pdb 91 | *.ipdb 92 | *.pgc 93 | *.pgd 94 | *.rsp 95 | *.sbr 96 | *.tlb 97 | *.tli 98 | *.tlh 99 | *.tmp 100 | *.tmp_proj 101 | *_wpftmp.csproj 102 | *.log 103 | *.vspscc 104 | *.vssscc 105 | .builds 106 | *.pidb 107 | *.svclog 108 | *.scc 109 | 110 | # Chutzpah Test files 111 | _Chutzpah* 112 | 113 | # Visual C++ cache files 114 | ipch/ 115 | *.aps 116 | *.ncb 117 | *.opendb 118 | *.opensdf 119 | *.sdf 120 | *.cachefile 121 | *.VC.db 122 | *.VC.VC.opendb 123 | 124 | # Visual Studio profiler 125 | *.psess 126 | *.vsp 127 | *.vspx 128 | *.sap 129 | 130 | # Visual Studio Trace Files 131 | *.e2e 132 | 133 | # TFS 2012 Local Workspace 134 | $tf/ 135 | 136 | # Guidance Automation Toolkit 137 | *.gpState 138 | 139 | # ReSharper is a .NET coding add-in 140 | _ReSharper*/ 141 | *.[Rr]e[Ss]harper 142 | *.DotSettings.user 143 | 144 | # JustCode is a .NET coding add-in 145 | .JustCode 146 | 147 | # TeamCity is a build add-in 148 | _TeamCity* 149 | 150 | # DotCover is a Code Coverage Tool 151 | *.dotCover 152 | 153 | # AxoCover is a Code Coverage Tool 154 | .axoCover/* 155 | !.axoCover/settings.json 156 | 157 | # Visual Studio code coverage results 158 | *.coverage 159 | *.coveragexml 160 | 161 | # NCrunch 162 | _NCrunch_* 163 | .*crunch*.local.xml 164 | nCrunchTemp_* 165 | 166 | # MightyMoose 167 | *.mm.* 168 | AutoTest.Net/ 169 | 170 | # Web workbench (sass) 171 | .sass-cache/ 172 | 173 | # Installshield output folder 174 | [Ee]xpress/ 175 | 176 | # DocProject is a documentation generator add-in 177 | DocProject/buildhelp/ 178 | DocProject/Help/*.HxT 179 | DocProject/Help/*.HxC 180 | DocProject/Help/*.hhc 181 | DocProject/Help/*.hhk 182 | DocProject/Help/*.hhp 183 | DocProject/Help/Html2 184 | DocProject/Help/html 185 | 186 | # Click-Once directory 187 | publish/ 188 | 189 | # Publish Web Output 190 | *.[Pp]ublish.xml 191 | *.azurePubxml 192 | # Note: Comment the next line if you want to checkin your web deploy settings, 193 | # but database connection strings (with potential passwords) will be unencrypted 194 | *.pubxml 195 | *.publishproj 196 | 197 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 198 | # checkin your Azure Web App publish settings, but sensitive information contained 199 | # in these scripts will be unencrypted 200 | PublishScripts/ 201 | 202 | # NuGet Packages 203 | *.nupkg 204 | # The packages folder can be ignored because of Package Restore 205 | **/[Pp]ackages/* 206 | # except build/, which is used as an MSBuild target. 207 | !**/[Pp]ackages/build/ 208 | # Uncomment if necessary however generally it will be regenerated when needed 209 | #!**/[Pp]ackages/repositories.config 210 | # NuGet v3's project.json files produces more ignorable files 211 | *.nuget.props 212 | *.nuget.targets 213 | 214 | # Microsoft Azure Build Output 215 | csx/ 216 | *.build.csdef 217 | 218 | # Microsoft Azure Emulator 219 | ecf/ 220 | rcf/ 221 | 222 | # Windows Store app package directories and files 223 | AppPackages/ 224 | BundleArtifacts/ 225 | Package.StoreAssociation.xml 226 | _pkginfo.txt 227 | *.appx 228 | 229 | # Visual Studio cache files 230 | # files ending in .cache can be ignored 231 | *.[Cc]ache 232 | # but keep track of directories ending in .cache 233 | !*.[Cc]ache/ 234 | 235 | # Others 236 | ClientBin/ 237 | ~$* 238 | *~ 239 | *.dbmdl 240 | *.dbproj.schemaview 241 | *.jfm 242 | *.pfx 243 | *.publishsettings 244 | orleans.codegen.cs 245 | 246 | # Including strong name files can present a security risk 247 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 248 | #*.snk 249 | 250 | # Since there are multiple workflows, uncomment next line to ignore bower_components 251 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 252 | #bower_components/ 253 | # ASP.NET Core default setup: bower directory is configured as wwwroot/lib/ and bower restore is true 254 | **/wwwroot/lib/ 255 | 256 | # RIA/Silverlight projects 257 | Generated_Code/ 258 | 259 | # Backup & report files from converting an old project file 260 | # to a newer Visual Studio version. Backup files are not needed, 261 | # because we have git ;-) 262 | _UpgradeReport_Files/ 263 | Backup*/ 264 | UpgradeLog*.XML 265 | UpgradeLog*.htm 266 | ServiceFabricBackup/ 267 | *.rptproj.bak 268 | 269 | # SQL Server files 270 | *.mdf 271 | *.ldf 272 | *.ndf 273 | 274 | # Business Intelligence projects 275 | *.rdl.data 276 | *.bim.layout 277 | *.bim_*.settings 278 | *.rptproj.rsuser 279 | 280 | # Microsoft Fakes 281 | FakesAssemblies/ 282 | 283 | # GhostDoc plugin setting file 284 | *.GhostDoc.xml 285 | 286 | # Node.js Tools for Visual Studio 287 | .ntvs_analysis.dat 288 | node_modules/ 289 | 290 | # Visual Studio 6 build log 291 | *.plg 292 | 293 | # Visual Studio 6 workspace options file 294 | *.opt 295 | 296 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 297 | *.vbw 298 | 299 | # Visual Studio LightSwitch build output 300 | **/*.HTMLClient/GeneratedArtifacts 301 | **/*.DesktopClient/GeneratedArtifacts 302 | **/*.DesktopClient/ModelManifest.xml 303 | **/*.Server/GeneratedArtifacts 304 | **/*.Server/ModelManifest.xml 305 | _Pvt_Extensions 306 | 307 | # Paket dependency manager 308 | .paket/paket.exe 309 | paket-files/ 310 | 311 | # FAKE - F# Make 312 | .fake/ 313 | 314 | # JetBrains Rider 315 | .idea/ 316 | *.sln.iml 317 | 318 | # CodeRush personal settings 319 | .cr/personal 320 | 321 | # Python Tools for Visual Studio (PTVS) 322 | __pycache__/ 323 | *.pyc 324 | 325 | # Cake - Uncomment if you are using it 326 | # tools/** 327 | # !tools/packages.config 328 | 329 | # Tabs Studio 330 | *.tss 331 | 332 | # Telerik's JustMock configuration file 333 | *.jmconfig 334 | 335 | # BizTalk build output 336 | *.btp.cs 337 | *.btm.cs 338 | *.odx.cs 339 | *.xsd.cs 340 | 341 | # OpenCover UI analysis results 342 | OpenCover/ 343 | 344 | # Azure Stream Analytics local run output 345 | ASALocalRun/ 346 | 347 | # MSBuild Binary and Structured Log 348 | *.binlog 349 | 350 | # NVidia Nsight GPU debugger configuration file 351 | *.nvuser 352 | 353 | # MFractors (Xamarin productivity tool) working folder 354 | .mfractor/ 355 | 356 | # Local History for Visual Studio 357 | .localhistory/ 358 | /InstallationData/Prerequisites 359 | /setup 360 | /CoreLibs/CoreLibCpp/CoreLibDrv/WfpBase/Win10Release 361 | /CoreLibs/CoreLibCpp/CoreLibDrv/Win10Release 362 | /nldrv/NLCore/Win10Release 363 | /nldrv/NLWfp/Win10Release 364 | /nldrv/Win10Release 365 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NetLimiterAPISamples 2 | 3 | ## About the NetLimiter API 4 | The NetLimiter API is used to control machine which is running **NetLimiter 4.1.1** or later. All functinality available in NetLimiter is accessible via the API. It's possible to create filters, rules, monitor network activity etc. Our official **NetLimiter Client** (GUI) is whole built above the API too. 5 | Currently, there is no documentation except this Readme file and the API samples. We will add more information on an ongoing basis. 6 | 7 | ## C# samples 8 | - The samples were created using **Visual Studio 2019**. They work with earlier 2017 version too. 9 | - Most of the samples are .NET framework console application. 10 | - Samples are kept as simple as possible so the counstructs like try/catch etc. are usually omitted. 11 | - NetLimiter nuget package (the API) is added to each project. 12 | - For security reasons, application must run elevated in order to modify NetLimiter service settings. It's possible to disable this requirement (see below). 13 | 14 | ## How to create project in Visual Studio 15 | 1. Create .NET framework project 16 | 2. Add ***NetLimiter*** nuget package 17 | 3. Use the API (check our samples) 18 | 19 | ## About the NetLimiter nuget package 20 | https://www.nuget.org/packages/NetLimiter 21 | - NetLimiter 4.1.2 API nuget package is no more dependent on NLog logging library. 22 | - **NetLimiter 4.1.1** or later must be installed on the machine you are connecting to (usually local machine). 23 | 24 | ## How to allow non-elevated client to modify NetLimiter settings 25 | In NetLimiter [configuration file](https://netlimiter.com/docs/internals/xml-configuration-file) set ***RequireElevationLocal*** to false: 26 | 27 | false 28 | 29 | For questions and comments: [support@netlimiter.com](mailto://support@netlimier.com) 30 | -------------------------------------------------------------------------------- /cs/AllExceptFilter/AllExceptFilter.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {C90C1A56-95BD-499F-9792-FB9A41C4345F} 8 | Exe 9 | AllExceptFilter 10 | AllExceptFilter 11 | v4.6.2 12 | 512 13 | true 14 | true 15 | 16 | 17 | 18 | AnyCPU 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | AnyCPU 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | 36 | 37 | true 38 | bin\x64\Debug\ 39 | DEBUG;TRACE 40 | full 41 | x64 42 | 7.3 43 | prompt 44 | true 45 | 46 | 47 | bin\x64\Release\ 48 | TRACE 49 | true 50 | pdbonly 51 | x64 52 | 7.3 53 | prompt 54 | true 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 5.3.18 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /cs/AllExceptFilter/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /cs/AllExceptFilter/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using NetLimiter.Service; 7 | using CoreLib.Net; 8 | 9 | namespace NLApiSamples 10 | { 11 | class Program 12 | { 13 | static void Main(string[] args) 14 | { 15 | using (NLClient client = new NLClient()) 16 | { 17 | // Connect to local NetLimiter service 18 | client.Connect(); 19 | 20 | Filter filter; 21 | 22 | // Create a filter for whole computer, but by-pass system services - all "system" and svchost.exe processes 23 | filter = new Filter("AllExceptSystemServices"); 24 | 25 | FFPathEqual filterFunction = new FFPathEqual(); 26 | filterFunction.IsMatch = false; // catch all traffic that DOESN'T match the value 27 | filterFunction.Values.Add(@"system"); // system process 28 | filterFunction.Values.Add(@"c:\windows\system32\svchost.exe"); // path - it could be different on your machine 29 | 30 | filter.Functions.Add(filterFunction); 31 | 32 | client.AddFilter(filter); 33 | 34 | Console.WriteLine("Press ENTER to delete the filter and Exit."); 35 | Console.ReadKey(); 36 | 37 | // Remove filter 38 | client.RemoveFilter(filter); 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /cs/AllExceptFilter/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("AllExceptFilter")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("AllExceptFilter")] 13 | [assembly: AssemblyCopyright("Copyright © 2020")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("c90c1a56-95bd-499f-9792-fb9a41c4345f")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /cs/BlockerRequests/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /cs/BlockerRequests/BlockerRequests.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {F22A44E4-74B3-4968-91F7-1CD71C0E6467} 8 | Exe 9 | BlockerRequests 10 | BlockerRequests 11 | v4.6.2 12 | 512 13 | true 14 | true 15 | 16 | 17 | 18 | AnyCPU 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | AnyCPU 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | 36 | 37 | true 38 | bin\x64\Debug\ 39 | DEBUG;TRACE 40 | full 41 | x64 42 | prompt 43 | MinimumRecommendedRules.ruleset 44 | true 45 | 46 | 47 | bin\x64\Release\ 48 | TRACE 49 | true 50 | pdbonly 51 | x64 52 | prompt 53 | MinimumRecommendedRules.ruleset 54 | true 55 | 56 | 57 | true 58 | bin\x86\Debug\ 59 | DEBUG;TRACE 60 | full 61 | x86 62 | prompt 63 | MinimumRecommendedRules.ruleset 64 | true 65 | 66 | 67 | bin\x86\Release\ 68 | TRACE 69 | true 70 | pdbonly 71 | x86 72 | prompt 73 | MinimumRecommendedRules.ruleset 74 | true 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 5.3.18 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /cs/BlockerRequests/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using NetLimiter.Service; 8 | 9 | namespace NLApiSamples 10 | { 11 | class Program 12 | { 13 | static void Main(string[] args) 14 | { 15 | using (NLClient client = new NLClient()) 16 | { 17 | // Connect to local NetLimiter service 18 | client.Connect(); 19 | 20 | // Register event handler - it is called every time when there are any Blocker requests 21 | client.FirewallRequestChange += (s, a) => 22 | { 23 | foreach (var request in client.FirewallRequests) 24 | { 25 | // Reply to all requests, by returning BLOCK 26 | client.ReplyFirewallRequest(request, FwAction.Block); 27 | 28 | Console.WriteLine( 29 | $"Denied: {request.LocalAddress}:{request.LocalPort}/{request.RemoteAddress}:{request.RemotePort} - {request.AppId}"); 30 | } 31 | }; 32 | 33 | Filter internetZone = client.GetInternetZone(); 34 | 35 | // Save current blocker state 36 | bool fwEnabledPrevState = client.IsFwEnabled; 37 | 38 | // Enable blocker 39 | client.IsFwEnabled = true; 40 | 41 | try 42 | { 43 | // Create rule asking for all outgoing connections on Internet zone 44 | Rule rule = new FwRule(RuleDir.Out, FwAction.Ask); 45 | client.AddRule(internetZone.Id, rule); 46 | 47 | Console.WriteLine("Press any key to restore previous settings and close"); 48 | Console.ReadKey(); 49 | 50 | // Remove the rule 51 | client.RemoveRule(rule); 52 | } 53 | finally 54 | { 55 | // Restore blocker state 56 | client.IsFwEnabled = fwEnabledPrevState; 57 | } 58 | 59 | } 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /cs/BlockerRequests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("NLApiSamples")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("NLApiSamples")] 13 | [assembly: AssemblyCopyright("Copyright © 2018")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("f22a44e4-74b3-4968-91f7-1cd71c0e6467")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /cs/EnterRegistrationData/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /cs/EnterRegistrationData/EnterRegistrationData.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {B9BDB36A-1F44-4002-989D-001D947F596A} 8 | Exe 9 | EnterRegistrationData 10 | EnterRegistrationData 11 | v4.6.2 12 | 512 13 | true 14 | true 15 | 16 | 17 | 18 | AnyCPU 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | AnyCPU 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | 36 | 37 | true 38 | bin\x64\Debug\ 39 | DEBUG;TRACE 40 | full 41 | x64 42 | 7.3 43 | prompt 44 | true 45 | 46 | 47 | bin\x64\Release\ 48 | TRACE 49 | true 50 | pdbonly 51 | x64 52 | 7.3 53 | prompt 54 | true 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 5.3.18 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /cs/EnterRegistrationData/Program.cs: -------------------------------------------------------------------------------- 1 | using NetLimiter.Service; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace NLApiSamples 9 | { 10 | internal class Program 11 | { 12 | static async Task Main(string[] args) 13 | { 14 | using (NLClient client = new NLClient()) 15 | { 16 | // Listen for license changes 17 | client.LicenseChanged += OnLicenseChanged; 18 | 19 | // Connect to local NetLimiter service 20 | client.Connect(); 21 | 22 | Console.WriteLine($"Prior registration: IsRegistered={client.License.IsRegistered}"); 23 | 24 | try 25 | { 26 | await client.SetRegistrationCodeAsync("FBT7X-BDGTY-JLYKL-4NDFJ-W5Q1E"); 27 | 28 | Console.WriteLine($"After registration: IsRegistered={client.License.IsRegistered}"); 29 | 30 | client.RemoveRegistrationData(); 31 | 32 | Console.WriteLine($"After unregistration: IsRegistered={client.License.IsRegistered}"); 33 | } 34 | catch (Exception ex) 35 | { 36 | Console.WriteLine("Error: " + ex.Message); 37 | } 38 | } 39 | } 40 | 41 | /// 42 | /// Event handler called even if the registration data are changed from other clients like NetLimiter GUI. 43 | /// 44 | private static void OnLicenseChanged(object sender, EventArgs e) 45 | { 46 | if (sender is NLClient client) 47 | { 48 | Console.WriteLine($"OnLicenseChanged: IsRegistered={client.License.IsRegistered}, DaysLeft={client.License.DaysLeft}"); 49 | } 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /cs/EnterRegistrationData/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("EnterRegistrationData")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("EnterRegistrationData")] 13 | [assembly: AssemblyCopyright("Copyright © 2020")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("b9bdb36a-1f44-4002-989d-001d947f596a")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /cs/FilterAndRuleUpdate/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /cs/FilterAndRuleUpdate/FilterAndRuleUpdate.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {DC4E55E1-5F6F-4238-A7A3-7A0608E4A2FB} 8 | Exe 9 | FilterAndRuleUpdate 10 | FilterAndRuleUpdate 11 | v4.6.2 12 | 512 13 | true 14 | true 15 | 16 | 17 | 18 | AnyCPU 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | AnyCPU 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | 36 | 37 | true 38 | bin\x64\Debug\ 39 | DEBUG;TRACE 40 | full 41 | x64 42 | 7.3 43 | prompt 44 | true 45 | 46 | 47 | bin\x64\Release\ 48 | TRACE 49 | true 50 | pdbonly 51 | x64 52 | 7.3 53 | prompt 54 | true 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 5.3.18 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /cs/FilterAndRuleUpdate/Program.cs: -------------------------------------------------------------------------------- 1 | using NetLimiter.Service; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace NLApiSamples 9 | { 10 | class Program 11 | { 12 | static void Main(string[] args) 13 | { 14 | using (NLClient client = new NLClient()) 15 | { 16 | // Connect to local NetLimiter service 17 | client.Connect(); 18 | 19 | // Create filter for apps 20 | Filter filter = new Filter("MyFilter"); 21 | filter.Functions.Add(new FFPathEqual("*\\chrome.exe")); 22 | 23 | // Add the filter to the NetLimiter service 24 | filter = client.AddFilter(filter); 25 | 26 | // Create ALLOW rule 27 | Rule rule = new FwRule(RuleDir.Both, FwAction.Allow); 28 | 29 | // Add the rule to the NetLimiter service 30 | rule = client.AddRule(filter.Id, rule); 31 | 32 | Console.WriteLine("Press any key to update the filter and rule"); 33 | Console.ReadKey(); 34 | 35 | // Update filter name 36 | filter.Name = "MyChromeFilter"; 37 | client.UpdateFilter(filter); 38 | 39 | // Disable the rule 40 | rule.IsEnabled = false; 41 | client.UpdateRule(rule); 42 | 43 | Console.WriteLine("Press any key to exit"); 44 | Console.ReadKey(); 45 | 46 | client.RemoveFilter(filter); 47 | } 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /cs/FilterAndRuleUpdate/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("FilterAndRuleUpdate")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("FilterAndRuleUpdate")] 13 | [assembly: AssemblyCopyright("Copyright © 2020")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("dc4e55e1-5f6f-4238-a7a3-7a0608e4a2fb")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /cs/FilterNodeLoader/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /cs/FilterNodeLoader/FilterNodeLoader.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {2D831DEF-FD40-4AC7-8379-6A6146496A73} 8 | Exe 9 | FilterNodeLoader 10 | FilterNodeLoader 11 | v4.6.2 12 | 512 13 | true 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | true 37 | bin\x64\Debug\ 38 | DEBUG;TRACE 39 | full 40 | x64 41 | 7.3 42 | prompt 43 | true 44 | 45 | 46 | bin\x64\Release\ 47 | TRACE 48 | true 49 | pdbonly 50 | x64 51 | 7.3 52 | prompt 53 | true 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 5.3.18 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /cs/FilterNodeLoader/Program.cs: -------------------------------------------------------------------------------- 1 | using NetLimiter.Service; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace FilterNodeLoader 9 | { 10 | internal class Program 11 | { 12 | static void Main(string[] args) 13 | { 14 | using (NLClient client = new NLClient()) 15 | { 16 | // Connect to local NetLimiter service 17 | client.Connect(); 18 | 19 | var nodeLoader = client.CreateNodeLoader(); 20 | 21 | nodeLoader.Filters.SelectAll(); 22 | 23 | nodeLoader.Load(); 24 | 25 | foreach (var filterNode in nodeLoader.Filters.Nodes) 26 | { 27 | if (client.Filters.FirstOrDefault(x => x.InternalId == filterNode.FilterId) is Filter filter) 28 | { 29 | Console.WriteLine($"Filter loaded: name={filter.Name}, received(B)={filterNode.Transferred.In}, sent(B)={filterNode.Transferred.Out}"); 30 | } 31 | } 32 | 33 | Console.WriteLine("Press any key to exit."); 34 | Console.ReadKey(); 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /cs/FilterNodeLoader/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("FilterNodeLoader")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("FilterNodeLoader")] 13 | [assembly: AssemblyCopyright("Copyright © 2024")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("2d831def-fd40-4ac7-8379-6a6146496a73")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /cs/LimitForApplication/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /cs/LimitForApplication/LimitForApplication.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {FE10C621-71EC-452E-A30F-69567F7ED8DF} 8 | Exe 9 | LimitForApplication 10 | LimitForApplication 11 | v4.6.2 12 | 512 13 | true 14 | true 15 | 16 | 17 | 18 | AnyCPU 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | AnyCPU 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | 36 | 37 | true 38 | bin\x64\Debug\ 39 | DEBUG;TRACE 40 | full 41 | x64 42 | prompt 43 | MinimumRecommendedRules.ruleset 44 | true 45 | 46 | 47 | bin\x64\Release\ 48 | TRACE 49 | true 50 | pdbonly 51 | x64 52 | prompt 53 | MinimumRecommendedRules.ruleset 54 | true 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 5.3.18 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /cs/LimitForApplication/Program.cs: -------------------------------------------------------------------------------- 1 | using NetLimiter.Service; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace NLApiSamples 9 | { 10 | class Program 11 | { 12 | static void Main(string[] args) 13 | { 14 | using (NLClient client = new NLClient()) 15 | { 16 | // Connect to local NetLimiter service 17 | client.Connect(); 18 | 19 | // Create filter named MyMSEdgeFilter 20 | Filter filter = new Filter("MyMSEdgeFilter"); 21 | 22 | // Add filter function to match the application path 23 | filter.Functions.Add(new FFAppIdEqual(new AppId(@"c:\program files (x86)\microsoft\edge dev\application\msedge.exe"))); 24 | 25 | client.AddFilter(filter); 26 | 27 | // Create limit rule. The limit is set to 512 KB/s 28 | client.AddRule(filter.Id, new LimitRule(RuleDir.In, 512 * 1024)); 29 | 30 | Console.WriteLine("Press any key to delete the filter"); 31 | Console.ReadKey(); 32 | 33 | // Remove the filter. The rule will be removed as well. 34 | client.RemoveFilter(filter); 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /cs/LimitForApplication/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("LimitForApplication")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("LimitForApplication")] 13 | [assembly: AssemblyCopyright("Copyright © 2020")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("fe10c621-71ec-452e-a30f-69567f7ed8df")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /cs/LimitForComputer/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /cs/LimitForComputer/LimitForComputer.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {CA478A10-53F4-443D-BA24-668571BD6F0F} 8 | Exe 9 | LimitForComputer 10 | LimitForComputer 11 | v4.6.2 12 | 512 13 | true 14 | true 15 | 16 | 17 | 18 | AnyCPU 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | AnyCPU 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | 36 | 37 | true 38 | bin\x64\Debug\ 39 | DEBUG;TRACE 40 | full 41 | x64 42 | prompt 43 | MinimumRecommendedRules.ruleset 44 | true 45 | 46 | 47 | bin\x64\Release\ 48 | TRACE 49 | true 50 | pdbonly 51 | x64 52 | prompt 53 | MinimumRecommendedRules.ruleset 54 | true 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 5.3.18 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /cs/LimitForComputer/Program.cs: -------------------------------------------------------------------------------- 1 | using NetLimiter.Service; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace NLApiSamples 9 | { 10 | class Program 11 | { 12 | static void Main(string[] args) 13 | { 14 | using (NLClient client = new NLClient()) 15 | { 16 | // Connect to local NetLimiter service 17 | client.Connect(); 18 | 19 | Filter filter = new Filter("WholeMachineFilter"); 20 | 21 | client.AddFilter(filter); 22 | 23 | client.AddRule(filter.Id, new LimitRule(RuleDir.In, 512 * 1024)); 24 | 25 | Console.WriteLine("Press any key to delete the filter"); 26 | Console.ReadKey(); 27 | 28 | client.RemoveFilter(filter); 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /cs/LimitForComputer/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("LimitForComputer")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("LimitForComputer")] 13 | [assembly: AssemblyCopyright("Copyright © 2020")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("ca478a10-53f4-443d-ba24-668571bd6f0f")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /cs/LimitForInternetZone/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /cs/LimitForInternetZone/LimitForInternetZone.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {1C46905E-1BDF-4E6D-B36A-B464CB248849} 8 | Exe 9 | LimitForInternetZone 10 | LimitForInternetZone 11 | v4.6.2 12 | 512 13 | true 14 | true 15 | 16 | 17 | 18 | AnyCPU 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | AnyCPU 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | 36 | 37 | true 38 | bin\x64\Debug\ 39 | DEBUG;TRACE 40 | full 41 | x64 42 | prompt 43 | MinimumRecommendedRules.ruleset 44 | true 45 | 46 | 47 | bin\x64\Release\ 48 | TRACE 49 | true 50 | pdbonly 51 | x64 52 | prompt 53 | MinimumRecommendedRules.ruleset 54 | true 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 5.3.18 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /cs/LimitForInternetZone/Program.cs: -------------------------------------------------------------------------------- 1 | using NetLimiter.Service; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace NLApiSamples 9 | { 10 | class Program 11 | { 12 | static void Main(string[] args) 13 | { 14 | using (NLClient client = new NLClient()) 15 | { 16 | // Connect to local NetLimiter service 17 | client.Connect(); 18 | 19 | Filter filter = client.GetInternetZone(); 20 | 21 | Rule rule = new LimitRule(RuleDir.In, 512 * 1024); 22 | client.AddRule(filter.Id, rule); 23 | 24 | Console.WriteLine("Press any key to delete the filter"); 25 | Console.ReadKey(); 26 | 27 | client.RemoveRule(rule); 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /cs/LimitForInternetZone/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("LimitForInternetZone")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("LimitForInternetZone")] 13 | [assembly: AssemblyCopyright("Copyright © 2020")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("1c46905e-1bdf-4e6d-b36a-b464cb248849")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /cs/NLApiSamples.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.8.34408.163 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlockerRequests", "BlockerRequests\BlockerRequests.csproj", "{F22A44E4-74B3-4968-91F7-1CD71C0E6467}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LimitForComputer", "LimitForComputer\LimitForComputer.csproj", "{CA478A10-53F4-443D-BA24-668571BD6F0F}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LimitForApplication", "LimitForApplication\LimitForApplication.csproj", "{FE10C621-71EC-452E-A30F-69567F7ED8DF}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LimitForInternetZone", "LimitForInternetZone\LimitForInternetZone.csproj", "{1C46905E-1BDF-4E6D-B36A-B464CB248849}" 13 | EndProject 14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScheduledRule", "ScheduledRule\ScheduledRule.csproj", "{DF97DD24-BC92-4E13-AE8C-8D2BFECDE020}" 15 | EndProject 16 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AllExceptFilter", "AllExceptFilter\AllExceptFilter.csproj", "{C90C1A56-95BD-499F-9792-FB9A41C4345F}" 17 | EndProject 18 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EnterRegistrationData", "EnterRegistrationData\EnterRegistrationData.csproj", "{B9BDB36A-1F44-4002-989D-001D947F596A}" 19 | EndProject 20 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FilterAndRuleUpdate", "FilterAndRuleUpdate\FilterAndRuleUpdate.csproj", "{DC4E55E1-5F6F-4238-A7A3-7A0608E4A2FB}" 21 | EndProject 22 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FilterNodeLoader", "FilterNodeLoader\FilterNodeLoader.csproj", "{2D831DEF-FD40-4AC7-8379-6A6146496A73}" 23 | EndProject 24 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuotaWithRule", "QuotaWithRule\QuotaWithRule.csproj", "{B31EC952-15AD-49BF-A452-D52C479A7ED5}" 25 | EndProject 26 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Permissions", "Permissions\Permissions.csproj", "{F8C76C73-7D74-4A41-AC6C-5432121F5B10}" 27 | EndProject 28 | Global 29 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 30 | Debug|Any CPU = Debug|Any CPU 31 | Debug|x64 = Debug|x64 32 | Debug|x86 = Debug|x86 33 | Release|Any CPU = Release|Any CPU 34 | Release|x64 = Release|x64 35 | Release|x86 = Release|x86 36 | EndGlobalSection 37 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 38 | {F22A44E4-74B3-4968-91F7-1CD71C0E6467}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 39 | {F22A44E4-74B3-4968-91F7-1CD71C0E6467}.Debug|Any CPU.Build.0 = Debug|Any CPU 40 | {F22A44E4-74B3-4968-91F7-1CD71C0E6467}.Debug|x64.ActiveCfg = Debug|x64 41 | {F22A44E4-74B3-4968-91F7-1CD71C0E6467}.Debug|x64.Build.0 = Debug|x64 42 | {F22A44E4-74B3-4968-91F7-1CD71C0E6467}.Debug|x86.ActiveCfg = Debug|x86 43 | {F22A44E4-74B3-4968-91F7-1CD71C0E6467}.Debug|x86.Build.0 = Debug|x86 44 | {F22A44E4-74B3-4968-91F7-1CD71C0E6467}.Release|Any CPU.ActiveCfg = Release|Any CPU 45 | {F22A44E4-74B3-4968-91F7-1CD71C0E6467}.Release|Any CPU.Build.0 = Release|Any CPU 46 | {F22A44E4-74B3-4968-91F7-1CD71C0E6467}.Release|x64.ActiveCfg = Release|x64 47 | {F22A44E4-74B3-4968-91F7-1CD71C0E6467}.Release|x64.Build.0 = Release|x64 48 | {F22A44E4-74B3-4968-91F7-1CD71C0E6467}.Release|x86.ActiveCfg = Release|x86 49 | {F22A44E4-74B3-4968-91F7-1CD71C0E6467}.Release|x86.Build.0 = Release|x86 50 | {CA478A10-53F4-443D-BA24-668571BD6F0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 51 | {CA478A10-53F4-443D-BA24-668571BD6F0F}.Debug|Any CPU.Build.0 = Debug|Any CPU 52 | {CA478A10-53F4-443D-BA24-668571BD6F0F}.Debug|x64.ActiveCfg = Debug|x64 53 | {CA478A10-53F4-443D-BA24-668571BD6F0F}.Debug|x64.Build.0 = Debug|x64 54 | {CA478A10-53F4-443D-BA24-668571BD6F0F}.Debug|x86.ActiveCfg = Debug|Any CPU 55 | {CA478A10-53F4-443D-BA24-668571BD6F0F}.Debug|x86.Build.0 = Debug|Any CPU 56 | {CA478A10-53F4-443D-BA24-668571BD6F0F}.Release|Any CPU.ActiveCfg = Release|Any CPU 57 | {CA478A10-53F4-443D-BA24-668571BD6F0F}.Release|Any CPU.Build.0 = Release|Any CPU 58 | {CA478A10-53F4-443D-BA24-668571BD6F0F}.Release|x64.ActiveCfg = Release|x64 59 | {CA478A10-53F4-443D-BA24-668571BD6F0F}.Release|x64.Build.0 = Release|x64 60 | {CA478A10-53F4-443D-BA24-668571BD6F0F}.Release|x86.ActiveCfg = Release|Any CPU 61 | {CA478A10-53F4-443D-BA24-668571BD6F0F}.Release|x86.Build.0 = Release|Any CPU 62 | {FE10C621-71EC-452E-A30F-69567F7ED8DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 63 | {FE10C621-71EC-452E-A30F-69567F7ED8DF}.Debug|Any CPU.Build.0 = Debug|Any CPU 64 | {FE10C621-71EC-452E-A30F-69567F7ED8DF}.Debug|x64.ActiveCfg = Debug|x64 65 | {FE10C621-71EC-452E-A30F-69567F7ED8DF}.Debug|x64.Build.0 = Debug|x64 66 | {FE10C621-71EC-452E-A30F-69567F7ED8DF}.Debug|x86.ActiveCfg = Debug|Any CPU 67 | {FE10C621-71EC-452E-A30F-69567F7ED8DF}.Debug|x86.Build.0 = Debug|Any CPU 68 | {FE10C621-71EC-452E-A30F-69567F7ED8DF}.Release|Any CPU.ActiveCfg = Release|Any CPU 69 | {FE10C621-71EC-452E-A30F-69567F7ED8DF}.Release|Any CPU.Build.0 = Release|Any CPU 70 | {FE10C621-71EC-452E-A30F-69567F7ED8DF}.Release|x64.ActiveCfg = Release|x64 71 | {FE10C621-71EC-452E-A30F-69567F7ED8DF}.Release|x64.Build.0 = Release|x64 72 | {FE10C621-71EC-452E-A30F-69567F7ED8DF}.Release|x86.ActiveCfg = Release|Any CPU 73 | {FE10C621-71EC-452E-A30F-69567F7ED8DF}.Release|x86.Build.0 = Release|Any CPU 74 | {1C46905E-1BDF-4E6D-B36A-B464CB248849}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 75 | {1C46905E-1BDF-4E6D-B36A-B464CB248849}.Debug|Any CPU.Build.0 = Debug|Any CPU 76 | {1C46905E-1BDF-4E6D-B36A-B464CB248849}.Debug|x64.ActiveCfg = Debug|x64 77 | {1C46905E-1BDF-4E6D-B36A-B464CB248849}.Debug|x64.Build.0 = Debug|x64 78 | {1C46905E-1BDF-4E6D-B36A-B464CB248849}.Debug|x86.ActiveCfg = Debug|Any CPU 79 | {1C46905E-1BDF-4E6D-B36A-B464CB248849}.Debug|x86.Build.0 = Debug|Any CPU 80 | {1C46905E-1BDF-4E6D-B36A-B464CB248849}.Release|Any CPU.ActiveCfg = Release|Any CPU 81 | {1C46905E-1BDF-4E6D-B36A-B464CB248849}.Release|Any CPU.Build.0 = Release|Any CPU 82 | {1C46905E-1BDF-4E6D-B36A-B464CB248849}.Release|x64.ActiveCfg = Release|x64 83 | {1C46905E-1BDF-4E6D-B36A-B464CB248849}.Release|x64.Build.0 = Release|x64 84 | {1C46905E-1BDF-4E6D-B36A-B464CB248849}.Release|x86.ActiveCfg = Release|Any CPU 85 | {1C46905E-1BDF-4E6D-B36A-B464CB248849}.Release|x86.Build.0 = Release|Any CPU 86 | {DF97DD24-BC92-4E13-AE8C-8D2BFECDE020}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 87 | {DF97DD24-BC92-4E13-AE8C-8D2BFECDE020}.Debug|Any CPU.Build.0 = Debug|Any CPU 88 | {DF97DD24-BC92-4E13-AE8C-8D2BFECDE020}.Debug|x64.ActiveCfg = Debug|x64 89 | {DF97DD24-BC92-4E13-AE8C-8D2BFECDE020}.Debug|x64.Build.0 = Debug|x64 90 | {DF97DD24-BC92-4E13-AE8C-8D2BFECDE020}.Debug|x86.ActiveCfg = Debug|Any CPU 91 | {DF97DD24-BC92-4E13-AE8C-8D2BFECDE020}.Debug|x86.Build.0 = Debug|Any CPU 92 | {DF97DD24-BC92-4E13-AE8C-8D2BFECDE020}.Release|Any CPU.ActiveCfg = Release|Any CPU 93 | {DF97DD24-BC92-4E13-AE8C-8D2BFECDE020}.Release|Any CPU.Build.0 = Release|Any CPU 94 | {DF97DD24-BC92-4E13-AE8C-8D2BFECDE020}.Release|x64.ActiveCfg = Release|Any CPU 95 | {DF97DD24-BC92-4E13-AE8C-8D2BFECDE020}.Release|x64.Build.0 = Release|Any CPU 96 | {DF97DD24-BC92-4E13-AE8C-8D2BFECDE020}.Release|x86.ActiveCfg = Release|Any CPU 97 | {DF97DD24-BC92-4E13-AE8C-8D2BFECDE020}.Release|x86.Build.0 = Release|Any CPU 98 | {C90C1A56-95BD-499F-9792-FB9A41C4345F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 99 | {C90C1A56-95BD-499F-9792-FB9A41C4345F}.Debug|Any CPU.Build.0 = Debug|Any CPU 100 | {C90C1A56-95BD-499F-9792-FB9A41C4345F}.Debug|x64.ActiveCfg = Debug|x64 101 | {C90C1A56-95BD-499F-9792-FB9A41C4345F}.Debug|x64.Build.0 = Debug|x64 102 | {C90C1A56-95BD-499F-9792-FB9A41C4345F}.Debug|x86.ActiveCfg = Debug|Any CPU 103 | {C90C1A56-95BD-499F-9792-FB9A41C4345F}.Debug|x86.Build.0 = Debug|Any CPU 104 | {C90C1A56-95BD-499F-9792-FB9A41C4345F}.Release|Any CPU.ActiveCfg = Release|Any CPU 105 | {C90C1A56-95BD-499F-9792-FB9A41C4345F}.Release|Any CPU.Build.0 = Release|Any CPU 106 | {C90C1A56-95BD-499F-9792-FB9A41C4345F}.Release|x64.ActiveCfg = Release|Any CPU 107 | {C90C1A56-95BD-499F-9792-FB9A41C4345F}.Release|x64.Build.0 = Release|Any CPU 108 | {C90C1A56-95BD-499F-9792-FB9A41C4345F}.Release|x86.ActiveCfg = Release|Any CPU 109 | {C90C1A56-95BD-499F-9792-FB9A41C4345F}.Release|x86.Build.0 = Release|Any CPU 110 | {B9BDB36A-1F44-4002-989D-001D947F596A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 111 | {B9BDB36A-1F44-4002-989D-001D947F596A}.Debug|Any CPU.Build.0 = Debug|Any CPU 112 | {B9BDB36A-1F44-4002-989D-001D947F596A}.Debug|x64.ActiveCfg = Debug|x64 113 | {B9BDB36A-1F44-4002-989D-001D947F596A}.Debug|x64.Build.0 = Debug|x64 114 | {B9BDB36A-1F44-4002-989D-001D947F596A}.Debug|x86.ActiveCfg = Debug|Any CPU 115 | {B9BDB36A-1F44-4002-989D-001D947F596A}.Debug|x86.Build.0 = Debug|Any CPU 116 | {B9BDB36A-1F44-4002-989D-001D947F596A}.Release|Any CPU.ActiveCfg = Release|Any CPU 117 | {B9BDB36A-1F44-4002-989D-001D947F596A}.Release|Any CPU.Build.0 = Release|Any CPU 118 | {B9BDB36A-1F44-4002-989D-001D947F596A}.Release|x64.ActiveCfg = Release|Any CPU 119 | {B9BDB36A-1F44-4002-989D-001D947F596A}.Release|x64.Build.0 = Release|Any CPU 120 | {B9BDB36A-1F44-4002-989D-001D947F596A}.Release|x86.ActiveCfg = Release|Any CPU 121 | {B9BDB36A-1F44-4002-989D-001D947F596A}.Release|x86.Build.0 = Release|Any CPU 122 | {DC4E55E1-5F6F-4238-A7A3-7A0608E4A2FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 123 | {DC4E55E1-5F6F-4238-A7A3-7A0608E4A2FB}.Debug|Any CPU.Build.0 = Debug|Any CPU 124 | {DC4E55E1-5F6F-4238-A7A3-7A0608E4A2FB}.Debug|x64.ActiveCfg = Debug|x64 125 | {DC4E55E1-5F6F-4238-A7A3-7A0608E4A2FB}.Debug|x64.Build.0 = Debug|x64 126 | {DC4E55E1-5F6F-4238-A7A3-7A0608E4A2FB}.Debug|x86.ActiveCfg = Debug|Any CPU 127 | {DC4E55E1-5F6F-4238-A7A3-7A0608E4A2FB}.Debug|x86.Build.0 = Debug|Any CPU 128 | {DC4E55E1-5F6F-4238-A7A3-7A0608E4A2FB}.Release|Any CPU.ActiveCfg = Release|Any CPU 129 | {DC4E55E1-5F6F-4238-A7A3-7A0608E4A2FB}.Release|Any CPU.Build.0 = Release|Any CPU 130 | {DC4E55E1-5F6F-4238-A7A3-7A0608E4A2FB}.Release|x64.ActiveCfg = Release|Any CPU 131 | {DC4E55E1-5F6F-4238-A7A3-7A0608E4A2FB}.Release|x64.Build.0 = Release|Any CPU 132 | {DC4E55E1-5F6F-4238-A7A3-7A0608E4A2FB}.Release|x86.ActiveCfg = Release|Any CPU 133 | {DC4E55E1-5F6F-4238-A7A3-7A0608E4A2FB}.Release|x86.Build.0 = Release|Any CPU 134 | {2D831DEF-FD40-4AC7-8379-6A6146496A73}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 135 | {2D831DEF-FD40-4AC7-8379-6A6146496A73}.Debug|Any CPU.Build.0 = Debug|Any CPU 136 | {2D831DEF-FD40-4AC7-8379-6A6146496A73}.Debug|x64.ActiveCfg = Debug|x64 137 | {2D831DEF-FD40-4AC7-8379-6A6146496A73}.Debug|x64.Build.0 = Debug|x64 138 | {2D831DEF-FD40-4AC7-8379-6A6146496A73}.Debug|x86.ActiveCfg = Debug|Any CPU 139 | {2D831DEF-FD40-4AC7-8379-6A6146496A73}.Debug|x86.Build.0 = Debug|Any CPU 140 | {2D831DEF-FD40-4AC7-8379-6A6146496A73}.Release|Any CPU.ActiveCfg = Release|Any CPU 141 | {2D831DEF-FD40-4AC7-8379-6A6146496A73}.Release|Any CPU.Build.0 = Release|Any CPU 142 | {2D831DEF-FD40-4AC7-8379-6A6146496A73}.Release|x64.ActiveCfg = Release|Any CPU 143 | {2D831DEF-FD40-4AC7-8379-6A6146496A73}.Release|x64.Build.0 = Release|Any CPU 144 | {2D831DEF-FD40-4AC7-8379-6A6146496A73}.Release|x86.ActiveCfg = Release|Any CPU 145 | {2D831DEF-FD40-4AC7-8379-6A6146496A73}.Release|x86.Build.0 = Release|Any CPU 146 | {B31EC952-15AD-49BF-A452-D52C479A7ED5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 147 | {B31EC952-15AD-49BF-A452-D52C479A7ED5}.Debug|Any CPU.Build.0 = Debug|Any CPU 148 | {B31EC952-15AD-49BF-A452-D52C479A7ED5}.Debug|x64.ActiveCfg = Debug|Any CPU 149 | {B31EC952-15AD-49BF-A452-D52C479A7ED5}.Debug|x64.Build.0 = Debug|Any CPU 150 | {B31EC952-15AD-49BF-A452-D52C479A7ED5}.Debug|x86.ActiveCfg = Debug|Any CPU 151 | {B31EC952-15AD-49BF-A452-D52C479A7ED5}.Debug|x86.Build.0 = Debug|Any CPU 152 | {B31EC952-15AD-49BF-A452-D52C479A7ED5}.Release|Any CPU.ActiveCfg = Release|Any CPU 153 | {B31EC952-15AD-49BF-A452-D52C479A7ED5}.Release|Any CPU.Build.0 = Release|Any CPU 154 | {B31EC952-15AD-49BF-A452-D52C479A7ED5}.Release|x64.ActiveCfg = Release|Any CPU 155 | {B31EC952-15AD-49BF-A452-D52C479A7ED5}.Release|x64.Build.0 = Release|Any CPU 156 | {B31EC952-15AD-49BF-A452-D52C479A7ED5}.Release|x86.ActiveCfg = Release|Any CPU 157 | {B31EC952-15AD-49BF-A452-D52C479A7ED5}.Release|x86.Build.0 = Release|Any CPU 158 | {F8C76C73-7D74-4A41-AC6C-5432121F5B10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 159 | {F8C76C73-7D74-4A41-AC6C-5432121F5B10}.Debug|Any CPU.Build.0 = Debug|Any CPU 160 | {F8C76C73-7D74-4A41-AC6C-5432121F5B10}.Debug|x64.ActiveCfg = Debug|Any CPU 161 | {F8C76C73-7D74-4A41-AC6C-5432121F5B10}.Debug|x64.Build.0 = Debug|Any CPU 162 | {F8C76C73-7D74-4A41-AC6C-5432121F5B10}.Debug|x86.ActiveCfg = Debug|Any CPU 163 | {F8C76C73-7D74-4A41-AC6C-5432121F5B10}.Debug|x86.Build.0 = Debug|Any CPU 164 | {F8C76C73-7D74-4A41-AC6C-5432121F5B10}.Release|Any CPU.ActiveCfg = Release|Any CPU 165 | {F8C76C73-7D74-4A41-AC6C-5432121F5B10}.Release|Any CPU.Build.0 = Release|Any CPU 166 | {F8C76C73-7D74-4A41-AC6C-5432121F5B10}.Release|x64.ActiveCfg = Release|Any CPU 167 | {F8C76C73-7D74-4A41-AC6C-5432121F5B10}.Release|x64.Build.0 = Release|Any CPU 168 | {F8C76C73-7D74-4A41-AC6C-5432121F5B10}.Release|x86.ActiveCfg = Release|Any CPU 169 | {F8C76C73-7D74-4A41-AC6C-5432121F5B10}.Release|x86.Build.0 = Release|Any CPU 170 | EndGlobalSection 171 | GlobalSection(SolutionProperties) = preSolution 172 | HideSolutionNode = FALSE 173 | EndGlobalSection 174 | GlobalSection(ExtensibilityGlobals) = postSolution 175 | SolutionGuid = {3540B937-AD90-47E6-A52B-AFAE7A13278A} 176 | EndGlobalSection 177 | EndGlobal 178 | -------------------------------------------------------------------------------- /cs/Permissions/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /cs/Permissions/Permissions.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {F8C76C73-7D74-4A41-AC6C-5432121F5B10} 8 | Exe 9 | Permissions 10 | Permissions 11 | v4.6.2 12 | 512 13 | true 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | ..\packages\NetLimiter.5.3.18\lib\net462\CoreLibNet.dll 38 | 39 | 40 | ..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll 41 | 42 | 43 | ..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.8.0.0\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll 44 | 45 | 46 | ..\packages\Microsoft.Extensions.Logging.Abstractions.8.0.0\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll 47 | 48 | 49 | ..\packages\NetLimiter.5.3.18\lib\net462\NetLimiter.dll 50 | 51 | 52 | ..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll 53 | 54 | 55 | 56 | ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll 57 | 58 | 59 | 60 | ..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll 61 | 62 | 63 | 64 | ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll 65 | 66 | 67 | ..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll 68 | 69 | 70 | ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | ..\packages\VirusTotalNet.2.2.0\lib\netstandard2.0\VirusTotalNet.dll 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /cs/Permissions/Program.cs: -------------------------------------------------------------------------------- 1 | using NetLimiter.Service; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace NLApiSamples 9 | { 10 | internal class Program 11 | { 12 | static void Main(string[] args) 13 | { 14 | using (NLClient client = new NLClient()) 15 | { 16 | // Connect to local NetLimiter service 17 | client.Connect(); 18 | 19 | try 20 | { 21 | var table = client.GetAccessTable().ToList(); 22 | 23 | var users = table.FirstOrDefault(x => string.Equals(x.Name, "users", 24 | StringComparison.InvariantCultureIgnoreCase) || 25 | string.Equals(x.Name, "builtin\\users", StringComparison.InvariantCultureIgnoreCase)); 26 | 27 | if (users == null) 28 | { 29 | table.Add(users = new NetLimiter.Service.Api.AccessTableRow() 30 | { 31 | Name = "Users", 32 | }); 33 | } 34 | 35 | users.AllowedRights = NetLimiter.Service.Security.Rights.Monitor; 36 | users.DeniedRights = 0; 37 | 38 | client.SetAccessTable(table); 39 | } 40 | catch (Exception ex) 41 | { 42 | Console.WriteLine("Error: " + ex.Message); 43 | } 44 | } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /cs/Permissions/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Permissions")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Permissions")] 13 | [assembly: AssemblyCopyright("Copyright © 2024")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("f8c76c73-7d74-4a41-ac6c-5432121f5b10")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /cs/Permissions/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /cs/QuotaWithRule/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /cs/QuotaWithRule/Program.cs: -------------------------------------------------------------------------------- 1 | using NetLimiter.Service; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace QuotaWithRule 9 | { 10 | class Program 11 | { 12 | static void Main(string[] args) 13 | { 14 | using (NLClient client = new NLClient()) 15 | { 16 | client.Connect(); 17 | 18 | Filter filter = new Filter("WholeMachineFilter"); 19 | 20 | client.AddFilter(filter); 21 | 22 | var limitRule = client.AddRule(filter.Id, new LimitRule(RuleDir.In, 512 * 1024) { IsEnabled = false }); 23 | 24 | QuotaRule quotaRule = new QuotaRule(RuleDir.Both, 2 * 1024 * 1024); 25 | 26 | quotaRule.OnOverflowRules.Add(limitRule.Id); 27 | 28 | client.AddRule(filter.Id, quotaRule); 29 | 30 | Console.WriteLine("Press any key to delete the filter"); 31 | Console.ReadKey(); 32 | 33 | client.RemoveFilter(filter); 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /cs/QuotaWithRule/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("QuotaWithRule")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("QuotaWithRule")] 13 | [assembly: AssemblyCopyright("Copyright © 2024")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("b31ec952-15ad-49bf-a452-d52c479a7ed5")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /cs/QuotaWithRule/QuotaWithRule.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {B31EC952-15AD-49BF-A452-D52C479A7ED5} 8 | Exe 9 | QuotaWithRule 10 | QuotaWithRule 11 | v4.6.2 12 | 512 13 | true 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | ..\packages\NetLimiter.5.3.18\lib\net462\CoreLibNet.dll 38 | 39 | 40 | ..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll 41 | 42 | 43 | ..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.8.0.0\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll 44 | 45 | 46 | ..\packages\Microsoft.Extensions.Logging.Abstractions.8.0.0\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll 47 | 48 | 49 | ..\packages\NetLimiter.5.3.18\lib\net462\NetLimiter.dll 50 | 51 | 52 | ..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll 53 | 54 | 55 | 56 | ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll 57 | 58 | 59 | 60 | ..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll 61 | 62 | 63 | 64 | ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll 65 | 66 | 67 | ..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll 68 | 69 | 70 | ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | ..\packages\VirusTotalNet.2.2.0\lib\netstandard2.0\VirusTotalNet.dll 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /cs/QuotaWithRule/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /cs/ScheduledRule/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /cs/ScheduledRule/Program.cs: -------------------------------------------------------------------------------- 1 | using NetLimiter.Service; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace NLApiSamples 9 | { 10 | class Program 11 | { 12 | static string _ruleId; 13 | 14 | static void Main(string[] args) 15 | { 16 | using (NLClient client = new NLClient()) 17 | { 18 | // Connect to local NetLimiter service 19 | client.Connect(); 20 | 21 | // Listen for rule changes 22 | client.RuleUpdated += OnRuleUpdated; 23 | 24 | // Get filter matching all traffic (whole computer or any) 25 | Filter filter = client.GetAnyFilter(); 26 | 27 | LimitRule limitRule = new LimitRule(RuleDir.In, 1024 * 1024 /* 1 MB/s */); 28 | _ruleId = limitRule.Id; 29 | 30 | // Create Start condition 31 | limitRule.Conditions.Add(new TimeCondition() 32 | { 33 | Action = RuleConditionAction.Start, 34 | TimeConditionType = TimeConditionType.Once, 35 | Time = DateTime.UtcNow.AddSeconds(10), // Will start in 10s 36 | }); 37 | 38 | // Create Stop condition 39 | limitRule.Conditions.Add(new TimeCondition() 40 | { 41 | Action = RuleConditionAction.Stop, 42 | TimeConditionType = TimeConditionType.Once, 43 | Time = DateTime.UtcNow.AddSeconds(20), // Will stop in 10s after start 44 | }); 45 | 46 | // Add the rule to NetLimiter system 47 | client.AddRule(filter.Id, limitRule); 48 | 49 | Console.WriteLine("Rule was created. The rule will start in 10s and stop in next 10s."); 50 | Console.WriteLine("PRESS ANY KEY TO DELETE THE RULE AND EXIT."); 51 | Console.ReadKey(); 52 | 53 | // remove filter 54 | client.RemoveRule(limitRule); 55 | } 56 | } 57 | 58 | private static void OnRuleUpdated(object sender, RuleUpdateEventArgs e) 59 | { 60 | // 61 | // This handler is called when a rule is updated ie. started / stopped. 62 | // You can try to disabled/enable our rule from the GUI application or you can try to change the limit size. 63 | // 64 | if (e.Rule is LimitRule limitRule && limitRule.Id == _ruleId) 65 | { 66 | Console.WriteLine($"Our LimitRule: state={limitRule.State}, limit={limitRule.LimitSize} B/s"); 67 | } 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /cs/ScheduledRule/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ScheduledRule")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ScheduledRule")] 13 | [assembly: AssemblyCopyright("Copyright © 2020")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("df97dd24-bc92-4e13-ae8c-8d2bfecde020")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /cs/ScheduledRule/ScheduledRule.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {DF97DD24-BC92-4E13-AE8C-8D2BFECDE020} 8 | Exe 9 | ScheduledRule 10 | ScheduledRule 11 | v4.6.2 12 | 512 13 | true 14 | true 15 | 16 | 17 | 18 | AnyCPU 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | AnyCPU 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | 36 | 37 | true 38 | bin\x64\Debug\ 39 | DEBUG;TRACE 40 | full 41 | x64 42 | 7.3 43 | prompt 44 | true 45 | 46 | 47 | bin\x64\Release\ 48 | TRACE 49 | true 50 | pdbonly 51 | x64 52 | 7.3 53 | prompt 54 | true 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 5.3.18 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /ps/permissions.ps1: -------------------------------------------------------------------------------- 1 | Add-Type -Path "C:\Program Files\Locktime Software\NetLimiter\NetLimiter.dll" 2 | 3 | $cli = New-Object NetLimiter.Service.NLClient 4 | 5 | $cli.Connect() 6 | $table = $cli.GetAccessTable(); 7 | 8 | $list = [System.Collections.Generic.List[NetLimiter.Service.Api.AccessTableRow]]::new() 9 | 10 | $list.AddRange($table); 11 | 12 | $item = $list | Where-Object { $_.Name -ieq "builtin\users" -or $_.Name -ieq "users" } 13 | 14 | if (!$item) { 15 | $item = [NetLimiter.Service.Api.AccessTableRow]::new() 16 | $item.Name = "Users" 17 | $list.Add($item) 18 | } 19 | 20 | $item.AllowedRights = [NetLimiter.Service.Security.Rights]::Monitor 21 | $item.DeniedRights = 0 22 | 23 | $cli.SetAccessTable($table) 24 | 25 | 26 | 27 | --------------------------------------------------------------------------------