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
bd132d56
Verified
Commit
bd132d56
authored
Nov 24, 2019
by
Elias Ojala
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use custom resolver for DNSBL lookups
parent
e135421e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
7 deletions
+19
-7
src/app.ts
src/app.ts
+12
-1
src/controllers/ipaddr.controller.ts
src/controllers/ipaddr.controller.ts
+7
-6
No files found.
src/app.ts
View file @
bd132d56
...
...
@@ -340,4 +340,15 @@ enum DataReturnFormat {
Jsonp
=
"
jsonp
"
,
}
export
{
DataReturnFormat
};
\ No newline at end of file
export
{
DataReturnFormat
};
/**
* Resolvers to use for DNSBL lookup
*
* Related: https://github.com/silverwind/dnsbl/issues/9
*/
const
dnsblConfiguration
=
{
servers
:
[
"
10.250.11.51
"
],
};
export
{
dnsblConfiguration
};
src/controllers/ipaddr.controller.ts
View file @
bd132d56
import
{
NextFunction
,
Request
,
Response
,
Router
}
from
"
express
"
;
import
isIp
from
"
is-ip
"
;
import
{
promises
}
from
"
dns
"
;
import
{
promises
as
dnsPromises
}
from
"
dns
"
;
import
axios
from
"
axios
"
;
import
compressIp
from
"
../functions/compressIp
"
;
import
dnsbl
from
"
dnsbl
"
;
import
{
dnsblConfiguration
}
from
"
../app
"
;
const
router
:
Router
=
Router
();
...
...
@@ -24,7 +25,7 @@ router.get("/:ip", (req: Request, res: Response, next: NextFunction) => {
res
.
redirect
(
301
,
`/ip/
${
compressedIp
}
`
);
}
else
{
Promise
.
all
([
p
romises
.
reverse
(
ipAddress
).
catch
(
catcher
),
dnsP
romises
.
reverse
(
ipAddress
).
catch
(
catcher
),
axios
.
get
(
`https://api.telcodb.net/v1/bgpann?format=json&q=
${
ipAddress
}
`
).
catch
(
catcher
),
])
.
then
(
async
result
=>
{
...
...
@@ -70,8 +71,8 @@ router.get("/:ip", (req: Request, res: Response, next: NextFunction) => {
full
:
false
,
};
bogon
.
traditional
=
await
dnsbl
.
lookup
(
ipAddress
,
'
bogons.cymru.com
'
);
bogon
.
full
=
await
dnsbl
.
lookup
(
ipAddress
,
`v
${
ipVersion
}
.fullbogons.cymru.com`
);
bogon
.
traditional
=
await
dnsbl
.
lookup
(
ipAddress
,
'
bogons.cymru.com
'
,
dnsblConfiguration
);
bogon
.
full
=
await
dnsbl
.
lookup
(
ipAddress
,
`v
${
ipVersion
}
.fullbogons.cymru.com`
,
dnsblConfiguration
);
/**
* Tor relay data
...
...
@@ -88,8 +89,8 @@ router.get("/:ip", (req: Request, res: Response, next: NextFunction) => {
fingerprint
:
undefined
,
}
torRelay
.
isRelay
=
await
dnsbl
.
lookup
(
ipAddress
,
'
tor.dan.me.uk
'
);
torRelay
.
isExit
=
await
dnsbl
.
lookup
(
ipAddress
,
'
torexit.dan.me.uk
'
);
torRelay
.
isRelay
=
await
dnsbl
.
lookup
(
ipAddress
,
'
tor.dan.me.uk
'
,
dnsblConfiguration
);
torRelay
.
isExit
=
await
dnsbl
.
lookup
(
ipAddress
,
'
torexit.dan.me.uk
'
,
dnsblConfiguration
);
res
.
render
(
"
ip/show.twig
"
,
{
// "title": `${ipAddress} - ${reverse} - ${country} - ${isp} - IP address geolocation`,
...
...
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