initial commit

This commit is contained in:
i2p
2026-08-27 11:02:04 -06:00
commit 040cb49761
531 changed files with 3266 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Coded by [email protected]
""" Geolocation info """
class GeoData(object):
def __init__(self, geo_data: dict):
u = "Unknown"
self.ip_address = geo_data["ip_address"]
try: self.city = geo_data["city"]["names"]["en"]
except: self.city = u
try: self.country = geo_data["country"]["names"]["en"]
except: self.country = u
try: self.iso_code = geo_data["country"]["iso_code"]
except: self.iso_code = u
""" Get country statistics """
def GetCountryStatistics(reports: list) -> dict:
stats = {}
for report in reports:
if not report.geo_data.iso_code in stats:
stats[report.geo_data.iso_code] = []
stats[report.geo_data.iso_code].append(report.geo_data)
return stats