edit:add-var digall~ {|@argv| use moi/util/list use moi/util/strutil use str var default_records = [ A AAAA CNAME PTR TXT MX SRV NAPTR NS SOA ] var cols = [ [&min=24] [&min=8] [&min=10] ] var records servers = [] [] var flags = [ +noall +answer ] var domains use_dig = [] $true fn init {|| if (and (> (count $argv) 0) (is $argv[0] -d)) { set use_dig = $false set argv = $argv[1:] } each {|e| if (is $e[0] '+') { set flags = [ (all $flags) $e ] } elif (is $e[0] @) { set servers = [ (all $servers) $e ] } elif (list:includes $e $default_records) { set records = [ (all $records) $e ] } else { set domains = [ (all $domains) $e ] } } $argv if (== (count $records) 0) { set records = $default_records } } fn format {|results| eawk {|_ @args| put [ $args[0] (all $args[2..]) ] } $results | list:remove-duplicate | list:sort {|l1 l2| var c = (str:compare $l1[0] $l2[0]) if (== $c 0) { set c = (str:compare $l1[2] $l2[2]) } } | strutil:format &col=$cols | str:join "\n" } fn drillr {|d @args| var results = [ (peach {|r| e:drill $@args $r $d | list:filter {|e| and (> (count $e) 2) (not (is $e[:2] ';;')) } } $records) ] format $results } fn digr {|d @args| var results = [ (peach {|r| e:dig $@args $r $d $@flags } $records) ] format $results } fn req {|d @args| if $use_dig { digr $d $@args } else { drillr $d $@args } } fn digs {|s d| put (echo (styled $s bright-yellow)) req $d $s } fn digd {|d| var results = [ (echo (styled 'Domaine: '$d bright-green)) ] if (> (count $servers) 0) { each {|s| set @results = $@results (digs $s $d) } $servers } else { set @results = $@results (req $d) } echo (str:join "\n" $results) } init peach $digd~ $domains }