meejah / carml

Command-line utility to control Tor.
http://tvflhlyx7o5qsl6a2v6pvzwripzzvzgt32tkhfbys7tj3zrm4faz53yd.onion/
The Unlicense
88 stars 12 forks source link

filter streams per SOURCE_ADDR #52

Open nyxnor opened 2 years ago

nyxnor commented 2 years ago

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, orfrom 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

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
meejah commented 2 years ago

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)

nyxnor commented 2 years ago

sounds good for me