Skip to content

Commit

Permalink
version 2.1.4 (#80)
Browse files Browse the repository at this point in the history
* turning up version number

* added integration tests for firewall api and updated gitignire

* added ipV6 support

* added ipv6_task (thank you ozaroth)

* released binary
  • Loading branch information
devnulli committed Jan 23, 2022
1 parent 21229b5 commit 0e868ba
Show file tree
Hide file tree
Showing 14 changed files with 442 additions and 238 deletions.
27 changes: 17 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,22 @@

/.vs
*.suo
/Source/EvlWatcher/.vs
/Source/EvlWatcher/EvlWatcher/obj/x86
/Source/EvlWatcherConsole/EvlWatcherConsole/obj/x86
/Source/EvlWatcher/EvlWatcher/bin/Debug
*.user
/Source/EvlWatcherConsole/EvlWatcherConsole/bin/Debug
/Source/EvlWatcher/EvlWatcher/bin/Release
/Source/EvlWatcher/EvlWatcher.WCF/bin/Debug
/Source/EvlWatcher/EvlWatcher.WCF/obj
/Source/EvlWatcherConsole/EvlWatcherConsole/bin/Release
/Source/EvlWatcher/EvlWatcher.WCF/bin/Release

/Source/EvlWatcher/.vs
/Source/EvlWatcherConsole/.vs

/Source/EvlWatcher/EvlWatcher/obj/
/Source/EvlWatcher/EvlWatcher/bin/

/Source/EvlWatcher/EvlWatcher.Tests.Integration/bin/
/Source/EvlWatcher/EvlWatcher.Tests.Integration/obj/

/Source/EvlWatcherConsole/EvlWatcherConsole/bin/
/Source/EvlWatcherConsole/EvlWatcherConsole/obj/

/Source/EvlWatcher/EvlWatcher.WCF/bin/
/Source/EvlWatcher/EvlWatcher.WCF/obj



Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>

<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.7" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.7" />
<PackageReference Include="coverlet.collector" Version="3.1.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\EvlWatcher\EvlWatcher.csproj" />
</ItemGroup>

</Project>
107 changes: 107 additions & 0 deletions Source/EvlWatcher/EvlWatcher.Tests.Integration/FirewallApiTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
using EvlWatcher.SystemAPI;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace EvlWatcher.Tests.Integration
{
[TestClass]
public class FirewallApiTests
{
[TestMethod]
public void GetBannedIPs()
{
//given we have a firewall API
var api = new FirewallAPI();

//when we get the bannes IPs, we want a result
var ips = api.GetBannedIPs();

Assert.IsNotNull(ips);
}

[TestMethod]
public void AddV4IP()
{
//given we have a firewall API, and an empty rule
var api = new FirewallAPI();
var list = new System.Collections.Generic.List<System.Net.IPAddress>();
api.AdjustIPBanList(list);
var ips = api.GetBannedIPs();
Assert.IsNotNull(ips);
Assert.IsTrue(ips.Count == 0);

//when we add a some ipv4 addresses
list.Add(System.Net.IPAddress.Parse("192.192.182.15"));
list.Add(System.Net.IPAddress.Parse("192.192.182.16"));
list.Add(System.Net.IPAddress.Parse("192.192.182.21"));
api.AdjustIPBanList(list);

//then we want that address to be in there
ips = api.GetBannedIPs();
Assert.IsTrue(ips.Contains("192.192.182.15/255.255.255.255"));
Assert.IsTrue(ips.Contains("192.192.182.16/255.255.255.255"));
Assert.IsTrue(ips.Contains("192.192.182.21/255.255.255.255"));


}

[TestMethod]
public void AddV6IP()
{
//given we have a firewall API, and an empty rule
var api = new FirewallAPI();
var list = new System.Collections.Generic.List<System.Net.IPAddress>();
api.AdjustIPBanList(list);
var ips = api.GetBannedIPs();
Assert.IsNotNull(ips);
Assert.IsTrue(ips.Count == 0);

//when we add a some ipv6 addresses
list.Add(System.Net.IPAddress.Parse("48a2:ca86:e35:977c:d2dc:1276:1754:f5e6"));
list.Add(System.Net.IPAddress.Parse("2b9c:5213:2df6:9866:5073:45c4:291:d82f"));
list.Add(System.Net.IPAddress.Parse("692d:22df:cd31:d65b:ba37:ba83:fc5b:3d40"));
api.AdjustIPBanList(list);

//then we want that address to be in there
ips = api.GetBannedIPs();
Assert.IsTrue(ips.Contains("48a2:ca86:e35:977c:d2dc:1276:1754:f5e6"));
Assert.IsTrue(ips.Contains("2b9c:5213:2df6:9866:5073:45c4:291:d82f"));
Assert.IsTrue(ips.Contains("692d:22df:cd31:d65b:ba37:ba83:fc5b:3d40"));


}

[TestMethod]
public void AddCombinedV4V6()
{
//given we have a firewall API, and an empty rule
var api = new FirewallAPI();
var list = new System.Collections.Generic.List<System.Net.IPAddress>();
api.AdjustIPBanList(list);
var ips = api.GetBannedIPs();
Assert.IsNotNull(ips);
Assert.IsTrue(ips.Count == 0);

//when we add a some ipv6 addresses
list.Add(System.Net.IPAddress.Parse("48a2:ca86:e35:977c:d2dc:1276:1754:f5e6"));
list.Add(System.Net.IPAddress.Parse("192.192.182.15"));
list.Add(System.Net.IPAddress.Parse("192.192.182.16"));
list.Add(System.Net.IPAddress.Parse("2b9c:5213:2df6:9866:5073:45c4:291:d82f"));
list.Add(System.Net.IPAddress.Parse("192.192.182.21"));
list.Add(System.Net.IPAddress.Parse("692d:22df:cd31:d65b:ba37:ba83:fc5b:3d40"));

api.AdjustIPBanList(list);

//then we want that address to be in there
ips = api.GetBannedIPs();
Assert.IsTrue(ips.Contains("48a2:ca86:e35:977c:d2dc:1276:1754:f5e6"));
Assert.IsTrue(ips.Contains("2b9c:5213:2df6:9866:5073:45c4:291:d82f"));
Assert.IsTrue(ips.Contains("692d:22df:cd31:d65b:ba37:ba83:fc5b:3d40"));
Assert.IsTrue(ips.Contains("192.192.182.15/255.255.255.255"));
Assert.IsTrue(ips.Contains("192.192.182.16/255.255.255.255"));
Assert.IsTrue(ips.Contains("192.192.182.21/255.255.255.255"));


}

}
}
6 changes: 3 additions & 3 deletions Source/EvlWatcher/EvlWatcher.WCF/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EvlWatcher.WCF")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyCopyright("Copyright © 2021 Michael Schönbauer")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.1.3.0")]
[assembly: AssemblyFileVersion("2.1.3.0")]
[assembly: AssemblyVersion("2.1.4.0")]
[assembly: AssemblyFileVersion("2.1.4.0")]
18 changes: 16 additions & 2 deletions Source/EvlWatcher/EvlWatcher.sln
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30621.155
# Visual Studio Version 17
VisualStudioVersion = 17.0.32112.339
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EvlWatcher", "EvlWatcher\EvlWatcher.csproj", "{90F8BC2A-B0FC-4960-8290-3FFADBDE85AC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EvlWatcher.WCF", "EvlWatcher.WCF\EvlWatcher.WCF.csproj", "{AB65EA0D-F9E8-4AEE-B1BC-1691A2BF9E13}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EvlWatcher.Tests.Integration", "EvlWatcher.Tests.Integration\EvlWatcher.Tests.Integration.csproj", "{40304822-224A-4926-B0C6-64D7324EA77C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -40,6 +42,18 @@ Global
{AB65EA0D-F9E8-4AEE-B1BC-1691A2BF9E13}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{AB65EA0D-F9E8-4AEE-B1BC-1691A2BF9E13}.Release|x86.ActiveCfg = Release|Any CPU
{AB65EA0D-F9E8-4AEE-B1BC-1691A2BF9E13}.Release|x86.Build.0 = Release|Any CPU
{40304822-224A-4926-B0C6-64D7324EA77C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{40304822-224A-4926-B0C6-64D7324EA77C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{40304822-224A-4926-B0C6-64D7324EA77C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{40304822-224A-4926-B0C6-64D7324EA77C}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{40304822-224A-4926-B0C6-64D7324EA77C}.Debug|x86.ActiveCfg = Debug|Any CPU
{40304822-224A-4926-B0C6-64D7324EA77C}.Debug|x86.Build.0 = Debug|Any CPU
{40304822-224A-4926-B0C6-64D7324EA77C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{40304822-224A-4926-B0C6-64D7324EA77C}.Release|Any CPU.Build.0 = Release|Any CPU
{40304822-224A-4926-B0C6-64D7324EA77C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{40304822-224A-4926-B0C6-64D7324EA77C}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{40304822-224A-4926-B0C6-64D7324EA77C}.Release|x86.ActiveCfg = Release|Any CPU
{40304822-224A-4926-B0C6-64D7324EA77C}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
2 changes: 1 addition & 1 deletion Source/EvlWatcher/EvlWatcher/EvlWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ private void SetPermanentBanInternal(IPAddress[] addressList)

#region public static operations

public static void Main(string[] args)
public static void Main()
{
//build dependencies
ILogger logger = new DefaultLogger();
Expand Down
2 changes: 1 addition & 1 deletion Source/EvlWatcher/EvlWatcher/NSIS/make.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Name "EvlWatcher"

; The file to write
Icon EvlWatcher.ico
OutFile "EvlWatcher-v2.1.3-setup.exe"
OutFile "EvlWatcher-v2.1.4-setup.exe"

; The default installation directory
InstallDir $PROGRAMFILES\EvlWatcher
Expand Down
6 changes: 3 additions & 3 deletions Source/EvlWatcher/EvlWatcher/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Michael Schönbauer")]
[assembly: AssemblyProduct("EvlWatcher")]
[assembly: AssemblyCopyright("2020 Michael Schönbauer")]
[assembly: AssemblyCopyright("2021 Michael Schönbauer")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -28,5 +28,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.1.3.0")]
[assembly: AssemblyFileVersion("2.1.3.0")]
[assembly: AssemblyVersion("2.1.4.0")]
[assembly: AssemblyFileVersion("2.1.4.0")]
Loading

0 comments on commit 0e868ba

Please sign in to comment.