mirror of
https://codeberg.org/slatian/service.echoip-slatecave.git
synced 2024-11-10 00:27:21 +01:00
Template improments, links, breadcrumbs for domain lookups
This commit is contained in:
parent
6e1d3c02ef
commit
da13444a2e
@ -30,8 +30,8 @@ hidden_suffixes = [".com"]
|
||||
# Path to geoip databses
|
||||
# Currently only the mmdb format is supported
|
||||
# Official databases can be obtained from maxmind.com
|
||||
#asn_database = "mmdb/GeoLite2-ASN.mmdb"
|
||||
#location_database = "mmdb/GeoLite2-City.mmdb"
|
||||
asn_database = "mmdb/GeoLite2-ASN.mmdb"
|
||||
location_database = "mmdb/GeoLite2-City.mmdb"
|
||||
|
||||
# If anyone knows a free (as in freedom) groip database
|
||||
# please open an issue so I can integrate it
|
||||
|
@ -285,7 +285,7 @@ async fn format_and_language_middleware<B>(
|
||||
next.run(req).await
|
||||
}
|
||||
|
||||
async fn hello_world_handler(
|
||||
async fn not_found_handler(
|
||||
State(arc_state): State<Arc<ServiceSharedState>>,
|
||||
Extension(settings): Extension<TemplateSettings>,
|
||||
) -> Response {
|
||||
@ -297,7 +297,7 @@ async fn hello_world_handler(
|
||||
).await
|
||||
}
|
||||
|
||||
async fn not_found_handler(
|
||||
async fn hello_world_handler(
|
||||
State(arc_state): State<Arc<ServiceSharedState>>,
|
||||
Extension(settings): Extension<TemplateSettings>,
|
||||
) -> Response {
|
||||
|
31
templates/asn.html
Normal file
31
templates/asn.html
Normal file
@ -0,0 +1,31 @@
|
||||
{% extends "base.html" %}
|
||||
{% import "helpers.html" as helper %}
|
||||
{% import "links.html" as links %}
|
||||
|
||||
{% block title %}AS{{ data.asn }}{% endblock %}
|
||||
{% block og_title %}AS{{ data.asn }}{% endblock %}
|
||||
{% block h1 %}<code>AS{{ data.asn }}</code>{% endblock %}
|
||||
|
||||
{% block og_path %}/?query=AS{{ data.asn }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% if data.result.idn %}
|
||||
{% set idn = data.result.idn %}
|
||||
<section>
|
||||
<h2>Internationalized Domain Names</h2>
|
||||
<p>Because of some limitations the DNS has, Unicode caracters need a special encoding.</p>
|
||||
{% if idn.original_was == "unicode" %}
|
||||
<p>Your Unicode query has been encoded as the <i>IDN</i> <code>{{ idn.idn }}</code> to generate the results below.</p>
|
||||
{% else %}
|
||||
<p>Your <i>IDN</i> would decode to <code>{{ idn.unicode }}</code>.</p>
|
||||
{% endif %}
|
||||
</section>
|
||||
{% endif %}
|
||||
|
||||
<section>
|
||||
<h2>Other Services</h2>
|
||||
{{ links::asn_links(asn=data.asn) }}
|
||||
</section>
|
||||
|
||||
{% endblock %}
|
||||
|
@ -19,6 +19,7 @@
|
||||
<meta name="color-scheme" content="light dark">
|
||||
{% if extra.stylesheet %}<link rel="stylesheet" href="{{extra.stylesheet}}" type="text/css" />{% endif %}
|
||||
{% if extra.favicon %}<link rel="icon" href="{{extra.favicon}}" type="{{extra.favicon_mimetype|default(value="image/png")}}" \>{% endif %}
|
||||
<!-- View: {{view}} -->
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
@ -27,7 +28,7 @@
|
||||
<form class="search" method="GET" action="{{ extra.base_url }}">
|
||||
<input type="text" name="query" autocomplete="on" maxlength="260"
|
||||
title="Search for an IP-Adress, Domain-Name, or ASN."
|
||||
value="{% if view == "dig" %}{{ data.query }}{% elif view == "ip" %}{{ data.result.address }}{% endif %}"/>
|
||||
value="{% if view == "dig" %}{{ data.query }}{% elif view == "ip" %}{{ data.result.address }}{% elif view == "asn"%}AS{{ data.asn }}{% endif %}"/>
|
||||
<input type="submit" value="Query"/>
|
||||
</form>
|
||||
</nav>
|
||||
|
@ -1,9 +1,10 @@
|
||||
{% extends "base.html" %}
|
||||
{% import "helpers.html" as helper %}
|
||||
{% import "links.html" as links %}
|
||||
|
||||
{% block title %}dig {{ data.query }}{% endblock %}
|
||||
{% block og_title %}dig {{ data.query }}{% endblock %}
|
||||
{% block h1 %}dig <code>{{ data.query }}</code>{% endblock %}
|
||||
{% block h1 %}dig <code>{{ helper::breadcrumb_domain(extra=extra, name=data.query) }}</code>{% endblock %}
|
||||
|
||||
{% block og_path %}/dig/{{ data.query | urlencode_strict }}{% endblock %}
|
||||
|
||||
@ -65,4 +66,10 @@
|
||||
{% endif %}
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>Other Services</h2>
|
||||
{{ links::domain_name_links(name=idn.idn|default(value=data.query))}}
|
||||
</section>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
@ -11,3 +11,8 @@ stylesheet = "https://slatecave.net/assets/site_slatecave/slatecave_v3.css"
|
||||
# favicon = ""
|
||||
# favicon_mimetype = "image/png"
|
||||
# favicon_mimetype = "image/jpeg"
|
||||
|
||||
[404]
|
||||
# configure the 404 page, this is available for other pages too!
|
||||
title = "Nothing here"
|
||||
description = "Page not found"
|
||||
|
@ -17,3 +17,14 @@
|
||||
<a href="{{ extra.base_url }}/ip/{{ ip | urlencode_strict | replace(from="%2e", to=".") | replace(from="%3a", to=":") | safe }}"><code>{{ ip }}</code></a>
|
||||
{% endmacro dig %}
|
||||
|
||||
{% macro breadcrumb_domain(extra, name) %}
|
||||
{% set_global dot = "" %}
|
||||
{% set crumbs = name | split(pat=".") %}
|
||||
{% set_global i = 0 %}
|
||||
{% for crumb in crumbs %}
|
||||
{{-dot}}<a href="{{self::dig_link(extra=extra, name=crumbs | slice(start=i) | join(sep="."))}}">{{crumb}}</a>
|
||||
{%- set_global dot = "." -%}
|
||||
{%- set_global i = i+1 -%}
|
||||
{% endfor %}
|
||||
|
||||
{% endmacro breadcrumb_domain %}
|
||||
|
@ -1,5 +1,6 @@
|
||||
{% extends "base.html" %}
|
||||
{% import "helpers.html" as helper %}
|
||||
{% import "links.html" as links %}
|
||||
|
||||
{% block title %}{{ data.result.address }}{% endblock %}
|
||||
{% block og_title %}Lookup {{ data.result.address }}{% endblock %}
|
||||
@ -13,7 +14,7 @@
|
||||
<h2>Network Information</h2>
|
||||
<dl>
|
||||
<dh>Type of Address</dh>
|
||||
<dd>{{r.ip_info.scope}} {{r.ip_info.cast}} IPv{% if r.ip_info.is_v6_address %}6{% else %}4{% endif %}</dd>
|
||||
<dd>{{r.ip_info.scope | title}} {{r.ip_info.cast | title}} IPv{% if r.ip_info.is_v6_address %}6{% else %}4{% endif %}</dd>
|
||||
{% if r.hostname %}
|
||||
<dh>Hostname</dh>
|
||||
<dd>{{ helper::dig(extra=extra, name=r.hostname) }}</dd>
|
||||
@ -25,6 +26,7 @@
|
||||
<dd>{{ r.asn.name }}</dd>
|
||||
</dl>
|
||||
{% endif %}
|
||||
{% block other_ip_button %}{% endblock %}
|
||||
</section>
|
||||
{% if r.location %}
|
||||
<section>
|
||||
@ -32,8 +34,12 @@
|
||||
<dl>
|
||||
{{ helper::place_dl(place=r.location.continent, label="Continent") }}
|
||||
{{ helper::place_dl(place=r.location.country, label="Country") }}
|
||||
{% if r.location.country.iso_code | default(value="") != r.location.registered_country.iso_code | default(value="") %}
|
||||
{{ helper::place_dl(place=r.location.registered_country, label="Registred in") }}
|
||||
{% endif %}
|
||||
{% if r.location.country.iso_code | default(value="") != r.location.represented_country.iso_code | default(value="")%}
|
||||
{{ helper::place_dl(place=r.location.represented_country, label="Represents") }}
|
||||
{% endif %}
|
||||
{% if r.location.subdivisions %}
|
||||
{% for sd in r.location.subdivisions %}
|
||||
{{ helper::place_dl(place=sd, label="Subdivision", iso_code_prefix=r.location.country.iso_code|default(value="")) }}
|
||||
@ -57,5 +63,12 @@
|
||||
</section>
|
||||
{% endif %}
|
||||
{% block extra_content %}{% endblock %}
|
||||
<section>
|
||||
<h2>Other Services</h2>
|
||||
{{ links::ip_address_links(address=r.address)}}
|
||||
{% if r.asn %}
|
||||
{{ links::asn_links(asn=r.asn.asn, org_name=r.asn.name) }}
|
||||
{% endif %}
|
||||
</section>
|
||||
{% endblock %}
|
||||
|
||||
|
36
templates/links.html
Normal file
36
templates/links.html
Normal file
@ -0,0 +1,36 @@
|
||||
{% macro ip_address_links(address) %}
|
||||
<p>Look up <code>{{address}}</code> …</p>
|
||||
<ul class="link-list">
|
||||
<li><a target="_blank" href="https://apps.db.ripe.net/db-web-ui/query?bflag=true&dflag=false&rflag=true&searchtext={{ address }}&source=RIPE">… in the RIPE Database</a></li>
|
||||
<li><a target="_blank" href="https://apps.db.ripe.net/db-web-ui/query?bflag=true&dflag=false&rflag=true&searchtext={{ address }}&source=GRS">… in the RIPE Global Resources Service</a></li>
|
||||
<li><a target="_blank" href="https://www.shodan.io/host/{{ address }}">… on shodan.io <small>(limited querys per day, wants an account)</small></a></li>
|
||||
<li><a target="_blank" href="https://search.censys.io/search?resource=hosts&sort=RELEVANCE&per_page=25&virtual_hosts=EXCLUDE&q=ip%3D{{ address }}">… on search.censys.io <small>(10 querys per day, wants an account)</small></a></li>
|
||||
{% if not address is matching(":") %}
|
||||
{# v4 only #}
|
||||
<li><a target="_blank" href="https://www.virustotal.com/gui/ip-address/{{ address }}">… on virustotal.com</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
{% endmacro ip_address_links %}
|
||||
|
||||
{% macro domain_name_links(name) %}
|
||||
<p>Look up <code>{{name}}</code></p>
|
||||
<ul class="link-list">
|
||||
<li><a target="_blank" href="https://www.shodan.io/domain/{{ name }}">… on shodan.io <small>(limited querys per day, wants an account)</small></a></li>
|
||||
<li><a target="_blank" href="https://search.censys.io/search?resource=hosts&sort=RELEVANCE&per_page=25&virtual_hosts=EXCLUDE&q=ip%3D{{ name }}">… on search.censys.io <small>(10 querys per day, wants an account)</small></a></li>
|
||||
<li><a target="_blank" href="https://www.virustotal.com/gui/domain/{{ name }}">… on virustotal.com</a></li>
|
||||
</ul>
|
||||
{% endmacro domain_name_links %}
|
||||
|
||||
{% macro asn_links(asn, org_name="") %}
|
||||
<p>Look up <code>AS{{asn}}</code>{% if org_name%} ({{org_name}}){% endif %} …</p>
|
||||
<ul class="link-list">
|
||||
<li><a target="_blank" href="https://bgp.he.net/AS{{asn}}">… on Hurricane Electric BGP Toolkit</a></li>
|
||||
<li><a target="_blank" href="https://radar.qrator.net/as{{asn}}">… on radar.qrator.net (BGP Tool)</a></li>
|
||||
<li><a target="_blank" href="https://search.censys.io/search?resource=hosts&sort=RELEVANCE&per_page=25&virtual_hosts=EXCLUDE&q=autonomous_system.asn%3D{{asn}}">… on search.censys.io <small>(10 querys per day, wants an account)</small></a></li>
|
||||
<li><a target="_blank" href="https://query.wikidata.org/#%23Select%20Wikipedia%20articles%20that%20belong%20to%20a%20given%20asn%0ASELECT%20DISTINCT%20%3Fitem%20%3Fwebsite%20%3FitemLabel%20%3FitemDescription%20%3Flang%20%3Farticle%20WHERE%20%7B%0A%20%20VALUES%20%3Fasn%20%7B%0A%20%20%20%20%22{{ asn }}%22%0A%20%20%7D%0A%20%20%3Fasn%20%5Ewdt%3AP3797%20%3Fitem.%0A%20%20OPTIONAL%20%7B%20%3Fitem%20wdt%3AP856%20%3Fwebsite.%20%7D%0A%20%20OPTIONAL%20%7B%0A%20%20%20%20%3Fitem%20%5Eschema%3Aabout%20%3Farticle.%0A%20%20%20%20%3Farticle%20schema%3AisPartOf%20_%3Ab64.%0A%20%20%20%20_%3Ab64%20wikibase%3AwikiGroup%20%22wikipedia%22.%0A%20%20%20%20%3Farticle%20schema%3AinLanguage%20%3Flang%3B%0A%20%20%20%20%20%20schema%3Aname%20%3Farticlename.%0A%20%20%20%20FILTER(((%3Flang%20%3D%20%22%5BAUTO_LANGUAGE%5D%22)%20%7C%7C%20(%3Flang%20%3D%20%22en%22))%20%7C%7C%20(%3Flang%20%3D%20%22de%22))%0A%20%20%7D%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%0A%20%20%20%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%0A%20%20%20%20%3Fitem%20rdfs%3Alabel%20%3FitemLabel%3B%0A%20%20%20%20%20%20schema%3Adescription%20%3FitemDescription.%0A%20%20%7D%0A%7D%0AORDER%20BY%20(UCASE(%3FitemLabel))">… on Wikidata and Wikipedia <small>(Press the run buttonin the sidebar to get results)</small></a></li>
|
||||
</ul>
|
||||
{% endmacro asn_links %}
|
||||
|
||||
{% macro map_link(lat, lon) %}
|
||||
https://www.openstreetmap.org/export/embed.html?bbox={{lon-0.03}}%2C{{lat-0.03}}%2C{{lon+0.03}}%2C{{lat+0.03}}&layer=mapnik&marker={{lat}}%2C{{lon}}
|
||||
{% endmacro map_link %}
|
@ -5,5 +5,5 @@
|
||||
{% block h1 %}{{ data.title }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<p>{{data.mesage}}</p>
|
||||
<p>{{data.message}}</p>
|
||||
{% endblock %}
|
||||
|
Loading…
Reference in New Issue
Block a user