From f5e703c2fc7d8dfb573260f267b3290f7db338e3 Mon Sep 17 00:00:00 2001 From: Cryptanalyse <51446657+Cryptanalyse@users.noreply.github.com> Date: Sun, 8 May 2022 08:56:57 +0200 Subject: [PATCH] [Admin] Add a link on the IP modal to search for a given IP address accross all users. (#2113) - Add links from User/Team Profile IP addresses to a User IP address search page - Add city geolocation to Team Profile IP addresses Co-authored-by: J <> Co-authored-by: Kevin Chung Co-authored-by: Kevin Chung --- CHANGELOG.md | 2 + .../templates/modals/teams/addresses.html | 85 ++++++++++--------- .../templates/modals/users/addresses.html | 6 +- 3 files changed, 54 insertions(+), 39 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a836a86..901a86b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ - Show admins the email server error message when email sending fails - Fix issue where the current theme cannot be found in list of themes - Fix page preview so that it accounts for the provided format +- Add links from User/Team Profile IP addresses to a User IP address search page +- Add city geolocation to Team Profile IP addresses **API** diff --git a/CTFd/themes/admin/templates/modals/teams/addresses.html b/CTFd/themes/admin/templates/modals/teams/addresses.html index aacd8a2d..bbc22f58 100644 --- a/CTFd/themes/admin/templates/modals/teams/addresses.html +++ b/CTFd/themes/admin/templates/modals/teams/addresses.html @@ -1,40 +1,49 @@
-
- - - - - - - - - - - {% for addr in addrs %} - - - - - {% set country = lookup_ip_address(addr.ip) %} - {% if country %} - - {% else %} - - {% endif %} - - {% endfor %} - -
UserIP AddressLast SeenCountry
- - {{ addr.user.name }} - - {{ addr.ip }} - - - -   - {{ lookup_country_code(country) }} - -
-
+
+ + + + + + + + + + + + {% for addr in addrs %} + + + + + {% set city = lookup_ip_address_city(addr.ip) %} + + {% set country = lookup_ip_address(addr.ip) %} + + + {% endfor %} + +
UserIP AddressLast SeenCityCountry
+ + {{ addr.user.name }} + + + + {{ addr.ip }} + + + + + {% if city %}{{ city }}{% endif %} + + {% if country %} + +   + {{ lookup_country_code(country) }} + {% endif %} +
+ + IP Geolocation by DB-IP + +
diff --git a/CTFd/themes/admin/templates/modals/users/addresses.html b/CTFd/themes/admin/templates/modals/users/addresses.html index c0e60023..4012e3a9 100644 --- a/CTFd/themes/admin/templates/modals/users/addresses.html +++ b/CTFd/themes/admin/templates/modals/users/addresses.html @@ -12,7 +12,11 @@ {% for addr in addrs %} - {{ addr.ip }} + + + {{ addr.ip }} + +