Bug Fix
This commit is contained in:
parent
512f94d7f6
commit
0ebd1abdd7
1 changed files with 22 additions and 22 deletions
38
log.py
38
log.py
|
@ -112,7 +112,7 @@ class logsManager:
|
|||
cursor = conn.cursor()
|
||||
timeThreshold = datetime.now() - timedelta(days=1)
|
||||
|
||||
cursor.execute("SELECT blockedipaddress, hostname, city, region, country, loc, org, postal, timezone FROM monutil_geoip WHERE logtime >= ?", timeThreshold)
|
||||
cursor.execute("SELECT blockedipaddress, monutil_geoip.hostname, city, region, country, loc, org, postal, timezone FROM monutil_geoip INNER JOIN monutil_ipblock ON monutil_geoip.logID = monutil_ipblock.logID WHERE logtime >= ? AND blockedipaddress = ?", timeThreshold, ip)
|
||||
|
||||
rows = cursor.fetchall()
|
||||
|
||||
|
@ -138,16 +138,16 @@ class logsManager:
|
|||
print("Rate limit exceeded. Please wait before trying again.")
|
||||
return None
|
||||
|
||||
url = f"https://ipinfo.io/{ip}?token={token}"
|
||||
url = f"https://ipinfo.io/{ip}?token={token}"
|
||||
|
||||
response = requests.get(url)
|
||||
response.raise_for_status()
|
||||
data = response.json()
|
||||
response = requests.get(url)
|
||||
response.raise_for_status()
|
||||
data = response.json()
|
||||
|
||||
if response.status_code == 429:
|
||||
if response.status_code == 429:
|
||||
|
||||
print("Rate limit exceeded. Please wait before trying again.")
|
||||
today = datetime.now()
|
||||
print("Rate limit exceeded. Please wait before trying again.")
|
||||
today = datetime.now()
|
||||
|
||||
if today.month == 12:
|
||||
|
||||
|
@ -159,17 +159,17 @@ class logsManager:
|
|||
|
||||
return None
|
||||
|
||||
geoinfo = {
|
||||
"ip": data.get("ip"),
|
||||
"hostname": data.get("hostname"),
|
||||
"city": data.get("city"),
|
||||
"region": data.get("region"),
|
||||
"country": data.get("country"),
|
||||
"loc": data.get("loc"),
|
||||
"org": data.get("org"),
|
||||
"postal": data.get("postal"),
|
||||
"timezone": data.get("timezone"),
|
||||
}
|
||||
geoinfo = {
|
||||
"ip": data.get("ip"),
|
||||
"hostname": data.get("hostname"),
|
||||
"city": data.get("city"),
|
||||
"region": data.get("region"),
|
||||
"country": data.get("country"),
|
||||
"loc": data.get("loc"),
|
||||
"org": data.get("org"),
|
||||
"postal": data.get("postal"),
|
||||
"timezone": data.get("timezone"),
|
||||
}
|
||||
|
||||
return geoinfo
|
||||
|
||||
|
|
Loading…
Reference in a new issue