feat: add hosting company details and server location via IP geolocation
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Uses ip-api.com to look up ISP name, organization, city, region, country and AS number for the hosting IP address. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e38071c321
commit
4839ac251a
@ -304,10 +304,34 @@ def admin_seo_detail(company_id):
|
||||
'text': issue.get('message', issue.get('text', str(issue)))
|
||||
})
|
||||
|
||||
# IP geolocation lookup for hosting details
|
||||
ip_info = {}
|
||||
if analysis and analysis.hosting_ip:
|
||||
try:
|
||||
import requests as req
|
||||
resp = req.get(
|
||||
f'http://ip-api.com/json/{analysis.hosting_ip}?fields=status,org,isp,city,regionName,country,as',
|
||||
timeout=3
|
||||
)
|
||||
if resp.status_code == 200:
|
||||
data = resp.json()
|
||||
if data.get('status') == 'success':
|
||||
ip_info = {
|
||||
'org': data.get('org', ''),
|
||||
'isp': data.get('isp', ''),
|
||||
'city': data.get('city', ''),
|
||||
'region': data.get('regionName', ''),
|
||||
'country': data.get('country', ''),
|
||||
'as_number': data.get('as', ''),
|
||||
}
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return render_template('admin/seo_detail.html',
|
||||
company=company,
|
||||
analysis=analysis,
|
||||
recommendations=recommendations
|
||||
recommendations=recommendations,
|
||||
ip_info=ip_info
|
||||
)
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
@ -847,10 +847,16 @@
|
||||
<span class="detail-value">{{ analysis.ssl_issuer }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if analysis.hosting_provider %}
|
||||
{% if analysis.hosting_provider or ip_info.get('isp') %}
|
||||
<div class="detail-item">
|
||||
<span class="detail-label">Hosting</span>
|
||||
<span class="detail-value">{{ analysis.hosting_provider }}</span>
|
||||
<span class="detail-value">{{ analysis.hosting_provider or ip_info.get('isp', '') }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if ip_info.get('org') and ip_info.get('org') != (analysis.hosting_provider or '') %}
|
||||
<div class="detail-item">
|
||||
<span class="detail-label">Firma hostingowa</span>
|
||||
<span class="detail-value">{{ ip_info.org }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if analysis.hosting_ip %}
|
||||
@ -859,6 +865,18 @@
|
||||
<span class="detail-value" style="font-family: monospace;">{{ analysis.hosting_ip }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if ip_info.get('city') %}
|
||||
<div class="detail-item">
|
||||
<span class="detail-label">Lokalizacja serwera</span>
|
||||
<span class="detail-value">{{ ip_info.city }}{% if ip_info.get('region') %}, {{ ip_info.region }}{% endif %}{% if ip_info.get('country') %}, {{ ip_info.country }}{% endif %}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if ip_info.get('as_number') %}
|
||||
<div class="detail-item">
|
||||
<span class="detail-label">Siec (AS)</span>
|
||||
<span class="detail-value" style="font-size: 11px;">{{ ip_info.as_number }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if analysis.server_software %}
|
||||
<div class="detail-item">
|
||||
<span class="detail-label">Oprogramowanie serwera</span>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user