[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
- 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**

View File

@@ -6,6 +6,7 @@
<td class="text-center"><b>User</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>City</b></td>
<td class="text-center"><b>Country</b></td>
</tr>
</thead>
@@ -17,24 +18,32 @@
{{ addr.user.name }}
</a>
</td>
<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">
<span data-time="{{ addr.date | isoformat }}"></span>
</td>
{% set country = lookup_ip_address(addr.ip) %}
{% if country %}
{% set city = lookup_ip_address_city(addr.ip) %}
<td class="text-center">
{% if city %}{{ city }}{% endif %}
</td>
{% set country = lookup_ip_address(addr.ip) %}
<td class="text-center">
{% if country %}
<i class="flag-{{ country.lower() }}"></i>
&nbsp;
{{ lookup_country_code(country) }}
</td>
{% else %}
<td class="text-center">
</td>
{% 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>

View File

@@ -12,7 +12,11 @@
<tbody>
{% for addr in addrs %}
<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">
<span data-time="{{ addr.date | isoformat }}"></span>
</td>