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