diff --git a/helm/Chart.yaml b/helm/Chart.yaml
index 49fac76..e4e1cee 100644
--- a/helm/Chart.yaml
+++ b/helm/Chart.yaml
@@ -2,8 +2,8 @@ apiVersion: v2
name: krawl-chart
description: A Helm chart for Krawl honeypot server
type: application
-version: 1.1.2
-appVersion: 1.1.2
+version: 1.1.3
+appVersion: 1.1.3
keywords:
- honeypot
- security
diff --git a/src/database.py b/src/database.py
index bda6e88..803e7e7 100644
--- a/src/database.py
+++ b/src/database.py
@@ -883,6 +883,7 @@ class DatabaseManager:
ip_filter: Optional[str] = None,
suspicious_only: bool = False,
since_minutes: Optional[int] = None,
+ sort_order: str = "desc",
) -> Dict[str, Any]:
"""
Retrieve access logs with pagination and optional filtering.
@@ -893,6 +894,7 @@ class DatabaseManager:
ip_filter: Filter by IP address
suspicious_only: Only return suspicious requests
since_minutes: Only return logs from the last N minutes
+ sort_order: Sort direction for timestamp ('asc' or 'desc')
Returns:
List of access log dictionaries
@@ -900,7 +902,12 @@ class DatabaseManager:
session = self.session
try:
offset = (page - 1) * page_size
- query = session.query(AccessLog).order_by(AccessLog.timestamp.desc())
+ order = (
+ AccessLog.timestamp.asc()
+ if sort_order == "asc"
+ else AccessLog.timestamp.desc()
+ )
+ query = session.query(AccessLog).order_by(order)
if ip_filter:
query = query.filter(AccessLog.ip == sanitize_ip(ip_filter))
diff --git a/src/routes/htmx.py b/src/routes/htmx.py
index 303bce5..549f044 100644
--- a/src/routes/htmx.py
+++ b/src/routes/htmx.py
@@ -180,7 +180,10 @@ async def htmx_access_logs_by_ip(
):
db = get_db()
result = db.get_access_logs_paginated(
- page=max(1, page), page_size=25, ip_filter=ip_filter
+ page=max(1, page),
+ page_size=25,
+ ip_filter=ip_filter,
+ sort_order=sort_order if sort_order in ("asc", "desc") else "desc",
)
# Normalize pagination key (DB returns total_attackers, template expects total)
diff --git a/src/templates/jinja2/dashboard/partials/access_by_ip_table.html b/src/templates/jinja2/dashboard/partials/access_by_ip_table.html
index 5e7bd6c..e260f56 100644
--- a/src/templates/jinja2/dashboard/partials/access_by_ip_table.html
+++ b/src/templates/jinja2/dashboard/partials/access_by_ip_table.html
@@ -45,7 +45,10 @@
{{ log.timestamp | format_ts }} |
{% if log.id %}
-
+
{% endif %}
|
diff --git a/src/templates/jinja2/dashboard/partials/attack_types_table.html b/src/templates/jinja2/dashboard/partials/attack_types_table.html
index 4ac3369..fd80ac1 100644
--- a/src/templates/jinja2/dashboard/partials/attack_types_table.html
+++ b/src/templates/jinja2/dashboard/partials/attack_types_table.html
@@ -62,7 +62,10 @@
{{ attack.timestamp | format_ts }} |
{% if attack.log_id %}
-
+
{% endif %}
|