Re: Digging to the final IP

2014-10-24 Thread John Wobus

On Oct 21, 2014, at 4:00 PM, Evan Hunt wrote:

On Tue, Oct 21, 2014 at 12:07:15PM -0700, Warren Kumari wrote:

dig A $name | awk '$0 ~ /status/  $0 !~ /status: NOERROR,/ {
   sub(,, , $6 ); print $6; x=1
  }
  $4 == A { print $5; x=1 }
  END { if (!x) print TIMEOUT }'



Because, not everyone is as stunningly brilliant as you?

To a non-zero population of this list the above looks like line- 
noise...


Could be worse, could be perl...


But if perl were acceptable,

perl -e 'printf %vd\n, (gethostbyname example.com)[4]'

John
___
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users


Re: Digging to the final IP

2014-10-24 Thread Doug Barton
It's interesting to see the discussion about trying to turn dig into 
something it isn't. :)  It's a really good DNS diagnostic tool, but if 
you just want to get the answer for a query, host does the job quite 
well, with a lot less fuss.


Doug

___
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users


Re: Digging to the final IP

2014-10-24 Thread Doug Barton

On 10/21/14 8:31 PM, Frank Bulk wrote:

Dave,

Thanks for the input, but what I was looking for was a dig command that
returns the IP(s) or a fail.  It looks like the host command is the right
solution in this case, not dig.


Yep. :)

You can check the return value of the call to get your fail as well. For 
example:


$ host ajklasdfjklasd.com ; echo $?
Host ajklasdfjklasd.com not found: 3(NXDOMAIN)
1

hth,

Doug

___
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users


Re: Digging to the final IP

2014-10-23 Thread Bob Harold
Anytime you see 'grep' and 'cut' used together, they can usually be
shortened to just 'awk', which requires starting one less process.  And if
this case it splits fields the way a users sees them, so the same code
works in both cases:

$ dig +noall +answer home.kreme.com in a | awk '/[\t ]A[\t ]/ {print $NF}'
23.24.150.141
$ dig +noall +answer  dave.knig.ht in a | awk '/[\t ]A[\t ]/ {print $NF}'
216.235.14.46



-- 
Bob Harold
hostmaster, UMnet, ITcom
Information and Technology Services (ITS)
rharo...@umich.edu
734-647-6524 desk

On Wed, Oct 22, 2014 at 6:58 PM, LuKreme krem...@kreme.com wrote:


  On 21 Oct 2014, at 22:46 , Jim Young jyo...@gsu.edu wrote:
 
  On 10/22/14 12:08 AM, LuKreme krem...@kreme.com wrote:
 
  On 21 Oct 2014, at 19:20 , Dave Knight d...@knig.ht wrote:
 
  $ dig +noall +answer dave.knig.ht in a | egrep 'IN\tA\t' | cut -f6
  216.235.14.46
 
  Interesting. This works for me:
 
  dig +noall +answer home.kreme.com in a | egrep '\tA' | cut -f5
 
  but on your example, it requires -f6
 
  And yet, the outputs appear to have the same number of fields.
 
  $ dig +noall +answer www.kreme.com in a
  www.kreme.com.   21139   IN  CNAME   cerebus.kreme.com.
  cerebus.kreme.com.   21141   IN  A   23.24.150.141
  $ dig +noall +answer dave.knig.ht in a
  dave.knig.ht.13916   IN  CNAME   sb.sanxion.org.
  sb.sanxion.org.  222 IN  A   216.235.14.46
 
  Very odd.
 
  Subtle formatting difference for human consumption.  There are a variable
  number of ASCII TABs inserted to visually align fields.

 Yeah, I saw the extra space after 222, but did not check for a second tab
 following sb.sanxion.org.

  This is where output generated for human consumption can be tricky to
  parse.

 That’s why I like dig +short


 --
 BART BUCKS ARE NOT LEGAL TENDER Bart chalkboard Ep. 8F06

 ___
 Please visit https://lists.isc.org/mailman/listinfo/bind-users to
 unsubscribe from this list

 bind-users mailing list
 bind-users@lists.isc.org
 https://lists.isc.org/mailman/listinfo/bind-users
___
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users

Re: Digging to the final IP

2014-10-23 Thread Sam Wilson
In article mailman.1128.1414072988.26362.bind-us...@lists.isc.org,
 Bob Harold rharo...@umich.edu wrote:

 Anytime you see 'grep' and 'cut' used together, they can usually be
 shortened to just 'awk', which requires starting one less process.  And if
 this case it splits fields the way a users sees them, so the same code
 works in both cases:
 
 $ dig +noall +answer home.kreme.com in a | awk '/[\t ]A[\t ]/ {print $NF}'
 23.24.150.141
 $ dig +noall +answer  dave.knig.ht in a | awk '/[\t ]A[\t ]/ {print $NF}'
 216.235.14.46

$ dig +noall +answer cancer.ucs.ed.ac.uk | perl -ne ' /\sA\s/  do { 
@_=split; print $_[$#_]\n }' 
129.215.166.13
129.215.200.7

Sam

-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
___
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users


Re: Digging to the final IP

2014-10-23 Thread Niall O'Reilly
At Thu, 23 Oct 2014 15:17:49 +0100,
Sam Wilson wrote:
 
 In article mailman.1128.1414072988.26362.bind-us...@lists.isc.org,
  Bob Harold rharo...@umich.edu wrote:
 
  Anytime you see 'grep' and 'cut' used together, they can usually be
  shortened to just 'awk', which requires starting one less process.  And if
  this case it splits fields the way a users sees them, so the same code
  works in both cases:
  
  $ dig +noall +answer home.kreme.com in a | awk '/[\t ]A[\t ]/ {print $NF}'
  23.24.150.141
  $ dig +noall +answer  dave.knig.ht in a | awk '/[\t ]A[\t ]/ {print $NF}'
  216.235.14.46
 
 $ dig +noall +answer cancer.ucs.ed.ac.uk | perl -ne ' /\sA\s/  do { 
 @_=split; print $_[$#_]\n }' 
 129.215.166.13
 129.215.200.7

  Which makes it easy, in either case, to return a status value, as
  Frank Bulk seemed to want.

  Something like

  '... {print $NF; count++} END {exit ! count}'

  or

  | perl -ane ' /\sA\s/  do { print $F[$#F]\n; $count++ } END
{exit ! $count }'

  might work.

  Niall
  
___
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users


Re: Digging to the final IP

2014-10-23 Thread Niall O'Reilly
At Thu, 23 Oct 2014 15:17:49 +0100,
Sam Wilson wrote:
 
 In article mailman.1128.1414072988.26362.bind-us...@lists.isc.org,
  Bob Harold rharo...@umich.edu wrote:
 
  Anytime you see 'grep' and 'cut' used together, they can usually be
  shortened to just 'awk', which requires starting one less process.  And if
  this case it splits fields the way a users sees them, so the same code
  works in both cases:
  
  $ dig +noall +answer home.kreme.com in a | awk '/[\t ]A[\t ]/ {print $NF}'
  23.24.150.141
  $ dig +noall +answer  dave.knig.ht in a | awk '/[\t ]A[\t ]/ {print $NF}'
  216.235.14.46
 
 $ dig +noall +answer cancer.ucs.ed.ac.uk | perl -ne ' /\sA\s/  do { 
 @_=split; print $_[$#_]\n }' 
 129.215.166.13
 129.215.200.7

  Which makes it easy, in either case, to return a status value, as
  Frank Bulk seemed to want.

  Something like

  '... {print $NF; count++} END {exit ! count}'

  or

  | perl -ane ' /\sA\s/  do { print $F[$#F]\n; $count++ } END
{exit ! $count }'

  might work.

  Niall
___
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users


Re: Digging to the final IP

2014-10-22 Thread Niall O'Reilly
At Tue, 21 Oct 2014 22:31:28 -0500,
Frank Bulk wrote:
 
 Dave,
 
 Thanks for the input, but what I was looking for was a dig command that
 returns the IP(s) or a fail.  It looks like the host command is the right
 solution in this case, not dig.

  Doesn't egrep fail on no match?
  Niall
  
___
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users


Re: Digging to the final IP

2014-10-22 Thread Dave Knight

On Oct 22, 2014, at 5:56, Niall O'Reilly niall.orei...@ucd.ie wrote:

 At Tue, 21 Oct 2014 22:31:28 -0500,
 Frank Bulk wrote:
 
 Dave,
 
 Thanks for the input, but what I was looking for was a dig command that
 returns the IP(s) or a fail.  It looks like the host command is the right
 solution in this case, not dig.
 
  Doesn't egrep fail on no match?

It does, but the cut at the end of the pipeline swallows it’s exit status

We can still get that though…

$ dig +noall +answer dave.knig.ht in a | egrep 'IN\tA\t' | cut -f6
216.235.14.46

$ echo ${PIPESTATUS[1]}
0

$ dig +noall +answer hopefully.this.does.not.exist in a | egrep 'IN\tA\t' | cut 
-f6

$ echo ${PIPESTATUS[1]}
1


That is if you’re using bash of course…

dave


signature.asc
Description: Message signed with OpenPGP using GPGMail
___
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users

Re: Digging to the final IP

2014-10-22 Thread LuKreme

 On 21 Oct 2014, at 22:46 , Jim Young jyo...@gsu.edu wrote:
 
 On 10/22/14 12:08 AM, LuKreme krem...@kreme.com wrote:
 
 On 21 Oct 2014, at 19:20 , Dave Knight d...@knig.ht wrote:
 
 $ dig +noall +answer dave.knig.ht in a | egrep 'IN\tA\t' | cut -f6
 216.235.14.46
 
 Interesting. This works for me:
 
 dig +noall +answer home.kreme.com in a | egrep '\tA' | cut -f5
 
 but on your example, it requires -f6
 
 And yet, the outputs appear to have the same number of fields.
 
 $ dig +noall +answer www.kreme.com in a
 www.kreme.com.   21139   IN  CNAME   cerebus.kreme.com.
 cerebus.kreme.com.   21141   IN  A   23.24.150.141
 $ dig +noall +answer dave.knig.ht in a
 dave.knig.ht.13916   IN  CNAME   sb.sanxion.org.
 sb.sanxion.org.  222 IN  A   216.235.14.46
 
 Very odd.
 
 Subtle formatting difference for human consumption.  There are a variable
 number of ASCII TABs inserted to visually align fields.

Yeah, I saw the extra space after 222, but did not check for a second tab 
following sb.sanxion.org.

 This is where output generated for human consumption can be tricky to
 parse.

That’s why I like dig +short


-- 
BART BUCKS ARE NOT LEGAL TENDER Bart chalkboard Ep. 8F06

___
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users

Re: Digging to the final IP

2014-10-21 Thread Warren Kumari
On Mon, Oct 20, 2014 at 1:19 PM, Mark Andrews ma...@isc.org wrote:

 Why do we need to have a option to dig to massage the results into
 every possible different form?

 dig A $name | awk '$0 ~ /status/  $0 !~ /status: NOERROR,/ {
 sub(,, , $6 ); print $6; x=1
}
$4 == A { print $5; x=1 }
END { if (!x) print TIMEOUT }'


Because, not everyone is as stunningly brilliant as you?

To a non-zero population of this list the above looks like line-noise...

W


 Mark


 In message 54451077.8030...@imperial.ac.uk, Phil Mayers writes:
 On 20/10/14 14:22, Frank Bulk (iname.com) wrote:
  We=92re using this in a bash shell script.  I don=92t think there=92s a n=
 ative
  shell command to get the IP, so I=92ll use a mixture of host and dig as
  necessary.

 If your system has it, try getent e.g.

 getent ahosts hostname
 ___
 Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscri=
 be from this list

 bind-users mailing list
 bind-users@lists.isc.org
 https://lists.isc.org/mailman/listinfo/bind-users
 --
 Mark Andrews, ISC
 1 Seymour St., Dundas Valley, NSW 2117, Australia
 PHONE: +61 2 9871 4742 INTERNET: ma...@isc.org
 ___
 Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
 from this list

 bind-users mailing list
 bind-users@lists.isc.org
 https://lists.isc.org/mailman/listinfo/bind-users



-- 
I don't think the execution is relevant when it was obviously a bad
idea in the first place.
This is like putting rabid weasels in your pants, and later expressing
regret at having chosen those particular rabid weasels and that pair
of pants.
   ---maf
___
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users


Re: Digging to the final IP

2014-10-21 Thread Evan Hunt
On Tue, Oct 21, 2014 at 12:07:15PM -0700, Warren Kumari wrote:
  dig A $name | awk '$0 ~ /status/  $0 !~ /status: NOERROR,/ {
  sub(,, , $6 ); print $6; x=1
 }
 $4 == A { print $5; x=1 }
 END { if (!x) print TIMEOUT }'
 
 
 Because, not everyone is as stunningly brilliant as you?
 
 To a non-zero population of this list the above looks like line-noise...

Could be worse, could be perl.  In any case, filtering the existing
output does seem better than adding every imaginable formatting option
to dig.

... I *could* maybe see adding a formatting option to produce an
easier-to-parse output header, though, such as:

; OPCODE=QUERY
; RCODE=NOERROR
; QRFLAG=1
; AAFLAG=0
; TCFLAG=0
; RDFLAG=1
; RAFLAG=1
; ADFLAG=0
; CDFLAG=0
[... etc ...]

-- 
Evan Hunt -- e...@isc.org
Internet Systems Consortium, Inc.
___
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users


RE: Digging to the final IP

2014-10-21 Thread Darcy Kevin (FCA)
We have people on this list who are incapable of programming simple text 
extraction in *at*least*one*language*? Really?

No-one said a _scripting_ language had to be used. Feel free to use C (with 
sharp or plusplus, if you wish), or Pascal, or Smalltalk, or LISP, or 
Fortran, or S/370 Assembler. Whatever floats your boat. Whatever doesn't look 
like line-noise to you, nor has a requirement of stunning brilliance to 
use. Feel free to format it in pretty ways (if the language allows you to do 
that) and/or comment it liberally.

(Personally, I'd probably use Perl with the Net::DNS module, but that's only 
because I've written about a million of those scripts and so wouldn't have to 
think too hard about it).


- Kevin

-Original Message-
From: bind-users-boun...@lists.isc.org 
[mailto:bind-users-boun...@lists.isc.org] On Behalf Of Warren Kumari
Sent: Tuesday, October 21, 2014 3:07 PM
To: Mark Andrews
Cc: bind-us...@isc.org
Subject: Re: Digging to the final IP

On Mon, Oct 20, 2014 at 1:19 PM, Mark Andrews ma...@isc.org wrote:

 Why do we need to have a option to dig to massage the results into 
 every possible different form?

 dig A $name | awk '$0 ~ /status/  $0 !~ /status: NOERROR,/ {
 sub(,, , $6 ); print $6; x=1
}
$4 == A { print $5; x=1 }
END { if (!x) print TIMEOUT }'


Because, not everyone is as stunningly brilliant as you?

To a non-zero population of this list the above looks like line-noise...

W


 Mark


 In message 54451077.8030...@imperial.ac.uk, Phil Mayers writes:
 On 20/10/14 14:22, Frank Bulk (iname.com) wrote:
  We=92re using this in a bash shell script.  I don=92t think 
  there=92s a n=
 ative
  shell command to get the IP, so I=92ll use a mixture of host and 
  dig as necessary.

 If your system has it, try getent e.g.

 getent ahosts hostname
 ___
 Please visit https://lists.isc.org/mailman/listinfo/bind-users to 
 unsubscri= be from this list

 bind-users mailing list
 bind-users@lists.isc.org
 https://lists.isc.org/mailman/listinfo/bind-users
 --
 Mark Andrews, ISC
 1 Seymour St., Dundas Valley, NSW 2117, Australia
 PHONE: +61 2 9871 4742 INTERNET: ma...@isc.org
 ___
 Please visit https://lists.isc.org/mailman/listinfo/bind-users to 
 unsubscribe from this list

 bind-users mailing list
 bind-users@lists.isc.org
 https://lists.isc.org/mailman/listinfo/bind-users



--
I don't think the execution is relevant when it was obviously a bad idea in the 
first place.
This is like putting rabid weasels in your pants, and later expressing regret 
at having chosen those particular rabid weasels and that pair of pants.
   ---maf
___
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users
___
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users


Re: Digging to the final IP

2014-10-21 Thread Dave Knight

On Oct 19, 2014, at 1:26, Frank Bulk frnk...@iname.com wrote:

 Is there a dig option that will list out the final (IPs) or query result??
 By default, even with +short, it can list intermediate CNAME(s) and not what
 IP(s) that CNAME may have.  
 
 For example, 
   root@nagios:/tmp# dig mail.automatedwastesystems.net +short
   mail3.sandhills.com.
   root@nagios:/tmp#
 
 I'd rather know that mail3.sandhills.com is NXDOMAIN.
 
 Regards,
 
 Frank


How about… 

$ dig +noall +answer mail.automatedwastesystems.net in a | egrep 'IN\tA\t' | 
cut -f6

which correctly returns nothing in this case, but when there’s a CNAME chain 
ending in addresses it returns them

$ dig +noall +answer dave.knig.ht in a | egrep 'IN\tA\t' | cut -f6
216.235.14.46

and surely you want IPv6 support…

$ dig +noall +answer dave.knig.ht in a dave.knig.ht in  | egrep 
'IN\t(A|)\t' | cut -f6
216.235.14.46
2001:4900:1:393::2

dave


signature.asc
Description: Message signed with OpenPGP using GPGMail
___
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users

Re: Digging to the final IP

2014-10-21 Thread Novosielski, Ryan


 *Note: UMDNJ is now Rutgers-Biomedical and Health Sciences*
|| \\UTGERS  |-*O*-
||_// Biomedical | Ryan Novosielski - Senior Technologist
|| \\ and Health | novos...@rutgers.edumailto:novos...@rutgers.edu- 
973/972.0922 (2x0922)
||  \\  Sciences | OIRT/High Perf  Res Comp - MSB C630, Newark
`'

On Oct 21, 2014, at 16:00, Evan Hunt e...@isc.orgmailto:e...@isc.org wrote:

On Tue, Oct 21, 2014 at 12:07:15PM -0700, Warren Kumari wrote:
dig A $name | awk '$0 ~ /status/  $0 !~ /status: NOERROR,/ {
   sub(,, , $6 ); print $6; x=1
  }
  $4 == A { print $5; x=1 }
  END { if (!x) print TIMEOUT }'


Because, not everyone is as stunningly brilliant as you?

To a non-zero population of this list the above looks like line-noise...

Could be worse, could be perl.  In any case, filtering the existing
output does seem better than adding every imaginable formatting option
to dig.

... I *could* maybe see adding a formatting option to produce an
easier-to-parse output header, though, such as:

   ; OPCODE=QUERY
   ; RCODE=NOERROR
   ; QRFLAG=1
   ; AAFLAG=0
   ; TCFLAG=0
   ; RDFLAG=1
   ; RAFLAG=1
   ; ADFLAG=0
   ; CDFLAG=0
   [... etc ...]

While on some level, I'm with you, IP only doesn't seem like a corner case.
___
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users

RE: Digging to the final IP

2014-10-21 Thread Frank Bulk
Dave,

Thanks for the input, but what I was looking for was a dig command that
returns the IP(s) or a fail.  It looks like the host command is the right
solution in this case, not dig.

Kind regards,

Frank

-Original Message-
From: Dave Knight [mailto:d...@knig.ht] 
Sent: Tuesday, October 21, 2014 8:21 PM
To: Frank Bulk
Cc: bind-users
Subject: Re: Digging to the final IP

On Oct 19, 2014, at 1:26, Frank Bulk frnk...@iname.com wrote:

 Is there a dig option that will list out the final (IPs) or query result??
 By default, even with +short, it can list intermediate CNAME(s) and not
what
 IP(s) that CNAME may have.  
 
 For example, 
   root@nagios:/tmp# dig mail.automatedwastesystems.net +short
   mail3.sandhills.com.
   root@nagios:/tmp#
 
 I'd rather know that mail3.sandhills.com is NXDOMAIN.
 
 Regards,
 
 Frank


How about. 

$ dig +noall +answer mail.automatedwastesystems.net in a | egrep 'IN\tA\t' |
cut -f6

which correctly returns nothing in this case, but when there's a CNAME chain
ending in addresses it returns them

$ dig +noall +answer dave.knig.ht in a | egrep 'IN\tA\t' | cut -f6
216.235.14.46

and surely you want IPv6 support.

$ dig +noall +answer dave.knig.ht in a dave.knig.ht in  | egrep
'IN\t(A|)\t' | cut -f6
216.235.14.46
2001:4900:1:393::2

dave

___
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users


Re: Digging to the final IP

2014-10-21 Thread LuKreme

 On 21 Oct 2014, at 19:20 , Dave Knight d...@knig.ht wrote:
 
 $ dig +noall +answer dave.knig.ht in a | egrep 'IN\tA\t' | cut -f6
 216.235.14.46

Interesting. This works for me:

dig +noall +answer home.kreme.com in a | egrep '\tA' | cut -f5

but on your example, it requires -f6

And yet, the outputs appear to have the same number of fields.

 $ dig +noall +answer www.kreme.com in a 
www.kreme.com.  21139   IN  CNAME   cerebus.kreme.com.
cerebus.kreme.com.  21141   IN  A   23.24.150.141
 $ dig +noall +answer dave.knig.ht in a 
dave.knig.ht.   13916   IN  CNAME   sb.sanxion.org.
sb.sanxion.org. 222 IN  A   216.235.14.46

Very odd.

I use:

 $ dig +short $HOSTNAME | tail -1


-- 
A synonym is a word you use when you can't spell the word you first
thought of. - Burt Bacharach

___
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users


Re: Digging to the final IP

2014-10-21 Thread David Ford
# dig +noall +answer dave.knig.ht a|awk '/IN\tA\t/ {print $NF}'
216.235.14.46




signature.asc
Description: OpenPGP digital signature
___
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users

Re: Digging to the final IP

2014-10-21 Thread Jim Young
On 10/22/14 12:08 AM, LuKreme krem...@kreme.com wrote:

 On 21 Oct 2014, at 19:20 , Dave Knight d...@knig.ht wrote:
 
 $ dig +noall +answer dave.knig.ht in a | egrep 'IN\tA\t' | cut -f6
 216.235.14.46

Interesting. This works for me:

dig +noall +answer home.kreme.com in a | egrep '\tA' | cut -f5

but on your example, it requires -f6

And yet, the outputs appear to have the same number of fields.

 $ dig +noall +answer www.kreme.com in a
www.kreme.com. 21139   IN  CNAME   cerebus.kreme.com.
cerebus.kreme.com. 21141   IN  A   23.24.150.141
 $ dig +noall +answer dave.knig.ht in a
dave.knig.ht.  13916   IN  CNAME   sb.sanxion.org.
sb.sanxion.org.222 IN  A   216.235.14.46

Very odd.

Subtle formatting difference for human consumption.  There are a variable
number of ASCII TABs inserted to visually align fields.

$ dig +noall +answer www.kreme.com in a | egrep '\tA' | cat -t
cerebus.kreme.com.^I21409^IIN^IA^I23.24.150.141

$ dig +noall +answer dave.knig.ht in a | egrep '\tA' | cat -t
sb.sanxion.org.^I^I299^IIN^IA^I216.235.14.46

There is only one ASCII TAB (represented as ^I with cat -t) between
cerebus.kreme.com. and 21409. but two ASCII TABs between
sb.sanxion.org. and 299.  I'm guessing a very short name might
result in three!

This is where output generated for human consumption can be tricky to
parse.

Best regards,

Jim Y.

___
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users


Re: Digging to the final IP

2014-10-20 Thread Josh Kuo
If all you are after is one of the final IP addresses (not the entire 
set), then using a dumb client might be easier. For instance, 'ping'.


$ ping -q -c1 www.google.com
PING www.google.com (203.66.155.113): 56 data bytes


If you want to get more than one IP address, then you'll need an 
intelligent client such as 'host' or 'dig:


$ host www.google.com
www.google.com has address 203.66.155.49
www.google.com has address 203.66.155.50
www.google.com has address 203.66.155.44
...
www.google.com has address 203.66.155.45
www.google.com has IPv6 address 2404:6800:4008:c03::67



On 10/20/14, 12:03 PM, Fajar A. Nugraha wrote:

What are you using this for?

If it's part of a script, it might be easier to just use gethostbyname. For
example, in php: http://php.net/manual/en/function.gethostbyname.php ,
Returns the IPv4 address or a string containing the unmodified hostname on
failure.



___
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users


___
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users

RE: Digging to the final IP

2014-10-20 Thread Frank Bulk (iname.com)
We’re using this in a bash shell script.  I don’t think there’s a native shell 
command to get the IP, so I’ll use a mixture of host and dig as necessary.

 

Thanks,

 

Frank

 

From: Fajar A. Nugraha [mailto:w...@fajar.net] 
Sent: Sunday, October 19, 2014 11:04 PM
To: Frank Bulk
Cc: comp-protocols-dns-b...@isc.org
Subject: Re: Digging to the final IP

 

What are you using this for?

 

If it's part of a script, it might be easier to just use gethostbyname. For 
example, in php: http://php.net/manual/en/function.gethostbyname.php , Returns 
the IPv4 address or a string containing the unmodified hostname on failure.

 

-- 

Fajar

 

 

On Mon, Oct 20, 2014 at 10:43 AM, Frank Bulk frnk...@iname.com 
mailto:frnk...@iname.com  wrote:

Thanks, what I ended up using.

Didn't think that there was anything host could do that dig couldn't do.

Frank


-Original Message-
From: bind-users-boun...@lists.isc.org 
mailto:bind-users-boun...@lists.isc.org 
[mailto:bind-users-boun...@lists.isc.org 
mailto:bind-users-boun...@lists.isc.org ] On Behalf Of Barry Margolin
Sent: Sunday, October 19, 2014 5:00 AM
To: comp-protocols-dns-b...@isc.org mailto:comp-protocols-dns-b...@isc.org 
Subject: Re: Digging to the final IP

In article mailman.1097.1413711142.26362.bind-us...@lists.isc.org 
mailto:mailman.1097.1413711142.26362.bind-us...@lists.isc.org ,
 Sten Carlsen st...@s-carlsen.dk mailto:st...@s-carlsen.dk  wrote:

 Would host be closer to what you want?

Host also tells you about aliases it encounters along the way.



 --
 Best regards

 Sten Carlsen

 No improvements come from shouting:

   MALE BOVINE MANURE!!!

  On 19 Oct 2014, at 08:05, Karl Auer ka...@biplane.com.au 
  mailto:ka...@biplane.com.au  wrote:
 
  On Sun, 2014-10-19 at 00:26 -0500, Frank Bulk wrote:
  Is there a dig option that will list out the final (IPs) or query
result??
  By default, even with +short, it can list intermediate CNAME(s) and not

  what
  IP(s) that CNAME may have.
 
  Not great, but might be enough to be helpful:
 
dig +nonssearch $1 | egrep -i STATUS|^$1
 
  Regards, K.
 
  --
  ~~~
  Karl Auer (ka...@biplane.com.au mailto:ka...@biplane.com.au )
  http://www.biplane.com.au/kauer
  http://twitter.com/kauer389
 
  GPG fingerprint: EC67 61E2 C2F6 EB55 884B E129 072B 0AF0 72AA 9882
  Old fingerprint: B862 FB15 FE96 4961 BC62 1A40 6239 1208 9865 5F9A
 
 
  ___
  Please visit https://lists.isc.org/mailman/listinfo/bind-users to
  unsubscribe from this list
 
  bind-users mailing list
  bind-users@lists.isc.org mailto:bind-users@lists.isc.org 
  https://lists.isc.org/mailman/listinfo/bind-users

--
Barry Margolin
Arlington, MA
___
Please visit https://lists.isc.org/mailman/listinfo/bind-users to
unsubscribe from this list

bind-users mailing list
bind-users@lists.isc.org mailto:bind-users@lists.isc.org 
https://lists.isc.org/mailman/listinfo/bind-users


___
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

bind-users mailing list
bind-users@lists.isc.org mailto:bind-users@lists.isc.org 
https://lists.isc.org/mailman/listinfo/bind-users

 

___
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users

Re: Digging to the final IP

2014-10-20 Thread Phil Mayers

On 20/10/14 14:22, Frank Bulk (iname.com) wrote:

We’re using this in a bash shell script.  I don’t think there’s a native
shell command to get the IP, so I’ll use a mixture of host and dig as
necessary.


If your system has it, try getent e.g.

getent ahosts hostname
___
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users


Re: Digging to the final IP

2014-10-20 Thread Mark Andrews

Why do we need to have a option to dig to massage the results into
every possible different form?  

dig A $name | awk '$0 ~ /status/  $0 !~ /status: NOERROR,/ {
sub(,, , $6 ); print $6; x=1
   }
   $4 == A { print $5; x=1 }
   END { if (!x) print TIMEOUT }'

Mark


In message 54451077.8030...@imperial.ac.uk, Phil Mayers writes:
 On 20/10/14 14:22, Frank Bulk (iname.com) wrote:
  We=92re using this in a bash shell script.  I don=92t think there=92s a n=
 ative
  shell command to get the IP, so I=92ll use a mixture of host and dig as
  necessary.
 
 If your system has it, try getent e.g.
 
 getent ahosts hostname
 ___
 Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscri=
 be from this list
 
 bind-users mailing list
 bind-users@lists.isc.org
 https://lists.isc.org/mailman/listinfo/bind-users
-- 
Mark Andrews, ISC
1 Seymour St., Dundas Valley, NSW 2117, Australia
PHONE: +61 2 9871 4742 INTERNET: ma...@isc.org
___
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users


RE: Digging to the final IP

2014-10-20 Thread Frank Bulk
That feature runs on our system, but it doesn't digging through to a final
IP or failure:
getent ahosts mail.automatedwastesystems.net
returns nothing.

Regards,

Frank

-Original Message-
From: bind-users-boun...@lists.isc.org
[mailto:bind-users-boun...@lists.isc.org] On Behalf Of Phil Mayers
Sent: Monday, October 20, 2014 8:39 AM
To: bind-users@lists.isc.org
Subject: Re: Digging to the final IP

On 20/10/14 14:22, Frank Bulk (iname.com) wrote:
 We're using this in a bash shell script.  I don't think there's a native
 shell command to get the IP, so I'll use a mixture of host and dig as
 necessary.

If your system has it, try getent e.g.

getent ahosts hostname
___
Please visit https://lists.isc.org/mailman/listinfo/bind-users to
unsubscribe from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users


___
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users


Re: Digging to the final IP

2014-10-19 Thread Karl Auer
On Sun, 2014-10-19 at 00:26 -0500, Frank Bulk wrote:
 Is there a dig option that will list out the final (IPs) or query result??
 By default, even with +short, it can list intermediate CNAME(s) and not what
 IP(s) that CNAME may have. 

Not great, but might be enough to be helpful:

   dig +nonssearch $1 | egrep -i STATUS|^$1

Regards, K.

-- 
~~~
Karl Auer (ka...@biplane.com.au)
http://www.biplane.com.au/kauer
http://twitter.com/kauer389

GPG fingerprint: EC67 61E2 C2F6 EB55 884B E129 072B 0AF0 72AA 9882
Old fingerprint: B862 FB15 FE96 4961 BC62 1A40 6239 1208 9865 5F9A


___
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users


Re: Digging to the final IP

2014-10-19 Thread Sten Carlsen
Would host be closer to what you want?


-- 
Best regards

Sten Carlsen

No improvements come from shouting:

  MALE BOVINE MANURE!!!

 On 19 Oct 2014, at 08:05, Karl Auer ka...@biplane.com.au wrote:
 
 On Sun, 2014-10-19 at 00:26 -0500, Frank Bulk wrote:
 Is there a dig option that will list out the final (IPs) or query result??
 By default, even with +short, it can list intermediate CNAME(s) and not what
 IP(s) that CNAME may have.
 
 Not great, but might be enough to be helpful:
 
   dig +nonssearch $1 | egrep -i STATUS|^$1
 
 Regards, K.
 
 -- 
 ~~~
 Karl Auer (ka...@biplane.com.au)
 http://www.biplane.com.au/kauer
 http://twitter.com/kauer389
 
 GPG fingerprint: EC67 61E2 C2F6 EB55 884B E129 072B 0AF0 72AA 9882
 Old fingerprint: B862 FB15 FE96 4961 BC62 1A40 6239 1208 9865 5F9A
 
 
 ___
 Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
 from this list
 
 bind-users mailing list
 bind-users@lists.isc.org
 https://lists.isc.org/mailman/listinfo/bind-users
___
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users


Re: Digging to the final IP

2014-10-19 Thread Barry Margolin
In article mailman.1097.1413711142.26362.bind-us...@lists.isc.org,
 Sten Carlsen st...@s-carlsen.dk wrote:

 Would host be closer to what you want?

Host also tells you about aliases it encounters along the way.

 
 
 -- 
 Best regards
 
 Sten Carlsen
 
 No improvements come from shouting:
 
   MALE BOVINE MANURE!!!
 
  On 19 Oct 2014, at 08:05, Karl Auer ka...@biplane.com.au wrote:
  
  On Sun, 2014-10-19 at 00:26 -0500, Frank Bulk wrote:
  Is there a dig option that will list out the final (IPs) or query result??
  By default, even with +short, it can list intermediate CNAME(s) and not 
  what
  IP(s) that CNAME may have.
  
  Not great, but might be enough to be helpful:
  
dig +nonssearch $1 | egrep -i STATUS|^$1
  
  Regards, K.
  
  -- 
  ~~~
  Karl Auer (ka...@biplane.com.au)
  http://www.biplane.com.au/kauer
  http://twitter.com/kauer389
  
  GPG fingerprint: EC67 61E2 C2F6 EB55 884B E129 072B 0AF0 72AA 9882
  Old fingerprint: B862 FB15 FE96 4961 BC62 1A40 6239 1208 9865 5F9A
  
  
  ___
  Please visit https://lists.isc.org/mailman/listinfo/bind-users to 
  unsubscribe from this list
  
  bind-users mailing list
  bind-users@lists.isc.org
  https://lists.isc.org/mailman/listinfo/bind-users

-- 
Barry Margolin
Arlington, MA
___
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users


RE: Digging to the final IP

2014-10-19 Thread Frank Bulk
Thanks, what I ended up using.

Didn't think that there was anything host could do that dig couldn't do.

Frank

-Original Message-
From: bind-users-boun...@lists.isc.org
[mailto:bind-users-boun...@lists.isc.org] On Behalf Of Barry Margolin
Sent: Sunday, October 19, 2014 5:00 AM
To: comp-protocols-dns-b...@isc.org
Subject: Re: Digging to the final IP

In article mailman.1097.1413711142.26362.bind-us...@lists.isc.org,
 Sten Carlsen st...@s-carlsen.dk wrote:

 Would host be closer to what you want?

Host also tells you about aliases it encounters along the way.

 
 
 -- 
 Best regards
 
 Sten Carlsen
 
 No improvements come from shouting:
 
   MALE BOVINE MANURE!!!
 
  On 19 Oct 2014, at 08:05, Karl Auer ka...@biplane.com.au wrote:
  
  On Sun, 2014-10-19 at 00:26 -0500, Frank Bulk wrote:
  Is there a dig option that will list out the final (IPs) or query
result??
  By default, even with +short, it can list intermediate CNAME(s) and not

  what
  IP(s) that CNAME may have.
  
  Not great, but might be enough to be helpful:
  
dig +nonssearch $1 | egrep -i STATUS|^$1
  
  Regards, K.
  
  -- 
  ~~~
  Karl Auer (ka...@biplane.com.au)
  http://www.biplane.com.au/kauer
  http://twitter.com/kauer389
  
  GPG fingerprint: EC67 61E2 C2F6 EB55 884B E129 072B 0AF0 72AA 9882
  Old fingerprint: B862 FB15 FE96 4961 BC62 1A40 6239 1208 9865 5F9A
  
  
  ___
  Please visit https://lists.isc.org/mailman/listinfo/bind-users to 
  unsubscribe from this list
  
  bind-users mailing list
  bind-users@lists.isc.org
  https://lists.isc.org/mailman/listinfo/bind-users

-- 
Barry Margolin
Arlington, MA
___
Please visit https://lists.isc.org/mailman/listinfo/bind-users to
unsubscribe from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users


___
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users


Re: Digging to the final IP

2014-10-19 Thread Fajar A. Nugraha
What are you using this for?

If it's part of a script, it might be easier to just use gethostbyname. For
example, in php: http://php.net/manual/en/function.gethostbyname.php ,
Returns the IPv4 address or a string containing the unmodified hostname on
failure.

-- 
Fajar


On Mon, Oct 20, 2014 at 10:43 AM, Frank Bulk frnk...@iname.com wrote:

 Thanks, what I ended up using.

 Didn't think that there was anything host could do that dig couldn't do.

 Frank

 -Original Message-
 From: bind-users-boun...@lists.isc.org
 [mailto:bind-users-boun...@lists.isc.org] On Behalf Of Barry Margolin
 Sent: Sunday, October 19, 2014 5:00 AM
 To: comp-protocols-dns-b...@isc.org
 Subject: Re: Digging to the final IP

 In article mailman.1097.1413711142.26362.bind-us...@lists.isc.org,
  Sten Carlsen st...@s-carlsen.dk wrote:

  Would host be closer to what you want?

 Host also tells you about aliases it encounters along the way.

 
 
  --
  Best regards
 
  Sten Carlsen
 
  No improvements come from shouting:
 
MALE BOVINE MANURE!!!
 
   On 19 Oct 2014, at 08:05, Karl Auer ka...@biplane.com.au wrote:
  
   On Sun, 2014-10-19 at 00:26 -0500, Frank Bulk wrote:
   Is there a dig option that will list out the final (IPs) or query
 result??
   By default, even with +short, it can list intermediate CNAME(s) and
 not

   what
   IP(s) that CNAME may have.
  
   Not great, but might be enough to be helpful:
  
 dig +nonssearch $1 | egrep -i STATUS|^$1
  
   Regards, K.
  
   --
   ~~~
   Karl Auer (ka...@biplane.com.au)
   http://www.biplane.com.au/kauer
   http://twitter.com/kauer389
  
   GPG fingerprint: EC67 61E2 C2F6 EB55 884B E129 072B 0AF0 72AA 9882
   Old fingerprint: B862 FB15 FE96 4961 BC62 1A40 6239 1208 9865 5F9A
  
  
   ___
   Please visit https://lists.isc.org/mailman/listinfo/bind-users to
   unsubscribe from this list
  
   bind-users mailing list
   bind-users@lists.isc.org
   https://lists.isc.org/mailman/listinfo/bind-users

 --
 Barry Margolin
 Arlington, MA
 ___
 Please visit https://lists.isc.org/mailman/listinfo/bind-users to
 unsubscribe from this list

 bind-users mailing list
 bind-users@lists.isc.org
 https://lists.isc.org/mailman/listinfo/bind-users


 ___
 Please visit https://lists.isc.org/mailman/listinfo/bind-users to
 unsubscribe from this list

 bind-users mailing list
 bind-users@lists.isc.org
 https://lists.isc.org/mailman/listinfo/bind-users

___
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users