Add Tor exit and bogon status to IP address page

parent 532cd87a
......@@ -31,6 +31,7 @@ import {
ExploreController,
TldController,
TorController,
GlossaryController,
} from "./controllers";
twig.extendFunction("getenv", (name: string) => {
......@@ -185,6 +186,8 @@ app.use(lusca.xframe('DENY'));
*/
app.use("/", HomeController);
app.use("/glossary/", GlossaryController)
app.use("/explore/", ExploreController);
app.use("/tools/", ToolsController);
......
......@@ -3,6 +3,7 @@ import isIp from "is-ip";
import { promises } from "dns";
import axios from "axios";
import compressIp from "../functions/compressIp";
import dnsbl from "dnsbl";
const router: Router = Router();
......@@ -26,7 +27,7 @@ router.get("/:ip", (req: Request, res: Response, next: NextFunction) => {
promises.reverse(ipAddress).catch(catcher),
axios.get(`https://api.telcodb.net/v1/bgpann?format=json&q=${ipAddress}`).catch(catcher),
])
.then(result => {
.then(async result => {
// Override, as it cries as it may return void (see catcher)
const reverses: any = result[0]
// any type is just to avoid errors with Twig
......@@ -56,6 +57,40 @@ router.get("/:ip", (req: Request, res: Response, next: NextFunction) => {
description += `is an IPv${ipVersion} address.`;
// description += ` owned by ${ispName} and located in ${placeName} (see map)`;
/**
* Bogons
*/
interface BogonData {
traditional: Boolean,
full: Boolean,
}
let bogon: BogonData = {
traditional: false,
full: false,
};
bogon.traditional = await dnsbl.lookup(ipAddress, 'bogons.cymru.com');
bogon.full = await dnsbl.lookup(ipAddress, `v${ipVersion}.fullbogons.cymru.com`);
/**
* Tor relay data
*/
interface TorRelayData {
isRelay: Boolean,
isExit: Boolean,
fingerprint: string | undefined,
}
let torRelay: TorRelayData = {
isRelay: false,
isExit: false,
fingerprint: undefined,
}
torRelay.isRelay = await dnsbl.lookup(ipAddress, 'tor.dan.me.uk');
torRelay.isExit = await dnsbl.lookup(ipAddress, 'torexit.dan.me.uk');
res.render("ip/show.twig", {
// "title": `${ipAddress} - ${reverse} - ${country} - ${isp} - IP address geolocation`,
"title": title,
......@@ -71,6 +106,9 @@ router.get("/:ip", (req: Request, res: Response, next: NextFunction) => {
"reverses": reverses,
"announcements": announcementsData,
"bogon": bogon,
"torRelay": torRelay,
});
})
.catch(next);
......
......@@ -9,11 +9,12 @@
<p>We use the following data sources:
<h3>ASN &amp; announcement data</h3>
<h3>ASN &amp; announcement &amp; IP address data</h3>
<ul>
<li><a href="https://asrank.caida.org/">CAIDA ASRank</a></li>
<li><a href="https://peeringdb.com/">PeeringDB</a></li>
<li><a href="https://www.team-cymru.com/IP-ASN-mapping.html">Cymru IP-to-ASN mapping</a></li>
<li><a href="https://www.team-cymru.com/bogon-reference-dns.html">Cymru Bogons via DNS</a></li>
</ul>
<h3>Domain name data</h3>
......
......@@ -16,9 +16,60 @@
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active" id="ip-info" role="tabpanel" aria-labelledby="ip-info-tab">
<h2>General information</h2>
<ul class="pl-3">
<li>Type: <a href="https://en.wikipedia.org/wiki/IPv{{ version }}">IPv{{ version }}</a></li>
</ul>
<table class="table w-auto table-bordered table-striped">
{# <thead>
<tr>
<th scope="col">x</th>
<th scope="col">y</th>
</tr>
</thead> #}
<tbody>
<tr>
<th scope="row">
IP version
</th>
<td>
<a href="https://en.wikipedia.org/wiki/IPv{{ version }}">IPv{{ version }}</a>
</td>
</tr>
<tr>
<th scope="row">
<a href="https://www.team-cymru.com/bogon-reference.html">Bogon</a>
</th>
<td>
{{ bogon.traditional }}
</td>
</tr>
<tr>
<th scope="row">
<a href="https://www.team-cymru.com/bogon-reference.html">Fullbogon</a>
</th>
<td>
{{ bogon.full }}
</td>
</tr>
<tr>
<th scope="row">
Tor relay
</th>
<td>
{% if torRelay.isRelay %}
{% if torRelay.isExit %}
Exit
{% else %}
Non-exit
{% endif %}
{% else %}
false
{% endif %}
</td>
</tr>
</tbody>
</table>
{% if reverses %}
<h2>Reverse records</h2>
......
......@@ -1551,6 +1551,14 @@ 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:
version "3.1.1"
resolved "https://registry.yarnpkg.com/dnsbl/-/dnsbl-3.1.1.tgz#e5fc82152e2572aff18bd06687a7cbd078d057af"
integrity sha512-5jZxhy11WG/xw2U/ax9b7Yn1FR9iZqDHwGukyPOTxM4Zxhi8J9ov/ZwxwWC99gNK30k/U1MRENPpv7LXCqMk4A==
dependencies:
ip-ptr "^2.0.0"
p-map "^2.0.0"
domain-name-regex@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/domain-name-regex/-/domain-name-regex-2.0.0.tgz#c3004aedd24d4f2a0b230d89ed010e2e7aec1535"
......@@ -2087,6 +2095,13 @@ ip-cidr@^2.0.6:
ip-address "^5.9.4"
jsbn "^0.1.0"
ip-ptr@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ip-ptr/-/ip-ptr-2.0.0.tgz#a8a46acb74b01e7c1407d650c74a8a28b6f852d9"
integrity sha512-0jHCnK8ZviCgi17fKHhixr4a1JPG66Dwf95IuBM2Fj6G7EYdf54Kc0NU8yw8Y8kGrz3OV0uG0rffXEbysmP1yQ==
dependencies:
ipaddr.js "^1.7.0"
ip-regex@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/ip-regex/-/ip-regex-2.1.0.tgz#fa78bf5d2e6913c911ce9f819ee5146bb6d844e9"
......@@ -2102,6 +2117,11 @@ 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.7.0:
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==
is-accessor-descriptor@^0.1.6:
version "0.1.6"
resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6"
......@@ -2881,6 +2901,11 @@ p-finally@^1.0.0:
resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae"
integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=
p-map@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/p-map/-/p-map-2.1.0.tgz#310928feef9c9ecc65b68b17693018a665cea175"
integrity sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw==
package-json@^4.0.0:
version "4.0.1"
resolved "https://registry.yarnpkg.com/package-json/-/package-json-4.0.1.tgz#8869a0401253661c4c4ca3da6c2121ed555f5eed"
......
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