-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
205 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,30 @@ | ||
<Window x:Class="IP_Checker_by_Hera.MainWindow" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:local="clr-namespace:IP_Checker_by_Hera" | ||
mc:Ignorable="d" | ||
Title="MainWindow" Height="350" Width="525"> | ||
<Controls:MetroWindow x:Class="IP_Checker_by_Hera.MainWindow" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro" | ||
xmlns:gif="http://wpfanimatedgif.codeplex.com" | ||
Title="IP Checker By Hera" | ||
Height="360" | ||
Width="560" | ||
ShowMaxRestoreButton="False" | ||
Icon="dc83796de2b85b60c46928a158fff8cd.png" | ||
> | ||
<Grid> | ||
|
||
<Button Name="clear" Content="Clear" HorizontalAlignment="Left" Margin="285,128,0,0" VerticalAlignment="Top" Width="75" Click="Clear_Click"/> | ||
<Button Name="Check" Content="Check" HorizontalAlignment="Left" Margin="200,128,0,0" VerticalAlignment="Top" Width="75" Click="Check_Click"/> | ||
<TextBox Name="IP" HorizontalAlignment="Left" Height="23" Margin="160,75,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="240"/> | ||
<Label Content="IP Address: " HorizontalAlignment="Left" Margin="81,72,0,0" VerticalAlignment="Top"/> | ||
<Label Content="Hostname" HorizontalAlignment="Left" Margin="10,214,0,0" VerticalAlignment="Top"/> | ||
<TextBox Name="Hostname" HorizontalAlignment="Left" Height="23" Margin="81,214,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="120" IsEnabled="False"/> | ||
<Label Content="Type" HorizontalAlignment="Left" Margin="10,254,0,0" VerticalAlignment="Top"/> | ||
<TextBox Name="Typee" HorizontalAlignment="Left" Height="26" Margin="81,254,0,0" VerticalAlignment="Top" Width="374" IsEnabled="False"/> | ||
<TextBox Name="Isp" HorizontalAlignment="Left" Height="23" Margin="81,296,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120" IsEnabled="False"/> | ||
<Label Content="ISP" HorizontalAlignment="Left" Margin="10,296,0,0" VerticalAlignment="Top"/> | ||
<Label Content="Country" HorizontalAlignment="Left" Margin="225,296,0,0" VerticalAlignment="Top"/> | ||
<Label Content="CountryCode" HorizontalAlignment="Left" Margin="415,296,0,0" VerticalAlignment="Top"/> | ||
<TextBox x:Name="CountryY" HorizontalAlignment="Left" Height="23" Margin="285,296,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="110" IsEnabled="False"/> | ||
<TextBox x:Name="CountryCodeE" HorizontalAlignment="Left" Height="23" Margin="505,296,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="25" IsEnabled="False"/> | ||
<TextBox Name="Asn" HorizontalAlignment="Left" Height="23" Margin="335,214,0,0" VerticalAlignment="Top" Width="120" IsEnabled="False"/> | ||
<Label Content="ASN" HorizontalAlignment="Left" Margin="285,214,0,0" VerticalAlignment="Top"/> | ||
</Grid> | ||
</Window> | ||
</Controls:MetroWindow> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,90 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Net; | ||
using System.Net.Sockets; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Imaging; | ||
using System.Windows.Navigation; | ||
using System.Windows.Shapes; | ||
using MahApps.Metro.Controls; | ||
using Newtonsoft.Json; | ||
using J = Newtonsoft.Json.JsonPropertyAttribute; | ||
|
||
namespace IP_Checker_by_Hera | ||
{ | ||
/// <summary> | ||
/// Interaction logic for MainWindow.xaml | ||
/// </summary> | ||
public partial class MainWindow : Window | ||
public partial class MainWindow : MetroWindow | ||
{ | ||
public MainWindow() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
private void Check_Click(object sender, RoutedEventArgs e) | ||
{ | ||
try | ||
{ | ||
if (string.IsNullOrWhiteSpace(IP.Text)) | ||
{ | ||
MessageBox.Show("Please don't leave the IP box blank"); | ||
return; | ||
} | ||
|
||
HttpWebRequest r = (HttpWebRequest)WebRequest.Create($"http://v2.api.iphub.info/ip/{IP.Text}"); | ||
r.Method = "GET"; | ||
r.Headers["X-key"] = "MTE3OnBNOHcxZWVwV3ROczN4WFRFZmRZV212cGNIaGhyS0dy"; | ||
|
||
HttpWebResponse rs = (HttpWebResponse)r.GetResponse(); | ||
string result = null; | ||
|
||
using (System.IO.StreamReader sr = new System.IO.StreamReader(rs.GetResponseStream())) | ||
{ | ||
result = sr.ReadToEnd(); | ||
} | ||
|
||
|
||
var obj = JsonConvert.DeserializeObject<IpApi>(result); | ||
|
||
var blocked = ""; | ||
if (obj.Block == 0) | ||
blocked = "Residential/Unclassified IP (i.e. safe IP)"; | ||
else if (obj.Block == 1) | ||
blocked = "Non-residential IP (hosting provider, proxy, etc.)"; | ||
else | ||
blocked = "Non-residential & residential IP (warning, may flag innocent people)"; | ||
|
||
|
||
Hostname.Text = $"{obj.Hostname}"; | ||
Typee.Text = $"{blocked}"; | ||
Isp.Text = $"{obj.Isp}"; | ||
CountryY.Text = $"{obj.CountryName}"; | ||
CountryCodeE.Text = $"{obj.CountryCode}"; | ||
Asn.Text = $"{obj.Asn}"; | ||
} | ||
catch (Exception ex) | ||
{ | ||
MessageBox.Show($"The ip ({IP.Text}) could not be found, Please try again."); | ||
} | ||
} | ||
|
||
private void Clear_Click(object sender, RoutedEventArgs e) | ||
{ | ||
if (IP.Text != "" && Hostname.Text != "" && Typee.Text != "" && Isp.Text != "" && CountryY.Text != "" && CountryCodeE.Text != "" && Asn.Text != "") | ||
{ | ||
IP.Text = ""; | ||
Hostname.Text = ""; | ||
Typee.Text = ""; | ||
Isp.Text = ""; | ||
CountryY.Text = ""; | ||
CountryCodeE.Text = ""; | ||
Asn.Text = ""; | ||
} | ||
} | ||
|
||
} | ||
public class IpApi | ||
{ | ||
[J("ip")] public string Ip { get; set; } | ||
[J("countryCode")] public string CountryCode { get; set; } | ||
[J("countryName")] public string CountryName { get; set; } | ||
[J("asn")] public long Asn { get; set; } | ||
[J("isp")] public string Isp { get; set; } | ||
[J("block")] public long Block { get; set; } | ||
[J("hostname")] public string Hostname { get; set; } | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="ControlzEx" version="3.0.2.4" targetFramework="net461" /> | ||
<package id="MahApps.Metro" version="1.6.0-alpha0184" targetFramework="net461" /> | ||
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net461" /> | ||
<package id="WpfAnimatedGif" version="1.4.15" targetFramework="net461" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"# IP-Checker" |