Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dnslg
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
CentralNic
dnslg
Commits
938d6cc8
Commit
938d6cc8
authored
Mar 31, 2015
by
Gavin Brown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added
parents
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
163 additions
and
0 deletions
+163
-0
README.md
README.md
+47
-0
dnslg
dnslg
+116
-0
No files found.
README.md
0 → 100644
View file @
938d6cc8
# NAME
dnslg - A command line interface to the dns-lg DNS Looking Glass service.
# USAGE
dnslg OPTIONS | [QNAME [QTYPE]]
# ARGUMENTS
-
--help
Display this help message
-
QNAME
Fully-qualified domain name to query. Defaults to EXAMPLE.COM
-
QTYPE
Query type. Defaults to A.
# OUTPUT
For each available node,
`dnslg`
will output the response received in presentation format. Example:
$ dnslg xyz SOA
Response from ch01 (Swiss Privacy Foundation, Switzerland, AS13030):
xyz. 3185 IN SOA ns0.centralnic.net. hostmaster.centralnic.net. 3000170814 900 1800 6048000 3600
Response from ch02 (Swiss Privacy Foundation, Switzerland, AS13030):
xyz. 3186 IN SOA ns0.centralnic.net. hostmaster.centralnic.net. 3000170814 900 1800 6048000 3600
# LICENSE
This program is Free Software; you can use it and/or modify it under the same terms as Perl itself.
# COPYRIGHT
Copyright 2015 CentralNic Group plc.
# SEE ALSO
-
[
http://www.dns-lg.com
](
http://www.dns-lg.com
)
-
[
https://www.centralnic.com
](
https://www.centralnic.com
)
dnslg
0 → 100755
View file @
938d6cc8
#!/usr/bin/perl
use
LWP::
Simple
;
use
JSON
;
use
strict
;
use
File::
Basename
qw(basename)
;
use
File::
Slurp
;
use
Term::
ANSIColor
qw(:constants)
;
use
Pod::
Usage
;
use
Getopt::
Long
;
my
$help
;
GetOptions
('
help
'
=>
$help
);
pod2usage
(
1
)
if
(
$help
);
my
$qname
=
shift
||
'
example.com
';
my
$qtype
=
shift
||
'
A
';
my
$base
=
'
http://www.dns-lg.com
';
my
$url
=
$base
.
'
/nodes.json
';
my
$file
=
$ENV
{'
HOME
'}
.
'
/.
'
.
basename
(
$url
);
my
$result
=
mirror
(
$url
,
$file
);
if
(
$result
>
399
)
{
printf
("
%sError: got %d status when retrieving %s%s
\n
",
BOLD
.
RED
,
$result
,
$url
);
exit
(
1
);
}
undef
$/
;
open
(
NODES
,
$file
);
my
$nodes
=
from_json
(
<
NODES
>
);
close
(
NODES
);
foreach
my
$node
(
@
{
$nodes
->
{'
nodes
'}})
{
my
$json
=
get
(
sprintf
('
%s/%s/%s/%s
',
$base
,
$node
->
{'
name
'},
$qname
,
$qtype
));
if
(
!
$json
)
{
printf
("
%sNo response from %s (%s, %s, %s)%s
\n\n
",
BOLD
.
RED
,
$node
->
{'
name
'},
$node
->
{'
operator
'},
$node
->
{'
country
'},
$node
->
{'
asn
'},
RESET
);
}
else
{
my
$data
=
from_json
(
$json
);
printf
("
%sResponse from %s (%s, %s, %s):
\n\n
%s
",
BOLD
.
GREEN
,
$node
->
{'
name
'},
$node
->
{'
operator
'},
$node
->
{'
country
'},
$node
->
{'
asn
'},
RESET
);
foreach
my
$rr
(
@
{
$data
->
{'
answer
'}})
{
printf
(
"
%s %u %s %s %s
\n
",
$rr
->
{'
name
'},
$rr
->
{'
ttl
'},
$rr
->
{'
class
'},
$rr
->
{'
type
'},
$rr
->
{'
rdata
'},
)
}
print
"
\n
";
}
}
=pod
=head1 NAME
dnslg - A command line interface to the dns-lg DNS Looking Glass service.
=head1 USAGE
dnslg OPTIONS | [QNAME [QTYPE]]
=head1 ARGUMENTS
=over
=item --help
Display this help message
=item QNAME
Fully-qualified domain name to query. Defaults to EXAMPLE.COM
=item QTYPE
Query type. Defaults to A.
=back
=head1 OUTPUT
For each available node, C<dnslg> will output the response received in presentation format. Example:
$ dnslg xyz SOA
Response from ch01 (Swiss Privacy Foundation, Switzerland, AS13030):
xyz. 3185 IN SOA ns0.centralnic.net. hostmaster.centralnic.net. 3000170814 900 1800 6048000 3600
Response from ch02 (Swiss Privacy Foundation, Switzerland, AS13030):
xyz. 3186 IN SOA ns0.centralnic.net. hostmaster.centralnic.net. 3000170814 900 1800 6048000 3600
=head1 LICENSE
This program is Free Software; you can use it and/or modify it under the same terms as Perl itself.
=head1 COPYRIGHT
Copyright 2015 CentralNic Group plc.
=head1 SEE ALSO
=over
=item L<http://www.dns-lg.com>
=item L<https://www.centralnic.com>
=back
=cut
\ No newline at end of file
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