blocking Popups with Bind

Francisco J. Obispo S. (CNTI-REACCIUN) fobispo at nic.ve
Wed Sep 19 21:30:24 UTC 2001


you have to make sure there are only domain names in that file
otherwhile you'll zones that might look like

zone "http://www.google.com"{
	type master;
	file "http://www.google.com.db";
};


you can try the perl way.

#!/usr/bin/perl

while(<STDIN>){
	next if m/^\s*$/g;
	m/(\S+:\/\/)*(.*?)(:\d+)*(\/.*?)*$/g;

	print "zone \"" . $2 . "\"{\n\ttype master\;\n\tfile \"" . $2 . ".db\"\;\n}\;\n";

}


this will print out the server name regardless if you pass it as:
http://www.google.com
www.google.com
http://www.google.com/somefile.html
http://www.google.com:80
www.google.com:80/somefile
etc
etc
etc
etc

save it in a file and chmod +x it 
and pass as STDIN the file list, for example:

in BASH:

for i in `cat urls.txt`
do ./process.pl < $i >> new_named.conf
done


look at new_named.conf and you'll have all the zones


--- good luck









On Wed, Sep 19, 2001 at 08:37:56PM +0000, Barry Margolin wrote:
> To: comp-protocols-dns-bind at moderators.isc.org
> From: Barry Margolin <barmar at genuity.net>
> Newsgroups: comp.protocols.dns.bind
> Subject: Re: blocking Popups with Bind
> Organization: Genuity, Cambridge, MA
> Mail-Copies-To: never
> Originator: barmar at genuity.net (Barry Margolin)
> NNTP-Posting-Date: Wed, 19 Sep 2001 20:37:56 GMT
> Distribution: world
> Date: Wed, 19 Sep 2001 20:37:56 GMT
> List-unsubscribe: <mailto:bind-users-request at isc.org?Subject=unsubscribe>
> 
> In article <9oauba$g1b at pub3.rc.vix.com>, Frank <duranicub at gmx.net> wrote:
> >Ok it works but the Ouptut is right so ?
> 
> No, the output is wrong.  I suspect you left out some of the backslashes,
> so the quoting is all messed up.
> 
> Here's another way to write the script.  Put this in a file, make it
> executable with chmod, and then execute it.
> 
> #!/bin/sh
> while read i
> do
>   cat <<EOF
> zone "$i" {
>     type master;
>     file "$i.db";
> };
> EOF
> done < url.list
> 
> -- 
> Barry Margolin, barmar at genuity.net
> Genuity, Woburn, MA
> *** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
> Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
> 

-- 

/////////////////////////////////////////////
     _____   _____
    /  __/   \_   \
   /  /  ___   \   \
   \  \__\_ \   \   \
    \____\ \ \   )   )
         __/ /  /   /
         \__/ _/   /
  CNTI       /____/

Centro Nacional de Tecnologias de Informacion
/////////////////////////////////////////////

Francisco J. Obispo
Administrador de Servicios de Internet
*Internet Services Administrator*
fobispo at reacciun.ve

Thought of the day:

Any fool can paint a picture, but it takes a wise person to be able to sell it.


More information about the bind-users mailing list