All of lore.kernel.org
 help / color / mirror / Atom feed
From: Born Without <blackhole@airpost.net>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>,
	Eliezer Croitoru <eliezer@ngtech.co.il>,
	"netfilter@vger.kernel.org" <netfilter@vger.kernel.org>
Subject: Re: Wrapper script for ipset listing
Date: Mon, 21 Jan 2013 09:31:39 +0100	[thread overview]
Message-ID: <50FCFCEB.5020704@airpost.net> (raw)
In-Reply-To: <20130109115232.GA19321@1984>

[...]
>>>>>>> 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.
[...]

Good day everybody!

over the past two weeks I kept having ideas and implementing them.
The functional additions are:

- show sets which match an arithmetic comparison (==|!=|<|>|<=|>=) on 
the sum of their elements.

- match on any header entry using an (ext)glob pattern. multiple 
selections are ANDed and only sets containing all patterns are displayed.

- allow arithmetic comparison on any header with an integer value. 
multiple selections are ANDed and only sets containing all patterns are 
displayed.

- match on set elements using either a (ext)glob, or a regex (=~ 
operator) pattern. Sum of matches can be displayed with the -c option.

- added some shortcut options to match on header entries:
    -Ht   - match on set type.
    -Hr   - match on number of references.
    -Hs   - match on size in memory.
    -Hv   - match on the revision number.


I hope those features can be considered useful. opinions welcome.
Now I'm running out of ideas, so if anybody has some, I'll be gladly 
considering any input.

I also reworked the help text (-h). But I've never done this before, so 
I'm not sure if it's accurate and understandable. I'll paste it here, 
maybe somebody here can tell me if I did something wrong.

./ipset_list -h

  ipset set listing wrapper script

ipset_list [option [opt-arg]] [set-name] [...]

ipset_list -h | -n
ipset_list -t [-c] [-Mc [!|<|>|<=|>=]value]
         [-Fh header-glob:value-glob] [...]
         [-Fi header-glob:[!|<|>|<=|>=]value] [...] [-Ht type-glob]
         [-Hr|-Hs|-Hv [!|<|>|<=|>=]value] [set-name] [...]
ipset_list -i [-r|-s] [-d char] [-Fg|-Fr pattern] set-name
ipset_list [-a|-c|-m|-r|-s] [-d char] [-Mc [!|<|>|<=|>=]value]
         [-Fh header-glob:value-glob] [...]
         [-Fi header-glob:[!|<|>|<=|>=]value] [...]
         [-Fg|-Fr pattern] [-Ht type-glob]
         [-Hr|-Hs|-Hv [!|<|>|<=|>=]value] [set-name] [...]

options:
-a       show all information but with default delim (whitespace).
-c       calculate members and match (-Fg|-Fr) sum.
-d delim       delimiter character for separating member entries.
-h       show this help text.
-i       show only the members of a single set.
-m       show set members.
-n       show set names only (raw `ipset list -n' output).
-r       try to resolve ip addresses in the output (slow!).
-s       print elements sorted (if supported by the set type).
-t       show set headers only.
-v       version information.

-Fg pattern    match set members using a [ext]glob pattern.
-Fr pattern    match set members using a regex (=~ operator) pattern.
-Fh header-glob:value-glob [...]
         show sets containing one or more ([ext]glob) matching headers.
-Fi header-glob:[!|<|>|<=|>=]value [...]
         compare one or more integer valued header entries.
-Ht set-type-glob         match on set type.
-Hr [!|<|>|<=|>=]value    match on number of references (value=int).
-Hs [!|<|>|<=|>=]value    match on size in memory (value=int).
-Hv [!|<|>|<=|>=]value    match on revision number (value=int).
-Mc [!|<|>|<=|>=]value    match on member count (value=int).


I hope with this and the examples in the code and on github, the 
features are well enough documented.

I've tested the script as much as I could, but sure some testers would 
be greatly welcome. So if anybody finds a bug, please let me know!

@Jozsef - please be sure to check github for eventually updated 
versions, in case you put it in /contrib for ipset release.

Code and description are here:
https://github.com/AllKind/ipset_list

Considered 'good' versions archives are here:
https://github.com/AllKind/ipset_list/tags

Thank you for your time and interest!

Best regards

  parent reply	other threads:[~2013-01-21  8:31 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
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 [this message]
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=50FCFCEB.5020704@airpost.net \
    --to=blackhole@airpost.net \
    --cc=eliezer@ngtech.co.il \
    --cc=kadlec@blackhole.kfki.hu \
    --cc=netfilter@vger.kernel.org \
    --cc=pablo@netfilter.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.