Skip to content

Commit

Permalink
Uploaded first version
Browse files Browse the repository at this point in the history
  • Loading branch information
HeraKumi committed Jan 7, 2018
1 parent 957e4e4 commit efcb1f1
Show file tree
Hide file tree
Showing 11 changed files with 205 additions and 27 deletions.
15 changes: 14 additions & 1 deletion IP Checker by Hera/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@
xmlns:local="clr-namespace:IP_Checker_by_Hera"
StartupUri="MainWindow.xaml">
<Application.Resources>

<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>

<!-- MahApps.Metro resource dictionaries. Make sure that all file names are Case Sensitive! -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/FlatButton.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />

<!-- Accent and AppTheme setting -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Pink.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" />

</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
77 changes: 77 additions & 0 deletions IP Checker by Hera/IP Checker by Hera.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,24 @@
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<WebPage>publish.htm</WebPage>
<AutorunEnabled>true</AutorunEnabled>
<ApplicationRevision>7</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand All @@ -33,9 +51,36 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>82A4C222ACA24BCAF5D7A778E7CA39E3155022C1</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>IP Checker by Hera_TemporaryKey.pfx</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>true</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<SignManifests>true</SignManifests>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>dc83796de2b85b60c46928a158fff8cd_UGj_icon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="ControlzEx, Version=3.0.2.4, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ControlzEx.3.0.2.4\lib\net45\ControlzEx.dll</HintPath>
</Reference>
<Reference Include="MahApps.Metro, Version=1.6.0.184, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MahApps.Metro.1.6.0-alpha0184\lib\net45\MahApps.Metro.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\ControlzEx.3.0.2.4\lib\net45\System.Windows.Interactivity.dll</HintPath>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
Expand All @@ -48,6 +93,9 @@
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="WpfAnimatedGif, Version=1.4.15.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\WpfAnimatedGif.1.4.15\lib\net\WpfAnimatedGif.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
Expand Down Expand Up @@ -85,6 +133,8 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="IP Checker by Hera_TemporaryKey.pfx" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
Expand All @@ -93,5 +143,32 @@
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<SplashScreen Include="Properties\noice.png" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.6.1">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.6.1 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Resource Include="dc83796de2b85b60c46928a158fff8cd.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="noice_iFe_icon.ico" />
</ItemGroup>
<ItemGroup>
<Resource Include="dc83796de2b85b60c46928a158fff8cd_UGj_icon.ico" />
</ItemGroup>
<ItemGroup>
<Resource Include="Properties\amazing.gif" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
38 changes: 28 additions & 10 deletions IP Checker by Hera/MainWindow.xaml
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>
94 changes: 78 additions & 16 deletions IP Checker by Hera/MainWindow.xaml.cs
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; }
}
}
Binary file added IP Checker by Hera/Properties/amazing.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added IP Checker by Hera/Properties/noice.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 added IP Checker by Hera/noice_iFe_icon.ico
Binary file not shown.
7 changes: 7 additions & 0 deletions IP Checker by Hera/packages.config
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>
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"# IP-Checker"

0 comments on commit efcb1f1

Please sign in to comment.