[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 <kchung@nyu.edu>
Co-authored-by: Kevin Chung <kchung@ctfd.io>
This commit is contained in:
Cryptanalyse
2022-05-08 08:56:57 +02:00
committed by GitHub
parent 1bdd30606f
commit f5e703c2fc
3 changed files with 54 additions and 39 deletions

View File

@@ -16,6 +16,8 @@
- Show admins the email server error message when email sending fails - 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 issue where the current theme cannot be found in list of themes
- Fix page preview so that it accounts for the provided format - 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** **API**

View File

@@ -1,40 +1,49 @@
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
<td class="text-center"><b>User</b></td> <td class="text-center"><b>User</b></td>
<td class="text-center"><b>IP Address</b></td> <td class="text-center"><b>IP Address</b></td>
<td class="text-center"><b>Last Seen</b></td> <td class="text-center"><b>Last Seen</b></td>
<td class="text-center"><b>Country</b></td> <td class="text-center"><b>City</b></td>
</tr> <td class="text-center"><b>Country</b></td>
</thead> </tr>
<tbody> </thead>
{% for addr in addrs %} <tbody>
<tr> {% for addr in addrs %}
<td class="text-center"> <tr>
<a href="{{ url_for("admin.users_detail", user_id=addr.user_id) }}"> <td class="text-center">
{{ addr.user.name }} <a href="{{ url_for("admin.users_detail", user_id=addr.user_id) }}">
</a> {{ addr.user.name }}
</td> </a>
<td class="text-center">{{ addr.ip }}</td> </td>
<td class="text-center solve-time"> <td class="text-center">
<span data-time="{{ addr.date | isoformat }}"></span> <a href="{{ url_for('admin.users_listing', field='ip', q=addr.ip) }}">
</td> {{ addr.ip }}
{% set country = lookup_ip_address(addr.ip) %} </a>
{% if country %} </td>
<td class="text-center"> <td class="text-center solve-time">
<i class="flag-{{ country.lower() }}"></i> <span data-time="{{ addr.date | isoformat }}"></span>
&nbsp; </td>
{{ lookup_country_code(country) }} {% set city = lookup_ip_address_city(addr.ip) %}
</td> <td class="text-center">
{% else %} {% if city %}{{ city }}{% endif %}
<td class="text-center"> </td>
</td> {% set country = lookup_ip_address(addr.ip) %}
{% endif %} <td class="text-center">
</tr> {% if country %}
{% endfor %} <i class="flag-{{ country.lower() }}"></i>
</tbody> &nbsp;
</table> {{ lookup_country_code(country) }}
</div> {% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
<small class="float-right">
<a class="text-muted" href='https://db-ip.com'>IP Geolocation by DB-IP</a>
</small>
</div>
</div> </div>

View File

@@ -12,7 +12,11 @@
<tbody> <tbody>
{% for addr in addrs %} {% for addr in addrs %}
<tr> <tr>
<td class="text-center">{{ addr.ip }}</td> <td class="text-center">
<a href="{{ url_for('admin.users_listing', field='ip', q=addr.ip) }}">
{{ addr.ip }}
</a>
</td>
<td class="text-center solve-time"> <td class="text-center solve-time">
<span data-time="{{ addr.date | isoformat }}"></span> <span data-time="{{ addr.date | isoformat }}"></span>
</td> </td>