Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Added DB Features
Browse files Browse the repository at this point in the history
Now IP Addresses can be stored in Database.
  • Loading branch information
henry-richard7 committed Jul 27, 2021
1 parent 620c111 commit f41ce27
Show file tree
Hide file tree
Showing 35 changed files with 30,216 additions and 15 deletions.
150 changes: 140 additions & 10 deletions GTA Online IP Grabber/Form1.Designer.cs

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

78 changes: 74 additions & 4 deletions GTA Online IP Grabber/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
using System.Collections.Generic;
using System.Windows.Forms;
using System.Threading;

using LiteDB;
using System.Diagnostics;

namespace GTA_Online_IP_Grabber
{
Expand All @@ -19,6 +20,19 @@ public Form1()
InitializeComponent();
}

public class IP_Address
{
public string IP { get; set; }
public string Country { get; set; }
public string City { get; set; }

public string State { get; set; }

public string ZipCode { get; set; }

public string TimeZone { get; set; }
}

public List<String> getGeoInfo(String ip2Geo)
{

Expand Down Expand Up @@ -76,17 +90,46 @@ private void PacketHandler(Packet packet)

IpV4Datagram ip = packet.Ethernet.IpV4;
UdpDatagram udp = ip.Udp;
IP_Address customer;

if (!ipAddresses.Contains(ip.Destination.ToString()))
{
ipAddresses.Add(ip.Destination.ToString());
String[] rows = { ip.Destination.ToString(), getGeoInfo(ip.Destination.ToString())[0],
String[] rows = { ip.Destination.ToString(),
getGeoInfo(ip.Destination.ToString())[0],
getGeoInfo(ip.Destination.ToString())[1],
getGeoInfo(ip.Destination.ToString())[2],
getGeoInfo(ip.Destination.ToString())[3],
getGeoInfo(ip.Destination.ToString())[4]
};


if (checkBox_store_In_DB.Checked)
{
using (var db = new LiteDatabase(@"IP_Addresses.db"))
{

var col = db.GetCollection<IP_Address>("IP_Address");




customer = new IP_Address
{
IP = ip.Destination.ToString(),
Country = getGeoInfo(ip.Destination.ToString())[0],
City = getGeoInfo(ip.Destination.ToString())[1],
State = getGeoInfo(ip.Destination.ToString())[2],
ZipCode = getGeoInfo(ip.Destination.ToString())[3],
TimeZone = getGeoInfo(ip.Destination.ToString())[4]

};
col.Insert(customer);



}
}

ListViewItem item = new ListViewItem(rows);
listView1.Items.Add(item);
}
Expand Down Expand Up @@ -160,7 +203,8 @@ public void getUDPPackets()

private void button1_Click(object sender, EventArgs e)
{

label_Status.Text = "Running";
label_Status.ForeColor = System.Drawing.ColorTranslator.FromHtml("#006400");
Thread thread = new Thread(getUDPPackets) { IsBackground = true };
thread.Start();

Expand All @@ -170,6 +214,32 @@ private void listView1_SelectedIndexChanged(object sender, EventArgs e)
{

}

private void groupBox1_Enter(object sender, EventArgs e)
{

}

private void loadIPDatabaseToolStripMenuItem_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2();
f2.Show();
}

private void developedByHenryRichardJToolStripMenuItem_Click(object sender, EventArgs e)
{
Process.Start("https://github.com/henry-richard7");
}

private void paypalToolStripMenuItem_Click(object sender, EventArgs e)
{
Process.Start("https://www.paypal.com/paypalme/henryrics");
}

private void youtubeToolStripMenuItem_Click(object sender, EventArgs e)
{
Process.Start("https://www.youtube.com/channel/UCVGasc5jr45eZUpZNHvbtWQ");
}
}
}

3 changes: 3 additions & 0 deletions GTA Online IP Grabber/Form1.resx
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
Expand Down
Loading

0 comments on commit f41ce27

Please sign in to comment.