2020-07-22 09:24:43 +00:00
|
|
|
#alias:new digall e:dig ANY +noall +answer
|
|
|
|
fn digall [@_args]{
|
|
|
|
use moi/util/list
|
|
|
|
use str
|
|
|
|
|
|
|
|
local:default_records = [
|
|
|
|
A
|
|
|
|
AAAA
|
|
|
|
CNAME
|
|
|
|
PTR
|
|
|
|
TXT
|
|
|
|
MX
|
|
|
|
SRV
|
|
|
|
NAPTR
|
|
|
|
NS
|
|
|
|
SOA
|
|
|
|
]
|
|
|
|
local:records = []
|
|
|
|
local:servers = []
|
|
|
|
local:flags = [
|
|
|
|
+noall
|
|
|
|
+answer
|
|
|
|
]
|
|
|
|
local:domains = []
|
2020-07-22 10:41:38 +00:00
|
|
|
local:use_dig = $true
|
2020-07-22 09:24:43 +00:00
|
|
|
|
|
|
|
fn init []{
|
2020-07-22 10:41:38 +00:00
|
|
|
if (and (> (count $_args) 0) (is $_args[0] -d)) {
|
|
|
|
use_dig = $false
|
|
|
|
_args = $_args[1:]
|
|
|
|
}
|
2020-07-22 09:24:43 +00:00
|
|
|
each [e]{
|
|
|
|
if (is $e[0] '+') {
|
|
|
|
flags = [ (all $flags) $e ]
|
|
|
|
} elif (is $e[0] @) {
|
|
|
|
servers = [ (all $servers) $e ]
|
|
|
|
} elif (list:includes $e $default_records) {
|
|
|
|
records = [ (all $records) $e ]
|
|
|
|
} else {
|
|
|
|
domains = [ (all $domains) $e ]
|
|
|
|
}
|
|
|
|
} $_args
|
|
|
|
if (== (count $records) 0) {
|
|
|
|
records = $default_records
|
|
|
|
}
|
|
|
|
}
|
2020-07-22 10:41:38 +00:00
|
|
|
|
|
|
|
fn drillr [d @args]{
|
|
|
|
local:results = [ (peach [r]{
|
|
|
|
e:drill $@args $r $d | list:filter [e]{
|
|
|
|
and (> (count $e) 2) (not (is $e[:2] ';;'))
|
|
|
|
}
|
|
|
|
} $records | list:remove-duplicate) ]
|
|
|
|
echo (str:join "\n" $results)
|
|
|
|
}
|
2020-07-22 09:24:43 +00:00
|
|
|
|
|
|
|
fn digr [d @args]{
|
2020-07-22 10:41:38 +00:00
|
|
|
local:results = [ (peach [r]{
|
2020-07-22 09:24:43 +00:00
|
|
|
e:dig $@args $r $d $@flags
|
2020-07-22 10:41:38 +00:00
|
|
|
} $records | list:remove-duplicate) ]
|
2020-07-22 09:24:43 +00:00
|
|
|
echo (str:join "\n" $results)
|
|
|
|
}
|
2020-07-22 10:41:38 +00:00
|
|
|
|
|
|
|
fn req [d @args]{
|
|
|
|
if $use_dig {
|
|
|
|
digr $d $@args
|
|
|
|
} else {
|
|
|
|
drillr $d $@args
|
|
|
|
}
|
|
|
|
}
|
2020-07-22 09:24:43 +00:00
|
|
|
|
|
|
|
fn digs [s d]{
|
|
|
|
echo (styled $s bright-yellow)
|
2020-07-22 10:41:38 +00:00
|
|
|
req $d $s
|
2020-07-22 09:24:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn digd [d]{
|
|
|
|
echo (styled 'Domaine: '$d bright-green)
|
|
|
|
if (> (count $servers) 0) {
|
|
|
|
each [s]{
|
|
|
|
digs $s $d
|
|
|
|
} $servers
|
|
|
|
} else {
|
2020-07-22 10:41:38 +00:00
|
|
|
req $d
|
2020-07-22 09:24:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
init
|
|
|
|
each $digd~ $domains
|
|
|
|
}
|