From e50bd14fcf2ca3a6bad60a3eec7b9a1080a7b535 Mon Sep 17 00:00:00 2001 From: Slatian Date: Sat, 25 Feb 2023 18:32:09 +0100 Subject: [PATCH] Fixed text templates --- templates/dig.txt | 26 +++++++++++++++++++++++++- templates/helpers.html | 2 +- templates/ip.txt | 42 +++++++++++++++++++++--------------------- 3 files changed, 47 insertions(+), 23 deletions(-) diff --git a/templates/dig.txt b/templates/dig.txt index 590476d..84082d7 100644 --- a/templates/dig.txt +++ b/templates/dig.txt @@ -85,6 +85,30 @@ MX (Mail Exchange) records: No MX (Mail Exchange) records. {% endif %} +{%- if r.soa %} +SOA (Source Of Authority) records: +{% for soa in r.soa %} +* MName: {{soa.mname}} +* RName: {{soa.rname}} +* Serial: {{soa.serial}} +* Refresh: {{soa.refresh / 60 | round(precision=2)}}m +* Retry: {{soa.retry / 60 | round(precision=2)}}m +* expire: {{soa.expire / 3600 | round(precision=2)}}h +* minimum: {{soa.minimum / 60 | round(precision=2)}}m TTL +{% endfor %} +{%- else %} +No SOA (Source Of Authority) records. +{% endif %} + +{%- if r.ns %} +NS (Name Server) records: +{% for ns in r.ns -%} +* {{ns}} +{% endfor %} +{%- else %} +No NS (Name Server) records. +{% endif %} + {%- if r.caa %} CAA (Certification Authority Authorization) records: {% for caa in r.caa -%} @@ -99,7 +123,7 @@ TXT records: {% for txt in r.txt -%} * {{txt}} {% endfor %} -{%- else -%} +{%- else %} No TXT records. {% endif %} diff --git a/templates/helpers.html b/templates/helpers.html index 68dd82a..931cddc 100644 --- a/templates/helpers.html +++ b/templates/helpers.html @@ -5,7 +5,7 @@
{{place.name}} {% if place.iso_code%}({% if iso_code_prefix %}{{iso_code_prefix}}-{% endif %}{{place.iso_code}}){% endif %}
{% else -%} * {% if label %}{{label}}: {% endif %}{{place.name}}{% if place.iso_code%} ({% if iso_code_prefix %}{{iso_code_prefix}}-{% endif %}{{place.iso_code}}){% endif %} - {%- endif -%} +{% endif -%} {%- endif -%} {%- endmacro place_dl %} diff --git a/templates/ip.txt b/templates/ip.txt index 5df470c..e23debb 100644 --- a/templates/ip.txt +++ b/templates/ip.txt @@ -19,40 +19,40 @@ * AS Name: {{r.asn.name}} {%- endif -%} -{%- if r.location -%} +{%- if r.location %} + ## Geolocation -{{ 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 -%} +{{ 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="")) }} +{{- helper::place_dl(place=sd, label="Subdivision", iso_code_prefix=r.location.country.iso_code|default(value="")) -}} {%- endfor -%} {%- endif %} -{{ helper::place_dl(place=r.location.city, label="City") }} -{% if r.location.postal_code -%} +{{- helper::place_dl(place=r.location.city, label="City") -}} +{%- if r.location.postal_code -%} * Postal Code: {{r.location.postal_code}} -{%- endif %} -{% if r.location.time_zone -%} +{% endif %} +{%- if r.location.time_zone -%} * Timezone: {{r.location.time_zone}} {% endif -%} -{% if r.location.accuracy -%} -* Accuaracy: ~{{r.location.accuracy}}km< -{%- endif %} -{% if r.location.coordinates %} +{%- if r.location.accuracy -%} +* Accuaracy: ~{{r.location.accuracy}}km +{% endif %} +{%- if r.location.coordinates %} ### Coordinates lat: {{r.location.coordinates.lat}}, lon: {{r.location.coordinates.lon}} => {{ links::map_link(lat=r.location.coordinates.lat, lon=r.location.coordinates.lon)}} -{% endif %} +{%- endif %} The GeopIP and ASN information is provided by the GeoLite2 database created by MaxMind. - {% endif -%} {%- block extra_content %}{% endblock -%}