modified doc
This commit is contained in:
@@ -3,7 +3,7 @@ name: krawl-chart
|
||||
description: A Helm chart for Krawl honeypot server
|
||||
type: application
|
||||
version: 1.0.0
|
||||
appVersion: 1.0.1
|
||||
appVersion: 1.0.2
|
||||
keywords:
|
||||
- honeypot
|
||||
- security
|
||||
|
||||
@@ -147,7 +147,9 @@ class DatabaseManager:
|
||||
migrations_run.append("region")
|
||||
|
||||
if "region_name" not in columns:
|
||||
cursor.execute("ALTER TABLE ip_stats ADD COLUMN region_name VARCHAR(100)")
|
||||
cursor.execute(
|
||||
"ALTER TABLE ip_stats ADD COLUMN region_name VARCHAR(100)"
|
||||
)
|
||||
migrations_run.append("region_name")
|
||||
|
||||
if "timezone" not in columns:
|
||||
|
||||
@@ -41,7 +41,9 @@ def fetch_ip_geolocation(ip_address: str) -> Optional[Dict[str, Any]]:
|
||||
|
||||
# Check if the API call was successful
|
||||
if data.get("status") != "success":
|
||||
app_logger.warning(f"IP lookup failed for {ip_address}: {data.get('message')}")
|
||||
app_logger.warning(
|
||||
f"IP lookup failed for {ip_address}: {data.get('message')}"
|
||||
)
|
||||
return None
|
||||
|
||||
# Cache the result
|
||||
@@ -113,7 +115,7 @@ def fetch_blocklist_data(ip_address: str) -> Optional[Dict[str, Any]]:
|
||||
# Get the most recent result (first in list, sorted by record_added)
|
||||
most_recent = results[0]
|
||||
list_on = most_recent.get("list_on", {})
|
||||
|
||||
|
||||
app_logger.debug(f"Fetched blocklist data for {ip_address}")
|
||||
return list_on
|
||||
except requests.RequestException as e:
|
||||
|
||||
@@ -29,7 +29,7 @@ def main():
|
||||
try:
|
||||
# Fetch geolocation data using ip-api.com
|
||||
geoloc_data = extract_geolocation_from_ip(ip)
|
||||
|
||||
|
||||
# Fetch blocklist data from lcrawl API
|
||||
blocklist_data = fetch_blocklist_data(ip)
|
||||
|
||||
@@ -55,7 +55,7 @@ def main():
|
||||
list_on = blocklist_data
|
||||
else:
|
||||
list_on = {}
|
||||
|
||||
|
||||
# Add flags to list_on
|
||||
list_on["is_proxy"] = is_proxy
|
||||
list_on["is_hosting"] = is_hosting
|
||||
@@ -69,7 +69,9 @@ def main():
|
||||
sanitized_city = sanitize_for_storage(city, 100) if city else None
|
||||
sanitized_timezone = sanitize_for_storage(timezone, 50)
|
||||
sanitized_isp = sanitize_for_storage(isp, 100)
|
||||
sanitized_reverse = sanitize_for_storage(reverse, 255) if reverse else None
|
||||
sanitized_reverse = (
|
||||
sanitize_for_storage(reverse, 255) if reverse else None
|
||||
)
|
||||
sanitized_list_on = sanitize_dict(list_on, 100000)
|
||||
|
||||
db_manager.update_ip_rep_infos(
|
||||
|
||||
@@ -50,7 +50,9 @@ def generate_dashboard(stats: dict, dashboard_path: str = "") -> str:
|
||||
|
||||
# Generate suspicious accesses rows with clickable IPs
|
||||
suspicious_rows = (
|
||||
"\n".join([f"""<tr class="ip-row" data-ip="{_escape(log["ip"])}">
|
||||
"\n".join(
|
||||
[
|
||||
f"""<tr class="ip-row" data-ip="{_escape(log["ip"])}">
|
||||
<td class="ip-clickable">{_escape(log["ip"])}</td>
|
||||
<td>{_escape(log["path"])}</td>
|
||||
<td style="word-break: break-all;">{_escape(log["user_agent"][:60])}</td>
|
||||
@@ -62,7 +64,10 @@ def generate_dashboard(stats: dict, dashboard_path: str = "") -> str:
|
||||
<div class="loading">Loading stats...</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>""" for log in stats["recent_suspicious"][-10:]])
|
||||
</tr>"""
|
||||
for log in stats["recent_suspicious"][-10:]
|
||||
]
|
||||
)
|
||||
or '<tr><td colspan="4" style="text-align:center;">No suspicious activity detected</td></tr>'
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user