Commit 00512fe7 authored by Elias Ojala's avatar Elias Ojala

Check HSTS preloading on DNS page

parent d06f96ca
......@@ -6,6 +6,8 @@ import getIpInfo from "../functions/getIpInfo";
import isIp from "is-ip";
import isIdn from "../functions/isIdn";
import punycode from "punycode";
import dnsbl from "dnsbl";
import { dnsblConfiguration } from "../app";
const router: Router = Router();
......@@ -44,7 +46,7 @@ router.get("/:domain", (req: Request, res: Response, next: NextFunction) => {
getIpInfo(response.data).catch(catcher)
])
.then(x => x[0])
.then(ipInfo => {
.then(async ipInfo => {
// Nullify IP info if undefined
if(ipInfo[0] == undefined) {
ipInfo = null;
......@@ -52,6 +54,8 @@ router.get("/:domain", (req: Request, res: Response, next: NextFunction) => {
const unicodeDomain = punycode.toUnicode(asciiDomain);
const hstsPreload = await dnsbl.lookup(asciiDomain, 'chromium.hstspreload.lelux.fi', dnsblConfiguration);
res.render("dns/show.twig", {
"title": `${unicodeDomain} - DNS data`,
"disable_title_prefix": true,
......@@ -63,6 +67,8 @@ router.get("/:domain", (req: Request, res: Response, next: NextFunction) => {
"data": response.data,
"hstsPreload": hstsPreload,
"ipInfo": ipInfo,
});
});
......
......@@ -7,6 +7,18 @@
<p>Punycode: <code>{{ asciiDomain }}</code></p>
{% endif %}
{# Badges #}
{% if hstsPreload %}
<span class="badge badge-success">
<i class="fab fa-chrome"></i> HSTS preloaded
</span>
{% else %}
<span class="badge badge-danger">
<i class="fab fa-chrome"></i> Not HSTS preloaded
</span>
{% endif %}
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" role="tab"
......
......@@ -48,7 +48,7 @@
{# CSS #}
<link rel="stylesheet" href="/assets/libs/bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet" href="/assets/css/main.css" />
{# <link rel="stylesheet" href="/assets/libs/fontawesome-free/css/all.min.css" /> #}
<link rel="stylesheet" href="/assets/libs/fontawesome-free/css/all.min.css" />
{# <link rel="stylesheet" href="/assets/libs/fontawesome-free/css/brands.min.css" />
<link rel="stylesheet" href="/assets/libs/fontawesome-free/css/fontawesome.min.css" /> #}
......
......@@ -1616,12 +1616,12 @@ diff@^4.0.1:
resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.1.tgz#0c667cb467ebbb5cea7f14f135cc2dba7780a8ff"
integrity sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q==
dnsbl@^3.1.1:
"dnsbl@https://github.com/theel0ja/dnsbl/archive/uribl.tar.gz":
version "3.2.0"
resolved "https://registry.yarnpkg.com/dnsbl/-/dnsbl-3.2.0.tgz#bd5c1bb066b84b5bb2dc7171e88eedcfb03e5273"
integrity sha512-Fv0ExY6F0cZeVD9JWhApFedUny220lJdEFSvwG0vh/SjLr8QL/V4MgW7vHk1cnLjv8UX2kxOabJVIKKTstPPYA==
resolved "https://github.com/theel0ja/dnsbl/archive/uribl.tar.gz#c4b7e75960e991416cdd623bbf360856ae1946a6"
dependencies:
ip-ptr "^3.0.0"
ipaddr.js "^1.9.1"
p-map "^3.0.0"
domain-name-regex@^2.0.0:
......@@ -2204,7 +2204,7 @@ ipaddr.js@1.9.0:
resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.0.tgz#37df74e430a0e47550fe54a2defe30d8acd95f65"
integrity sha512-M4Sjn6N/+O6/IXSJseKqHoFc+5FdGJ22sXqnjTpdZweHK64MzEPAyQZyEU3R/KRv2GLoa7nNtg/C2Ev6m7z+eA==
ipaddr.js@^1.8.1:
ipaddr.js@^1.8.1, ipaddr.js@^1.9.1:
version "1.9.1"
resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3"
integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment