netfilter.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Born Without <blackhole@airpost.net>
Cc: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>,
	Jan Engelhardt <jengelh@inai.de>,
	"netfilter@vger.kernel.org" <netfilter@vger.kernel.org>
Subject: Re: Wrapper script for ipset listing
Date: Wed, 9 Jan 2013 12:52:32 +0100	[thread overview]
Message-ID: <20130109115232.GA19321@1984> (raw)
In-Reply-To: <50ED13BC.6010005@airpost.net>

On Wed, Jan 09, 2013 at 07:52:44AM +0100, Born Without wrote:
> On 07.01.2013 08:59, Jozsef Kadlecsik wrote:
> >On Sun, 6 Jan 2013, Jan Engelhardt wrote:
> >
> >>On Sunday 2013-01-06 04:50, Born Without wrote:
> >>>>>As I was missing those features in the ipset set listing capabilities:
> >>>>>
> >>>>>- show sum of set members
> >>>>>- suppress listing of headers
> >>>>>- choose a delimiter character for separating member entries
> >>>>>
> >>>>>I wrote a little wrapper script (for the bash shell) to support them.
> >>>>>For those who like, you'll find it attached.
> >>>>
> >>>>There's libipset, with which this task should be achievable to the
> >>>>maximum customizable degree without involving ugly text parsing with sh.
> >>>
> >>>good you mention libipset, because not even the man page does, nor does any
> >>>documentation or similar exist.
> >>
> >>I have taken Joszef into Cc..
> 
> [...]
> 
> >
> >In order to parse the output produced by ipset, one should take into
> >account the followings:
> >
> >- New header elements may appear but the header part is always
> >   started by "Name:" and ended by "Members:".
> >- New value parameters may appear but those are appended to the existing
> >   ones.
> >
> >If those "rules" are taken into account, then shell/perl/etc scripts can
> >safely parse the output.
> >
> 
> Thank you Joszef for that information.
> I've taken it into account and adapted the script.
> Also added:
> -a parameter to act just like 'ipset list', but with whitespace as
> default delim.
> comments and examples.
> 
> Best regards

> #!/bin/bash

Suggestion: Some explicit header with licensing terms of your script
is a good idea if you want to share things, otherwise the law in most
countries defaults to "all right reserved".

And if you use the same license than ipset, it may help Jozsef to
consider adding that to some contrib directory. Or you can just
publish it in your personal website.

  reply	other threads:[~2013-01-09 11:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-05 16:05 Wrapper script for ipset listing Born Without
2013-01-05 16:16 ` Born Without
2013-01-06  4:54   ` Born Without
2013-01-05 17:10 ` Jan Engelhardt
2013-01-06  3:50   ` Born Without
2013-01-06 20:06     ` Jan Engelhardt
2013-01-07  7:59       ` Jozsef Kadlecsik
2013-01-09  6:52         ` Born Without
2013-01-09 11:52           ` Pablo Neira Ayuso [this message]
2013-01-10 12:53             ` Born Without
2013-01-10 15:01               ` Eliezer Croitoru
2013-01-10 21:18                 ` Born Without
2013-01-10 15:19               ` Jozsef Kadlecsik
2013-01-10 21:15                 ` Born Without
2013-01-10 21:37                   ` Born Without
2013-01-11  8:19             ` Born Without
2013-01-21  8:31             ` Born Without
2013-01-21  8:55               ` Jozsef Kadlecsik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130109115232.GA19321@1984 \
    --to=pablo@netfilter.org \
    --cc=blackhole@airpost.net \
    --cc=jengelh@inai.de \
    --cc=kadlec@blackhole.kfki.hu \
    --cc=netfilter@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).