30 lines
746 B
Plaintext
30 lines
746 B
Plaintext
#alias:new mdig e:dig
|
|
fn mdig [@_args]{
|
|
if (== (count $_args) 0) {
|
|
fail (styled "Veuillez saisir au moins un nom de domaine…" bold red)
|
|
}
|
|
ns = []
|
|
@hosts = $@_args
|
|
if (has-prefix $_args[0] '@') {
|
|
ns = $_args[0]
|
|
@hosts = (drop 1 $hosts)
|
|
}
|
|
if (== (count $hosts) 0) {
|
|
fail (styled "Veuillez saisir au moins un nom de domaine…" bold red)
|
|
}
|
|
for h $hosts {
|
|
@ipv4 = (e:dig $ns $h A +short)
|
|
@ipv6 = (e:dig $ns $h AAAA +short)
|
|
if (== (count $ipv4) 0) {
|
|
@ipv4 = "<unknown>"
|
|
}
|
|
if (== (count $ipv6) 0) {
|
|
@ipv6 = "<unknown>"
|
|
}
|
|
echo (styled $h bold yellow)
|
|
echo (styled 'A ' bright-red)$@ipv4
|
|
echo (styled 'AAAA ' bright-red)$@ipv6
|
|
echo "----------------------"
|
|
}
|
|
}
|