Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Add membership operator support #1040

Open
cjmaynard opened this issue Aug 3, 2021 · 3 comments
Open

Enhancement: Add membership operator support #1040

cjmaynard opened this issue Aug 3, 2021 · 3 comments

Comments

@cjmaynard
Copy link

Wireshark supports a membership operator as part of its display filter syntax. A couple of examples from the wireshark-filter man page:

tcp.port in {80 443 8080}  
ip.addr in {10.0.0.5 .. 10.0.0.9 192.168.1.1..192.168.1.9}  

It would be nice if a similar operator were supported for capture filters, e.g.,

tcp port in {80 443 8080}  
host in {10.0.0.5 .. 10.0.0.9 192.168.1.1..192.168.1.9}  

... or perhaps in a format like this:

tcp port in {80,443,8080}  
host in {10.0.0.5-10.0.0.9,192.168.1.1-192.168.1.9}  

... or in whatever format best fits with pcap-filter syntax.

@infrastation
Copy link
Member

The first example is quite straightforward:

tcp port 80 or 443 or 8080

The second example might potentially be implementable by means of a new hostrange type, but unlike the existing portrange type the dashes and the hyphens would likely get in the way a lot, given they already appear in IPv4 addresses and hostnames.

@infrastation
Copy link
Member

See also #815.

@infrastation
Copy link
Member

One potential (did not test!) way to implement both features could be extending the existing ATM and MTP fields syntax onto port and host, and treating an IP address an an unsigned integer in this context. This would mean that the set membership would be straightforward and the ranges would be not as straightforward, but comprehensible. For example, the expressions above would be as follows:

tcp port (80 or 443 or 8080)

(ip host >= 10.0.0.5 and ip host <= 10.0.0.9) or (ip host >= 192.168.1.1 and ip host <= 192.168.1.9)

An advantage of this approach would be being a superset of the existing syntax (e.g. ip host 192.168.1.9 would be an abbreviation of ip host == 192.168.1.9). It seems worth prototyping if there is time for that, but before committing the new feature it would be useful to understand how many users actually need it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants