carml icon indicating copy to clipboard operation
carml copied to clipboard

filter streams per SOURCE_ADDR

Open nyxnor opened this issue 1 year ago • 2 comments

Feature request

I'd like a command line option to filter streams per source_addr.

This is very useful when tor is running in a gateway and you have plenty of clients connecting to it. It makes output clearer by only showing the streams from the client you want to see.

By default, show streams from all source addresses, but if one or more are specified, then only the specified ones.

I cannot grep per source address and I don't understand why... I'm trying $ carml monitor -cga | grep "from remote \"xxx.xxx.xxx.xxx:" I'm escaping the first quote and then ending at :because the port may vary. But even if I just try to grep the patternsfrom process, or from remote`, it is not working... It doesn't print anything.

$ carml monitor -cga | grep "from process"
^CException ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
BrokenPipeError: [Errno 32] Broken pipe

  • https://stackoverflow.com/a/16865106
  • https://docs.python.org/3/library/signal.html#note-on-sigpipe

If the sigpipe issue is fixed, then maybe there is no reason for a command line option, just a nice to have.

txtorcon already knows if it is local or remote, and I like if gets the process via /proc and prints it instead of solely 127.0.0.1. So would be great to have the addition of filtering per source address.

Monitor streams: r being source address.

$ carml -cg --source-addr 10.172.20.1,10.172.20.2
$ carml -cg -r 10.172.20.1,10.172.20.2

nyxnor avatar Jul 20 '22 14:07 nyxnor

Sounds like a reasonable feature request.

I'd probably use multiple options instead of the comma (e.g. carml -cg --source-addr 10.172.20.1 --source-addr 10.172.20.2 for the first example)

meejah avatar Jul 27 '22 17:07 meejah

sounds good for me

nyxnor avatar Aug 03 '22 15:08 nyxnor