Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
TelcoDB
Web Frontend
Commits
b633f353
Verified
Commit
b633f353
authored
Dec 05, 2019
by
Elias Ojala
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use system resolvers for DNSBL, minor improvements on /ip/
parent
ac0d5e40
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
706 additions
and
644 deletions
+706
-644
src/app.ts
src/app.ts
+8
-3
src/controllers/ipaddr.controller.ts
src/controllers/ipaddr.controller.ts
+21
-7
views/ip/show.twig
views/ip/show.twig
+11
-1
yarn.lock
yarn.lock
+666
-633
No files found.
src/app.ts
View file @
b633f353
...
...
@@ -346,13 +346,18 @@ enum DataReturnFormat {
export
{
DataReturnFormat
};
import
dns
from
"
dns
"
;
/**
*
R
esolvers
to use
for DNSBL
lookup
*
Use system r
esolvers for DNSBL
*
* Related: https://github.com/silverwind/dnsbl/issues/9
*/
const
dnsblConfiguration
=
{
servers
:
[
"
10.250.11.51
"
]
,
servers
:
dns
.
getServers
()
,
};
export
{
dnsblConfiguration
};
const
dnsblConfigurationWithTxt
=
{...
dnsblConfiguration
,
includeTxt
:
true
};
export
{
dnsblConfiguration
,
dnsblConfigurationWithTxt
};
src/controllers/ipaddr.controller.ts
View file @
b633f353
...
...
@@ -4,7 +4,7 @@ import { promises as dnsPromises } from "dns";
import
axios
from
"
axios
"
;
import
compressIp
from
"
../functions/compressIp
"
;
import
dnsbl
from
"
dnsbl
"
;
import
{
dnsblConfiguration
}
from
"
../app
"
;
import
{
dnsblConfiguration
,
dnsblConfigurationWithTxt
}
from
"
../app
"
;
import
removeBrackets
from
"
../view-functions/removeBrackets
"
;
const
router
:
Router
=
Router
();
...
...
@@ -59,21 +59,31 @@ 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)`;
interface
DnsblIncludeTxt
{
listed
:
Boolean
,
txt
:
string
[],
}
const
defaultDnsblTxt
=
{
listed
:
false
,
txt
:
[],
}
/**
* Bogons
*/
interface
BogonData
{
traditional
:
Boolean
,
full
:
Boolean
,
full
:
DnsblIncludeTxt
,
}
let
bogon
:
BogonData
=
{
traditional
:
false
,
full
:
false
,
full
:
defaultDnsblTxt
,
};
bogon
.
traditional
=
await
dnsbl
.
lookup
(
ipAddress
,
'
bogons.cymru.com
'
,
dnsblConfiguration
);
bogon
.
full
=
await
dnsbl
.
lookup
(
ipAddress
,
`v
${
ipVersion
}
.fullbogons.cymru.com`
,
dnsblConfiguration
);
bogon
.
full
=
await
dnsbl
.
lookup
(
ipAddress
,
`v
${
ipVersion
}
.fullbogons.cymru.com`
,
dnsblConfiguration
WithTxt
);
/**
* Tor relay data
...
...
@@ -81,17 +91,21 @@ router.get("/:ip", (req: Request, res: Response, next: NextFunction) => {
interface
TorRelayData
{
isRelay
:
Boolean
,
isExit
:
Boolean
,
fingerprint
:
string
|
undefined
,
fingerprint
s
:
string
|
undefined
,
}
let
torRelay
:
TorRelayData
=
{
isRelay
:
false
,
isExit
:
false
,
fingerprint
:
undefined
,
fingerprint
s
:
undefined
,
}
torRelay
.
isRelay
=
await
dnsbl
.
lookup
(
ipAddress
,
'
tor.dan.me.uk
'
,
dnsblConfiguration
);
torRelay
.
isExit
=
await
dnsbl
.
lookup
(
ipAddress
,
'
torexit.dan.me.uk
'
,
dnsblConfiguration
);
torRelay
.
isExit
=
await
dnsbl
.
lookup
(
ipAddress
,
'
torexit.dan.me.uk
'
,
dnsblConfiguration
);
if
(
torRelay
.
isRelay
)
{
// torRelay.fingerprints = await getRelayFingerprints(ipAddress);
}
res
.
render
(
"
ip/show.twig
"
,
{
// "title": `${ipAddress} - ${reverse} - ${country} - ${isp} - IP address geolocation`,
...
...
views/ip/show.twig
View file @
b633f353
...
...
@@ -40,6 +40,10 @@
</th>
<td>
{{
bogon.traditional
}}
{# {{ bogon.traditional.listed }}
{% if bogon.traditional.txt %}
(<a href="/net/{{ bogon.traditional.txt }}">{{ bogon.traditional.txt }}</a>)
{% endif %} #}
</td>
</tr>
...
...
@@ -48,7 +52,10 @@
<a
href=
"https://www.team-cymru.com/bogon-reference.html"
>
Fullbogon
</a>
</th>
<td>
{{
bogon.full
}}
{{
bogon.full.listed
}}
{%
if
bogon.full.txt
%}
(
<a
href=
"/net/
{{
bogon.full.txt
}}
"
>
{{
bogon.full.txt
}}
</a>
)
{%
endif
%}
</td>
</tr>
...
...
@@ -63,6 +70,9 @@
{%
else
%}
Non-exit
{%
endif
%}
{# {% for relay in torRelay.isRelay.txt %}
{{ relay.toString() | split("/F:")[0] }}--END<br />
{% endfor %} #}
{%
else
%}
false
{%
endif
%}
...
...
yarn.lock
View file @
b633f353
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment