Skip to content

Commit

Permalink
Merge pull request 1.3.7.5 from WaGi-Coding/testing
Browse files Browse the repository at this point in the history
* Improved IP matching
  • Loading branch information
WaGi-Coding authored Sep 26, 2019
2 parents c83e2ac + 80b8d57 commit 3e34f5e
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 36 deletions.
23 changes: 15 additions & 8 deletions WaGis IP-Blacklister/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 34 additions & 26 deletions WaGis IP-Blacklister/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,40 +100,44 @@ private void MainForm_Load(object sender, EventArgs e)
}

// Maybe Check for Updates - NOT DONE
try
{
newV = WaGiRequest("https://api.github.com/repos/WaGi-Coding/WaGis-Mass-IP-Blacklister-Windows/releases/latest");

JObject jObject = JObject.Parse(newV);
newV = Convert.ToString(jObject.SelectToken("tag_name"));
CheckForUpdate();
timerCheckForUpdate.Start();
}

}

var versionNow = new Version(Application.ProductVersion);
var versionWeb = new Version(newV);
private void CheckForUpdate()
{
try
{
newV = WaGiRequest("https://api.github.com/repos/WaGi-Coding/WaGis-Mass-IP-Blacklister-Windows/releases/latest");

var result = versionNow.CompareTo(versionWeb);
JObject jObject = JObject.Parse(newV);
newV = Convert.ToString(jObject.SelectToken("tag_name"));

if (result < 0)
{
//MessageBox.Show($"New version {versionWeb} available! Your version: {Application.ProductVersion}");
Update updateform = new Update();
updateform.ShowDialog();
updateToolStripMenuItem.Visible = true;
timerUpdateBlink.Start();
}
var versionNow = new Version(Application.ProductVersion);
var versionWeb = new Version(newV);

/////////////////////////
var result = versionNow.CompareTo(versionWeb);

//HideCaret(richTextBox2.Handle);
richtbList.SelectionStart = richtbList.Text.Length;
firewallPolicy = (INetFwPolicy2)Activator.CreateInstance(Type.GetTypeFromProgID("HNetCfg.FwPolicy2"));
}
catch (Exception)
if (result < 0)
{
//MessageBox.Show($"New version {versionWeb} available! Your version: {Application.ProductVersion}");
Update updateform = new Update();
updateform.ShowDialog();
updateToolStripMenuItem.Visible = true;
timerUpdateBlink.Start();
}


/////////////////////////

//HideCaret(richTextBox2.Handle);
richtbList.SelectionStart = richtbList.Text.Length;
firewallPolicy = (INetFwPolicy2)Activator.CreateInstance(Type.GetTypeFromProgID("HNetCfg.FwPolicy2"));
}
catch (Exception)
{
}

}

private void richtbList_TextChanged(object sender, EventArgs e)
Expand Down Expand Up @@ -199,7 +203,7 @@ private void btnADD_Click(object sender, EventArgs e)

//IPv6 CIDR aka. IP-Range support REGEX by WaGi-Coding--- (\b((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:)))(%.+)?s*(\/([0-9]|[1-9][0-9]|1[0-1][0-9]|12[0-8]))?\b)(?!\/)
//IPv4 CIDR aka IP-Range support by WaGi-Coding---- (\b([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?\b)(?!\/)
allips.AddRange(Regex.Matches(richtbList.Text, @"((\b((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-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9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:)))(%.+)?s*(\/([0-9]|[1-9][0-9]|1[0-1][0-9]|12[0-8]))?\b)(?!\/))|((\b([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?\b)(?!\/))", RegexOptions.IgnoreCase)
.Cast<Match>()
.Select(m => m.Value)
.ToList());
Expand Down Expand Up @@ -802,5 +806,9 @@ private void closeToolStripMenuItem_Click(object sender, EventArgs e)
Application.Exit();
}

private void timerCheckForUpdate_Tick(object sender, EventArgs e)
{
CheckForUpdate();
}
}
}
3 changes: 3 additions & 0 deletions WaGis IP-Blacklister/Form1.resx
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@
<metadata name="trayIconContextMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>961, 19</value>
</metadata>
<metadata name="timerCheckForUpdate.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>1156, 19</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>66</value>
</metadata>
Expand Down
4 changes: 2 additions & 2 deletions WaGis IP-Blacklister/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,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("1.3.7")]
[assembly: AssemblyFileVersion("1.3.7")]
[assembly: AssemblyVersion("1.3.7.5")]
[assembly: AssemblyFileVersion("1.3.7.5")]

0 comments on commit 3e34f5e

Please sign in to comment.