Date: Thu, 30 Mar 2017 20:19:15 -0400 From: William Dudley <wfdudley@gmail.com> To: David Mehler <dave.mehler@gmail.com> Cc: Rajarajan Rajamani <r.rajamani@gmail.com>, freebsd-questions <freebsd-questions@freebsd.org> Subject: Re: shell script guru Message-ID: <CAFsnNZL8EgYQK9u_mz4BB%2BULwo9xgsPFT%2BP-4uD4-tqHd%2Bn2QQ@mail.gmail.com> In-Reply-To: <CAPORhP6%2Bu4DpUq=9WJ9XmSHDYSJSmXaa6_o7NnVtOq=n_g0v=w@mail.gmail.com> References: <CAPORhP5ESqJL%2BkK4tfSD5t5=fnFjsCNXGdUhAjMpezq4WdjKyw@mail.gmail.com> <CADbyKk61wyYj1Jgc9daFTbXE_9s5xPLEYHa4p=KF8FhngzOQ3Q@mail.gmail.com> <CAPORhP6%2Bu4DpUq=9WJ9XmSHDYSJSmXaa6_o7NnVtOq=n_g0v=w@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
for i in "vn.zone" "uz.zone" "tm.zone" ; do wget -4 --no-proxy --no-cookies --no-cache \ http://ipdeny.com/ipblocks/data/countries/$i cat $i >>blocked_zones rm $i sleep 2 done Like that? Bill This email is free of malware because I run Linux. On Thu, Mar 30, 2017 at 8:02 PM, David Mehler <dave.mehler@gmail.com> wrote: > Hello, > > My question is regarding a shell script and pf. > > What I'm wanting to do is take a selected list of countries and cat > them in to a file and use that as pf input. Here's a sequential > example: > > #!/bin/sh > # > PATH=/bin:/usr/local/bin:/sbin > cd /tmp > mkdir zones > cd zones > # -4 = use IPv4 only > # --no-proxy = don't care for proxies > # --no-cookies = don't accept cookies > # --no-cache = no cached files > wget -4 --no-proxy --no-cookies --no-cache \ > http://ipdeny.com/ipblocks/data/countries/cn.zone # CHINA > sleep 2 > wget -4 --no-proxy --no-cookies --no-cache \ > http://ipdeny.com/ipblocks/data/countries/az.zone # AZERBAIJAN > sleep 2 > wget -4 --no-proxy --no-cookies --no-cache \ > http://ipdeny.com/ipblocks/data/countries/by.zone # BELARUS > sleep 2 > wget -4 --no-proxy --no-cookies --no-cache \ > http://ipdeny.com/ipblocks/data/countries/kz.zone # KAZAKHSTAN > sleep 2 > wget -4 --no-proxy --no-cookies --no-cache \ > http://ipdeny.com/ipblocks/data/countries/kg.zone # KYRGYZSTAN > sleep 2 > wget -4 --no-proxy --no-cookies --no-cache \ > http://ipdeny.com/ipblocks/data/countries/ru.zone # RUSSIAN > FEDERATION > sleep 2 > wget -4 --no-proxy --no-cookies --no-cache \ > http://ipdeny.com/ipblocks/data/countries/tj.zone # TAJIKISTAN > sleep 2 > wget -4 --no-proxy --no-cookies --no-cache \ > http://ipdeny.com/ipblocks/data/countries/tm.zone # TURKMENISTAN > sleep 2 > wget -4 --no-proxy --no-cookies --no-cache \ > http://ipdeny.com/ipblocks/data/countries/uz.zone # UZBEKISTAN > sleep 2 > wget -4 --no-proxy --no-cookies --no-cache \ > http://ipdeny.com/ipblocks/data/countries/vn.zone # VIET NAM > # > cat cn.zone > blocked_zones > cat az.zone >> blocked_zones > cat by.zone >> blocked_zones > cat kz.zone >> blocked_zones > cat kg.zone >> blocked_zones > cat ru.zone >> blocked_zones > cat tj.zone >> blocked_zones > cat tm.zone >> blocked_zones > cat uz.zone >> blocked_zones > cat vn.zone >> blocked_zones > # > rm *.zone > # > mv blocked_zones /etc/pf/ > pfctl -f /etc/pf.conf > > There are 250 plus zones just in the ipv4 space, and about the same in > the ipv6 space. I do not want to manually take down each domain, three > times, that's error prown and very easy to miss one. I thought about > doing an array, and feeding that to a loop which would cut down the > number of lines of repeative code. > > Help appreciated. > > Thanks. > Dave. > > > On 3/30/17, Rajarajan Rajamani <r.rajamani@gmail.com> wrote: > > Ask your question and I am sure someone will answer! > > > > On Mar 30, 2017 7:37 PM, "David Mehler" <dave.mehler@gmail.com> wrote: > > > >> Hello, > >> > >> Any shell scripting gurus here please contact me offlist. I have a > >> question that I can't figure out. > >> > >> Thanks. > >> Dave. > >> _______________________________________________ > >> freebsd-questions@freebsd.org mailing list > >> https://lists.freebsd.org/mailman/listinfo/freebsd-questions > >> To unsubscribe, send any mail to "freebsd-questions- > >> unsubscribe@freebsd.org" > >> > > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions- > unsubscribe@freebsd.org" >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFsnNZL8EgYQK9u_mz4BB%2BULwo9xgsPFT%2BP-4uD4-tqHd%2Bn2QQ>