dns at botham.net
Tue Oct 15 12:38:32 UTC 2002
Or, you could use the NET::DNS module in perl. I find it handy,
relatively fast (for an interpreted language...)
> -----Original Message-----
> From: bind-users-bounce at isc.org [mailto:bind-users-bounce at isc.org] On
> Behalf Of Ian Zimmerman
> Sent: Tuesday, October 15, 2002 12:18 AM
> To: comp-protocols-dns-bind at isc.org
> Subject: dig questions
> Hi, I am trying to write a program that relies on dig (from BIND9) as
> a resolver backend. I made that decision after giving up on my search
> for a nice easily usable resolver library. Before you ask: I know
> about adns, but it doesn't do axfr queries.
> Now to the point: I have some problems with parsing dig output.
> First, I would like to only run a single dig process with "dig -f -"
> and send it multiple queries over a pipe, as needed. But how can I
> know where each answer ends? There is no prompt or terminator or
> anything of the sort. The best I came up with so far was to give each
> query the flags "+nocmd +nocomments +noquestion +stats". That way the
> answer always (well, almost - see second question below) ends with the
> stats, which are recognizable by the leading ";;", followed eventually
> with a blank line. Is there any other way?
> Second, even in this case the output is not always consistent. If the
> query times out, for example, the error is announced on a single ";;"
> line, _not_ followed by a blank line. So again, unless I actually
> parse inside the error message (eek), I don't know that the answer is
> Lastly, sometimes the answer is preceded by this:
> ;; Warning, extra type option
> The meaning of this is a complete mystery to me, as whether it appears
> or not seems to depend on the phase of the moon -- I have got both
> cases with exactly the same query. And it is not even mentioned in
> the manpage.
> I know I wouldn't have any of these problems if I started one dig per
> query (then I can just read all its output until I hit eof, and ignore
> ;; lines). But that feels cheap and ugly to this perfectionist.
> Thanks for your thoughts.
> Ian Zimmerman, Oakland, California, U.S.A. I did not vote for Emperor
> GPG: 433BA087 9C0F 194F 203A 63F7 B1B8 6E5A 8CA3 27DB 433B A087
More information about the bind-users