Поиск по этому блогу

вторник, 21 октября 2014 г.

FB2 читалка для Linux-консоли, fb2 to txt, fb2 to xhtml, fb2 to html

Собственно всё сводится к простому xsl-преобразованию. Для начала рисуем fb2_2_txt.xsl:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:fb="http://www.gribuser.ru/xml/fictionbook/2.0">
        <xsl:strip-space elements="*"/>
        <xsl:output method="text" encoding="UTF-8"/>
        <xsl:key name="note-link" match="fb:section|fb:p" use="@id"/>

        <xsl:template match="*">
<!-- <xsl:variable/> -->
<xsl:value-of select="fb:description/fb:title-info/fb:book-title"/>
<xsl:text >
</xsl:text>
<xsl:for-each select="fb:description/fb:title-info/fb:author">    <xsl:call-template name="author"/>
<xsl:text >
</xsl:text>
</xsl:for-each>
<xsl:text >
</xsl:text>

<xsl:if test="fb:description/fb:title-info/fb:sequence">
<xsl:for-each select="fb:description/fb:title-info/fb:sequence"><xsl:call-template name="sequence"/></xsl:for-each>
<xsl:text >
</xsl:text>
</xsl:if>
<xsl:for-each select="fb:description/fb:title-info/fb:annotation">
<xsl:call-template name="annotation"/>
<xsl:text >
</xsl:text>
</xsl:for-each>
                                <!-- BUILD BOOK -->
<xsl:for-each select="fb:body">
<xsl:if test="position()!=1">
<xsl:text >

</xsl:text>
</xsl:if>

<xsl:if test="@name">
<xsl:value-of select="@name"/>
<xsl:text >
</xsl:text>
</xsl:if>
<!-- <xsl:apply-templates /> -->
<xsl:apply-templates/>
</xsl:for-each>
<xsl:text >
</xsl:text>
        </xsl:template>
        <!-- author template -->
<xsl:template name="author">
        <xsl:value-of select="fb:first-name"/>
        <xsl:text> </xsl:text>
        <xsl:if test="fb:middle-name and fb:middle-name!=''">
                <xsl:value-of select="fb:middle-name" />
                <xsl:text> </xsl:text>
        </xsl:if> 
        <xsl:value-of select="fb:last-name"/>
        <xsl:text >
</xsl:text>
</xsl:template>
        <!-- secuence template -->
<xsl:template name="sequence">
<xsl:value-of select="@name"/><xsl:if test="@number"><xsl:text > #</xsl:text><xsl:value-of select="@number"/></xsl:if>
<xsl:if test="fb:sequence">
        <xsl:for-each select="fb:sequence">
<xsl:call-template name="sequence"/>
</xsl:for-each>
</xsl:if></xsl:template>

<!-- description -->
<xsl:template match="fb:description">
<xsl:apply-templates/>
<xsl:text >
</xsl:text>
</xsl:template>
<!-- body -->
<xsl:template match="fb:body">
<xsl:text >
</xsl:text>
<xsl:apply-templates/>
</xsl:template>

<xsl:template match="fb:section">
<xsl:text >
</xsl:text>
<xsl:apply-templates select="./*"/>
</xsl:template>


<!-- section/title -->
<xsl:template match="fb:title">
<xsl:text >

</xsl:text>
<xsl:apply-templates/>
<xsl:text >
</xsl:text>
</xsl:template>

        <!-- subtitle -->
<xsl:template match="fb:subtitle">
<xsl:text >
</xsl:text>
<xsl:apply-templates/>
<xsl:text >

</xsl:text>
</xsl:template>

<!-- p -->
<xsl:template match="fb:p">
<xsl:apply-templates/>
<xsl:text >

</xsl:text>
</xsl:template>

<xsl:template match="fb:p" mode="note">
<xsl:apply-templates/>
</xsl:template>

<xsl:template match="fb:title" mode="note">
<xsl:apply-templates mode="note"/><xsl:text disable-output-escaping="yes"> - </xsl:text>
</xsl:template>


<xsl:template match="fb:strong|fb:emphasis|fb:style"><xsl:apply-templates/></xsl:template>

<xsl:template match="fb:a">
<xsl:choose>
<xsl:when test="(@type) = 'note'">
<xsl:choose>
<xsl:when test="starts-with(@xlink:href,'#')"><xsl:for-each select="key('note-link',substring-after(@xlink:href,'#'))">[<xsl:apply-templates mode="note"/>]</xsl:for-each></xsl:when>
<xsl:otherwise><xsl:for-each select="key('note-link',@xlink:href)">[<xsl:apply-templates mode="note"/>]</xsl:for-each></xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template match="fb:empty-line">
<xsl:text >

</xsl:text>
</xsl:template>

<!-- annotation -->
<xsl:template name="annotation">
<xsl:apply-templates/>
<xsl:text >
</xsl:text>
</xsl:template>

<!-- epigraph -->
<xsl:template match="fb:epigraph">
<xsl:apply-templates/>
<xsl:text >
</xsl:text>
</xsl:template>

<!-- cite -->
<xsl:template match="fb:cite">
        <xsl:text >

</xsl:text>
        <xsl:apply-templates/>
        <xsl:text >
</xsl:text>
</xsl:template>


        <!-- cite/text-author -->
<xsl:template match="fb:text-author">
        <xsl:text >    </xsl:text>
        <xsl:apply-templates/>
        <xsl:text >
</xsl:text>
</xsl:template>
        <!-- date -->
<xsl:template match="fb:date">
        <xsl:text >    </xsl:text>
        <xsl:apply-templates/>
        <xsl:text >
</xsl:text>
</xsl:template>

<xsl:template match="fb:poem">
<xsl:apply-templates/>
</xsl:template>

        <!-- stanza -->
<xsl:template match="fb:stanza">
<xsl:apply-templates/>
<xsl:text >
</xsl:text>
</xsl:template>
        <!-- v -->
<xsl:template match="fb:v">
<xsl:text >               </xsl:text>
<xsl:apply-templates/>
<xsl:text >
</xsl:text>
</xsl:template>

</xsl:stylesheet>


Затем, в консоли, выполняем:
zcat book.fb2.zip | xsltproc fb2_2_txt.xsl - | less -s

Более того, подобное преобразование можно выполнить для преобразования fb2 в xhtml, с сохранением картинок (спасибо tkf http://habrahabr.ru/post/75827/), файл fb2_22_xhtml.xsl:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:fb="http://www.gribuser.ru/xml/fictionbook/2.0">
        <xsl:output method="xml" encoding="UTF-8"/>
        <xsl:key name="note-link" match="fb:section" use="@id"/>
        <xsl:template match="/*">
                <html>
                        <head>
                                <xsl:if test="fb:description/fb:title-info/fb:lang = 'ru'">
                                        <meta HTTP-EQUIV="content-type" CONTENT="text/html; charset=UTF-8"/>
                                </xsl:if>
                                <title>
                                        <xsl:value-of select="fb:description/fb:title-info/fb:book-title"/>
                                </title>
                                <style type="text/x-oeb1-css">
                                        A { color : #0002CC }
                                        A:HOVER { color : #BF0000 }
                                        BODY { background-color : #FEFEFE; color : #000000; font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; text-align : justify }
                                        H1{ font-size : 160%; font-style : normal; font-weight : bold; text-align : left; border : 1px solid Black;  background-color : #E7E7E7; margin-left : 0px;  page-break-before : always; }
                                        H2{ font-size : 130%; font-style : normal; font-weight : bold; text-align : left; background-color : #EEEEEE;  border : 1px solid Gray;  page-break-before : always; }
                                        H3{ font-size : 110%; font-style : normal; font-weight : bold; text-align : left;  background-color : #F1F1F1;  border : 1px solid Silver;}
                                        H4{ font-size : 100%; font-style : normal; font-weight : bold; text-align : left; border : 1px solid Gray;  background-color : #F4F4F4;}
                                        H5{ font-size : 100%; font-style : italic; font-weight : bold; text-align : left; border : 1px solid Gray;  background-color : #F4F4F4;}
                                        H6{ font-size : 100%; font-style : italic; font-weight : normal; text-align : left; border : 1px solid Gray;  background-color : #F4F4F4;}
                                        SMALL{ font-size : 80% }
                                        BLOCKQUOTE{ margin-left :4em; margin-top:1em; margin-right:0.2em;}
                                        HR{ color : Black }
                                        UL{margin-left: 0}
                                        .epigraph{width:50%; margin-left : 35%;}
                                </style>
                        </head>
                        <body>


                                                <h4 align="center">
                                                <xsl:value-of select="fb:description/fb:title-info/fb:book-title"/>
                                                </h4>

<xsl:for-each select="fb:description/fb:title-info/fb:coverpage/fb:image">
                <xsl:call-template name="image"/>
                </xsl:for-each>

                                <xsl:for-each select="fb:description/fb:title-info/fb:annotation">

                                        <div>
                                                <xsl:call-template name="annotation"/>
                                        </div>
                                        <hr/>
                                </xsl:for-each>
                                <!-- BUILD TOC -->
                                <ul>
                                        <xsl:apply-templates select="fb:body" mode="toc"/>
                                </ul>
                                <hr/>
                                <!-- BUILD BOOK -->
                                <xsl:for-each select="fb:body">
                                        <xsl:if test="position()!=1">
                                                <hr/>
                                        </xsl:if>
                                        <xsl:if test="@name">
                                                <h4 align="center">
                                                        <xsl:value-of select="@name"/>
                                                </h4>
                                        </xsl:if>
                                        <!-- <xsl:apply-templates /> -->
                                        <xsl:apply-templates/>
                                </xsl:for-each>
                        </body>
                </html>
        </xsl:template>
        <!-- author template -->
        <xsl:template name="author">
                <xsl:value-of select="fb:first-name"/>
                <xsl:text disable-output-escaping="no"> </xsl:text>
                <xsl:value-of select="fb:middle-name"/> 
         <xsl:text disable-output-escaping="no"> </xsl:text>
                <xsl:value-of select="fb:last-name"/>
                <br/>
        </xsl:template>
        <!-- secuence template -->
        <xsl:template name="sequence">
                <LI/>
                <xsl:value-of select="@name"/>
                <xsl:if test="@number">
                        <xsl:text disable-output-escaping="no">, #</xsl:text>
                        <xsl:value-of select="@number"/>
                </xsl:if>
                <xsl:if test="fb:sequence">
                        <ul>
                                <xsl:for-each select="fb:sequence">
                                        <xsl:call-template name="sequence"/>
                                </xsl:for-each>
                        </ul>
                </xsl:if>
                <!--      <br/> -->
        </xsl:template>
        <!-- toc template -->
        <xsl:template match="fb:section|fb:body" mode="toc">
                <xsl:choose>
                        <xsl:when test="name()='body' and position()=1 and not(fb:title)">
                                <xsl:apply-templates select="fb:section" mode="toc"/>
                        </xsl:when>
                        <xsl:otherwise>
                                <li>
                                        <a href="#TOC_{generate-id()}"><xsl:value-of select="normalize-space(fb:title/fb:p[1] | @name)"/></a>
                                        <xsl:if test="fb:section">
                                                <ul><xsl:apply-templates select="fb:section" mode="toc"/></ul>
                                        </xsl:if>
                                </li>
                        </xsl:otherwise>
                </xsl:choose>
        </xsl:template>
        <!-- description -->
        <xsl:template match="fb:description">
                <xsl:apply-templates/>
        </xsl:template>
        <!-- body -->
        <xsl:template match="fb:body">
                <div><xsl:apply-templates/></div>
        </xsl:template>

        <xsl:template match="fb:section">
                <a name="TOC_{generate-id()}"></a>
                <xsl:if test="@id">
                        <xsl:element name="a">
                                <xsl:attribute name="name"><xsl:value-of select="@id"/></xsl:attribute>
                        </xsl:element>
                </xsl:if>
                <xsl:apply-templates/>
        </xsl:template>


        <!-- section/title -->
        <xsl:template match="fb:section/fb:title|fb:poem/fb:title">
                <xsl:choose>
                        <xsl:when test="count(ancestor::node()) < 9">
                                <xsl:element name="{concat('h',count(ancestor::node())-3)}">
                                        <a name="TOC_{generate-id()}"></a>
                                        <xsl:if test="@id">
                                                <xsl:element name="a">
                                                        <xsl:attribute name="name"><xsl:value-of select="@id"/></xsl:attribute>
                                                </xsl:element>
                                        </xsl:if>
                                        <xsl:apply-templates/>
                                </xsl:element>
                        </xsl:when>
                        <xsl:otherwise>
                                <xsl:element name="h6">
                                        <xsl:if test="@id">
                                                <xsl:element name="a">
                                                        <xsl:attribute name="name"><xsl:value-of select="@id"/></xsl:attribute>
                                                </xsl:element>
                                        </xsl:if>
                                        <xsl:apply-templates/>
                                </xsl:element>
                        </xsl:otherwise>
                </xsl:choose>
        </xsl:template>
        <!-- section/title -->
        <xsl:template match="fb:body/fb:title">
                <h1><xsl:apply-templates mode="title"/></h1>
        </xsl:template>

        <xsl:template match="fb:title/fb:p">
                <xsl:apply-templates/><xsl:text disable-output-escaping="no"> </xsl:text><br/>
        </xsl:template>
        <!-- subtitle -->
        <xsl:template match="fb:subtitle">
                <xsl:if test="@id">
                        <xsl:element name="a">
                                <xsl:attribute name="name"><xsl:value-of select="@id"/></xsl:attribute>
                        </xsl:element>
                </xsl:if>
                <h5>
                        <xsl:apply-templates/>
                </h5>
        </xsl:template>
        <!-- p -->
        <xsl:template match="fb:p">
                <div align="justify"><xsl:if test="@id">
                                <xsl:element name="a">
                                        <xsl:attribute name="name"><xsl:value-of select="@id"/></xsl:attribute>
                                </xsl:element>
                        </xsl:if>    <xsl:apply-templates/></div>
        </xsl:template>
        <!-- strong -->
        <xsl:template match="fb:strong">
                <b><xsl:apply-templates/></b>
        </xsl:template>
        <!-- emphasis -->
        <xsl:template match="fb:emphasis">
                <i>       <xsl:apply-templates/></i>
        </xsl:template>
        <!-- style -->
        <xsl:template match="fb:style">
                <span class="{@name}"><xsl:apply-templates/></span>
        </xsl:template>
        <!-- empty-line -->
        <xsl:template match="fb:empty-line">
                <br/>
        </xsl:template>
        <!-- link -->
        <xsl:template match="fb:a">
                <xsl:element name="a">
                        <xsl:attribute name="href"><xsl:value-of select="@xlink:href"/></xsl:attribute>
                        <xsl:attribute name="title">
                                <xsl:choose>
                                        <xsl:when test="starts-with(@xlink:href,'#')"><xsl:value-of select="key('note-link',substring-after(@xlink:href,'#'))/fb:p"/></xsl:when>
                                        <xsl:otherwise><xsl:value-of select="key('note-link',@xlink:href)/fb:p"/></xsl:otherwise>
                                </xsl:choose>
                        </xsl:attribute>
                        <xsl:choose>
                                <xsl:when test="(@type) = 'note'">
                                        <sup>
                                                <xsl:apply-templates/>
                                        </sup>
                                </xsl:when>
                                <xsl:otherwise>
                                        <xsl:apply-templates/>
                                </xsl:otherwise>
                        </xsl:choose>
                </xsl:element>
        </xsl:template>
        <!-- annotation -->
        <xsl:template name="annotation">
                <xsl:if test="@id">
                        <xsl:element name="a">
                                <xsl:attribute name="name"><xsl:value-of select="@id"/></xsl:attribute>
                        </xsl:element>
                </xsl:if>
                <h3>Annotation</h3>
                <xsl:apply-templates/>
        </xsl:template>
        <!-- epigraph -->
        <xsl:template match="fb:epigraph">
                <blockquote class="epigraph">
                        <xsl:if test="@id">
                                <xsl:element name="a">
                                        <xsl:attribute name="name"><xsl:value-of select="@id"/></xsl:attribute>
                                </xsl:element>
                        </xsl:if>
                        <xsl:apply-templates/>
                </blockquote>
        </xsl:template>
        <!-- epigraph/text-author -->
        <xsl:template match="fb:epigraph/fb:text-author">
                <blockquote>
                        <i><xsl:apply-templates/></i>
                </blockquote>
        </xsl:template>
        <!-- cite -->
        <xsl:template match="fb:cite">
                <blockquote>
                <xsl:if test="@id">
                        <xsl:element name="a">
                                <xsl:attribute name="name"><xsl:value-of select="@id"/></xsl:attribute>
                        </xsl:element>
                </xsl:if>
                <xsl:apply-templates/>
                </blockquote>
        </xsl:template>
        <!-- cite/text-author -->
        <xsl:template match="fb:text-author">
                <blockquote>
                <i>       <xsl:apply-templates/></i></blockquote>
        </xsl:template>
        <!-- date -->
        <xsl:template match="fb:date">
                <xsl:choose>
                        <xsl:when test="not(@value)">
                                   <xsl:apply-templates/>
                                <br/>
                        </xsl:when>
                        <xsl:otherwise>
                                   <xsl:value-of select="@value"/>
                                <br/>
                        </xsl:otherwise>
                </xsl:choose>
        </xsl:template>
        <!-- poem -->
        <xsl:template match="fb:poem">
                <blockquote>
                        <xsl:if test="@id">
                                <xsl:element name="a">
                                        <xsl:attribute name="name"><xsl:value-of select="@id"/></xsl:attribute>
                                </xsl:element>
                        </xsl:if>
                        <xsl:apply-templates/>
                </blockquote>
        </xsl:template>

        <!-- stanza -->
        <xsl:template match="fb:stanza">
                <xsl:apply-templates/>
                <br/>
        </xsl:template>
        <!-- v -->
        <xsl:template match="fb:v">
                <xsl:if test="@id">
                        <xsl:element name="a">
                                <xsl:attribute name="name"><xsl:value-of select="@id"/></xsl:attribute>
                        </xsl:element>
                </xsl:if>
                <xsl:apply-templates/><br/>
        </xsl:template>
        <!-- image -->
        <xsl:template match="fb:image" name="image">
                <div align="center">
                        <img border="1">
                                <xsl:choose>
                                        <xsl:when test="starts-with(@xlink:href,'#')">
                                                <xsl:attribute name="src"><xsl:text>data:</xsl:text><xsl:variable name="href" select="substring-after(@xlink:href,'#')" /><set variable="href" expression="substring-after(@xlink:href,'#')"/><xsl:value-of select="//fb:binary[@id=$href]/@content-type" disable-output-escaping="yes" /><xsl:text>;base64,</xsl:text><!--<xsl:value-of select="substring-after(@xlink:href,'#')"/>--><xsl:value-of select="//fb:binary[@id=$href]"  disable-output-escaping="yes"/></xsl:attribute>

                                        </xsl:when>
                                        <xsl:otherwise>
                                                <xsl:attribute name="src"><xsl:value-of select="@xlink:href"/></xsl:attribute>
                                        </xsl:otherwise>
                                </xsl:choose>
                        </img>
                </div>
        </xsl:template>
</xsl:stylesheet>

Далее, например, так:
zcat book.fb2.zip | xsltproc fb2_22_xhtml.xsl - | lynx -force_html -stdin -dump -nolist | less

пятница, 3 октября 2014 г.

Как получить список поддоменов доменного имени?

Возник вопрос, а как можно получить список всех поддоменов доменного имени?
Наприме, возьмём два домена ukrhub.net и olden.org.ua - какие тут есть поддомены третьего и четвёртого уровней, соответственно?
Для ответа на поставленный вопрос нам потребуется два инструмента - whois и dig.
Для начала через whois узнаем нейм-сервера зон:
~$ whois ukrhub.net | awk '$1~/^Name$/ && $2~/^Server:$/ { print $3 }' | sort -u
NS190.UKRHUB.NET
NS94.UKRHUB.NET
~$ whois olden.org.ua | awk '$1~/^nserver:/ { print $2 }' | sort -u
ns2.olden.org.ua
ns.olden.org.ua

Далее к нейм-серверам зон через dig отсылаем запрос axfr:
~$ dig @ns2.olden.org.ua olden.org.ua +multiline +nottlid -t axfr

; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> @ns2.olden.org.ua olden.org.ua +multiline +nottlid -t axfr
; (1 server found)
;; global options: +cmd
olden.org.ua.           IN SOA  olden.org.ua. oldengremlin.gmail.com. (
                                2014042900 ; serial
                                86400      ; refresh (1 day)
                                7200       ; retry (2 hours)
                                3600000    ; expire (5 weeks 6 days 16 hours)
                                172800     ; minimum (2 days)
                                )
olden.org.ua.           IN NS   ns.olden.org.ua.
... 8< skip-skip 8< ...
www.olden.org.ua.       IN CNAME olden.org.ua.
olden.org.ua.           IN SOA  olden.org.ua. oldengremlin.gmail.com. (
                                2014042900 ; serial
                                86400      ; refresh (1 day)
                                7200       ; retry (2 hours)
                                3600000    ; expire (5 weeks 6 days 16 hours)
                                172800     ; minimum (2 days)
                                )
;; Query time: 1 msec
;; SERVER: 212.90.160.2#53(212.90.160.2)
;; WHEN: Fri Oct  3 09:25:59 2014
;; XFR size: 22 records (messages 1, bytes 554)

~$ dig @ns.ukrhub.net ukrhub.net +multiline +nottlid -t axfr

; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> @ns.ukrhub.net ukrhub.net +multiline +nottlid -t axfr
; (1 server found)
;; global options: +cmd
ukrhub.net.             IN SOA  ns94.ukrhub.net. hostmaster.ukrhub.net. (
                                2014093000 ; serial
                                3600       ; refresh (1 hour)
                                1800       ; retry (30 minutes)
                                1209600    ; expire (2 weeks)
                                7200       ; minimum (2 hours)
                                )
ukrhub.net.             IN NS   ns94.ukrhub.net.
... 8< skip-skip 8< ...
zemkadast-nop.ukrhub.net. IN A  212.90.170.202
ukrhub.net.             IN SOA  ns94.ukrhub.net. hostmaster.ukrhub.net. (
                                2014093000 ; serial
                                3600       ; refresh (1 hour)
                                1800       ; retry (30 minutes)
                                1209600    ; expire (2 weeks)
                                7200       ; minimum (2 hours)
                                )
;; Query time: 15 msec
;; SERVER: 212.90.160.2#53(212.90.160.2)
;; WHEN: Fri Oct  3 09:29:33 2014
;; XFR size: 944 records (messages 1, bytes 24617)

Однако тут же отмечу, что использовать запрос axfr выйдет не для всех зон. Почему? Да потому, что по большому счёту он открывает путь к "уязвимости" известной как Valve и системными администраторами, которым не чужда информационная безопасность, фиксится - трансфер зон разрешается лишь для доверенных ip. К примеру, попытка axfr запросов для доменов xda-developers.com, fb.com и vk.com, в той или иной степени, будут не успешными и список поддоменов таким образом нам получить не получится:
~$ DOMAIN=xda-developers.com; for NS in $( whois ${DOMAIN} | awk '$1~/^Name$/ && $2~/^Server:$/ { print $3 }' | sort -u ); do dig @${NS} ${DOMAIN}  +multiline +nottlid -t axfr; done

; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> @NS1.XDA-DEVELOPERS.COM xda-developers.com +multiline +nottlid -t axfr
; (1 server found)
;; global options: +cmd
; Transfer failed.

; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> @NS2.XDA-DEVELOPERS.COM xda-developers.com +multiline +nottlid -t axfr
; (1 server found)
;; global options: +cmd
; Transfer failed.

; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> @NS3.XDA-DEVELOPERS.COM xda-developers.com +multiline +nottlid -t axfr
; (1 server found)
;; global options: +cmd
; Transfer failed.

~$ DOMAIN=fb.com; for NS in $( whois ${DOMAIN} | awk '$1~/^Name$/ && $2~/^Server:$/ { print $3 }' | sort -u ); do dig @${NS} ${DOMAIN}  +multiline +nottlid -t axfr; done
;; Connection to 69.171.239.12#53(69.171.239.12) for fb.com failed: connection refused.
;; Connection to 69.171.239.12#53(69.171.239.12) for fb.com failed: connection refused.
;; Connection to 69.171.255.12#53(69.171.255.12) for fb.com failed: connection refused.
;; Connection to 69.171.255.12#53(69.171.255.12) for fb.com failed: connection refused.

~$ DOMAIN=vk.com; for NS in $( whois ${DOMAIN} | awk '$1~/^Name$/ && $2~/^Server:$/ { print $3 }' | sort -u ); do dig @${NS} ${DOMAIN}  +multiline +nottlid -t axfr; done

; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> @NS1.VKONTAKTE.RU vk.com +multiline +nottlid -t axfr
; (2 servers found)
;; global options: +cmd
vk.com.                 IN SOA  ns1.vkontakte.ru. ncc.vkontakte.ru. (
                                2014093001 ; serial
                                3600       ; refresh (1 hour)
                                900        ; retry (15 minutes)
                                604800     ; expire (1 week)
                                900        ; minimum (15 minutes)
                                )
; Transfer failed.

; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> @NS2.VKONTAKTE.RU vk.com +multiline +nottlid -t axfr
; (2 servers found)
;; global options: +cmd
vk.com.                 IN SOA  ns1.vkontakte.ru. ncc.vkontakte.ru. (
                                2014093001 ; serial
                                3600       ; refresh (1 hour)
                                900        ; retry (15 minutes)
                                604800     ; expire (1 week)
                                900        ; minimum (15 minutes)
                                )
; Transfer failed.

; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> @NS3.VKONTAKTE.RU vk.com +multiline +nottlid -t axfr
; (2 servers found)
;; global options: +cmd
vk.com.                 IN SOA  ns1.vkontakte.ru. ncc.vkontakte.ru. (
                                2014093001 ; serial
                                3600       ; refresh (1 hour)
                                900        ; retry (15 minutes)
                                604800     ; expire (1 week)
                                900        ; minimum (15 minutes)
                                )
; Transfer failed.

; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> @NS4.VKONTAKTE.RU vk.com +multiline +nottlid -t axfr
; (2 servers found)
;; global options: +cmd
vk.com.                 IN SOA  ns1.vkontakte.ru. ncc.vkontakte.ru. (
                                2014093001 ; serial
                                3600       ; refresh (1 hour)
                                900        ; retry (15 minutes)
                                604800     ; expire (1 week)
                                900        ; minimum (15 minutes)
                                )
; Transfer failed.

А вот попытка "выстрелить" по доменам tlc.ks.ua, unio.kherson.ua и plusnet.ks.ua оказалась вполне успешной:
~$ for DOMAIN in tlc.ks.ua unio.kherson.ua plusnet.ks.ua; do for NS in $( whois ${DOMAIN} | awk '$1~/^nserver:/ { print $2 }' | sort -u ); do dig @${NS} ${DOMAIN}  +multiline +nottlid -t axfr; done; done

; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> @ns01.tlc.ks.ua tlc.ks.ua +multiline +nottlid -t axfr
; (2 servers found)
;; global options: +cmd
tlc.ks.ua.              IN SOA  virtual2.ks-host.com. support.ks-host.com. (
                                2014082507 ; serial
                                10800      ; refresh (3 hours)
                                3600       ; retry (1 hour)
                                604800     ; expire (1 week)
                                86400      ; minimum (1 day)
                                )
tlc.ks.ua.              IN TXT  "v=spf1 ip4:62.149.13.45 a mx ~all"
tlc.ks.ua.              IN NS   ns01.tlc.ks.ua.
tlc.ks.ua.              IN NS   ns02.tlc.ks.ua.
tlc.ks.ua.              IN NS   ns03.tlc.ks.ua.
tlc.ks.ua.              IN MX   10 mail.tlc.ks.ua.
tlc.ks.ua.              IN A    62.149.13.45
ftp.tlc.ks.ua.          IN A    62.149.13.45
imap.tlc.ks.ua.         IN A    62.149.13.45
mail.tlc.ks.ua.         IN A    62.149.13.45
ns01.tlc.ks.ua.         IN AAAA 2a03:6300:1:12::13:45
ns01.tlc.ks.ua.         IN A    62.149.13.45
ns02.tlc.ks.ua.         IN A    77.120.125.20
ns03.tlc.ks.ua.         IN AAAA 2001:1608:10:38::87b0:f63a
ns03.tlc.ks.ua.         IN A    84.200.213.106
pop.tlc.ks.ua.          IN A    62.149.13.45
smtp.tlc.ks.ua.         IN A    62.149.13.45
www.tlc.ks.ua.          IN A    195.38.16.2
tlc.ks.ua.              IN SOA  virtual2.ks-host.com. support.ks-host.com. (
                                2014082507 ; serial
                                10800      ; refresh (3 hours)
                                3600       ; retry (1 hour)
                                604800     ; expire (1 week)
                                86400      ; minimum (1 day)
                                )
;; Query time: 1 msec
;; SERVER: 62.149.13.45#53(62.149.13.45)
;; WHEN: Fri Oct  3 09:50:45 2014
;; XFR size: 19 records (messages 1, bytes 489)


; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> @ns02.tlc.ks.ua tlc.ks.ua +multiline +nottlid -t axfr
; (1 server found)
;; global options: +cmd
; Transfer failed.

; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> @ns03.tlc.ks.ua tlc.ks.ua +multiline +nottlid -t axfr
; (2 servers found)
;; global options: +cmd
; Transfer failed.

; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> @ns02.ks-host.com.ua unio.kherson.ua +multiline +nottlid -t axfr
; (1 server found)
;; global options: +cmd
; Transfer failed.

; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> @ns03.ks-host.com.ua unio.kherson.ua +multiline +nottlid -t axfr
; (2 servers found)
;; global options: +cmd
; Transfer failed.

; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> @ns04.ks-host.com.ua unio.kherson.ua +multiline +nottlid -t axfr
; (2 servers found)
;; global options: +cmd
unio.kherson.ua.        IN SOA  virtual2.ks-host.com. support.ks-host.com. (
                                2014091001 ; serial
                                10800      ; refresh (3 hours)
                                3600       ; retry (1 hour)
                                604800     ; expire (1 week)
                                86400      ; minimum (1 day)
                                )
unio.kherson.ua.        IN TXT  "v=spf1 ip4:62.149.13.45 a mx ~all"
unio.kherson.ua.        IN NS   ns02.ks-host.com.ua.
unio.kherson.ua.        IN NS   ns03.ks-host.com.ua.
unio.kherson.ua.        IN NS   ns04.ks-host.com.ua.
unio.kherson.ua.        IN MX   10 mail.unio.kherson.ua.
unio.kherson.ua.        IN A    62.149.13.45
ftp.unio.kherson.ua.    IN A    62.149.13.45
mail.unio.kherson.ua.   IN A    62.149.13.45
pop.unio.kherson.ua.    IN A    62.149.13.45
smtp.unio.kherson.ua.   IN A    62.149.13.45
www.unio.kherson.ua.    IN A    62.149.13.45
unio.kherson.ua.        IN SOA  virtual2.ks-host.com. support.ks-host.com. (
                                2014091001 ; serial
                                10800      ; refresh (3 hours)
                                3600       ; retry (1 hour)
                                604800     ; expire (1 week)
                                86400      ; minimum (1 day)
                                )
;; Query time: 1 msec
;; SERVER: 62.149.13.45#53(62.149.13.45)
;; WHEN: Fri Oct  3 09:50:45 2014
;; XFR size: 13 records (messages 1, bytes 382)

;; Connection to 77.121.4.19#53(77.121.4.19) for plusnet.ks.ua failed: timed out.

; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> @ns.plusnet.ks.ua plusnet.ks.ua +multiline +nottlid -t axfr
; (1 server found)
;; global options: +cmd
plusnet.ks.ua.          IN SOA  plusnet.ks.ua. hostmaster.plusnet.ks.ua. (
                                2013102200 ; serial
                                86400      ; refresh (1 day)
                                7200       ; retry (2 hours)
                                3600000    ; expire (5 weeks 6 days 16 hours)
                                172800     ; minimum (2 days)
                                )
plusnet.ks.ua.          IN NS   ns.plusnet.ks.ua.
plusnet.ks.ua.          IN NS   ns2.plusnet.ks.ua.
plusnet.ks.ua.          IN MX   10 mail.plusnet.ks.ua.
plusnet.ks.ua.          IN A    77.121.4.50
*.plusnet.ks.ua.        IN A    77.121.4.50
clan.plusnet.ks.ua.     IN A    77.121.4.50
cs.plusnet.ks.ua.       IN A    77.121.4.50
ban.cs.plusnet.ks.ua.   IN A    77.121.4.50
data.cs.plusnet.ks.ua.  IN A    77.121.4.50
datasvit.cs.plusnet.ks.ua. IN A 77.121.4.50
forum.cs.plusnet.ks.ua. IN A    77.121.4.50
gungame.cs.plusnet.ks.ua. IN A  77.121.4.50
monitor.cs.plusnet.ks.ua. IN A  77.121.4.50
plusnet.cs.plusnet.ks.ua. IN A  77.121.4.50
stats.cs.plusnet.ks.ua. IN A    77.121.4.50
ftp.plusnet.ks.ua.      IN CNAME plusnet.ks.ua.
localhost.plusnet.ks.ua. IN A   127.0.0.1
m.plusnet.ks.ua.        IN A    93.79.167.142
mail.plusnet.ks.ua.     IN A    77.121.4.50
ns.plusnet.ks.ua.       IN A    77.121.4.50
ns2.plusnet.ks.ua.      IN A    77.121.4.19
rc.plusnet.ks.ua.       IN A    77.121.4.50
ts.plusnet.ks.ua.       IN A    77.121.4.50
vik.plusnet.ks.ua.      IN A    77.121.4.50
www.plusnet.ks.ua.      IN CNAME plusnet.ks.ua.
plusnet.ks.ua.          IN SOA  plusnet.ks.ua. hostmaster.plusnet.ks.ua. (
                                2013102200 ; serial
                                86400      ; refresh (1 day)
                                7200       ; retry (2 hours)
                                3600000    ; expire (5 weeks 6 days 16 hours)
                                172800     ; minimum (2 days)
                                )
;; Query time: 108 msec
;; SERVER: 77.121.4.50#53(77.121.4.50)
;; WHEN: Fri Oct  3 09:50:53 2014
;; XFR size: 27 records (messages 1, bytes 612)