[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #14320 [Stem]: Add Tor CLI tool
#14320: Add Tor CLI tool
-----------------------------+--------------------
Reporter: federico3 | Owner: atagar
Type: enhancement | Status: new
Priority: normal | Milestone:
Component: Stem | Version:
Resolution: | Keywords:
Actual Points: | Parent ID:
Points: |
-----------------------------+--------------------
Comment (by atagar):
Hi federico3, sorry this went so long without a reply! I'd be up for
adding this to Stem if...
1. We follow a similar patter to the tor-prompt (maybe calling this tor-
hidden-service so we keep everything under a tor-* namespace?). This means
a Stem patch that follows its style, and ideally is similar to the tor-
prompt code (similar argument parsing, help output, tests). I'd be happy
to work with you on this if we want to go this route.
2. Solicit ideas from tor-dev@. I mentioned this earlier but don't think
I've seen an email.
Here's some quick thoughts from a first glance.
-----
{{{
hostname_fn = os.path.join(data_dir, dname, 'hostname')
}}}
Huh. When I added the hostname to create_hidden_service() I was sorely
tempted to include it in get_hidden_service_conf() but wasn't a great fit
due to blending tor-provided configuration data with stuff read from disk.
Right option is to have tor include the hostname in its GETCONF response
(and maybe the key too). If that's a no-go then I'd be up for having a
Stem method for getting this. For instance
'get_hidden_service_resource(hs_dir, filename)'. But expanding tor would
definitely be better since this has been a pain point for years, and would
be more reliable (*grumble* permissions *grumble*).
-----
{{{
controller, data_dir = connect()
hidden_service_dir = os.path.join(data_dir, args.name)
}}}
Just to let you know if a hidden service path is relative then it's
relative of the tor process' cwd, not its data directory. In our
create_hidden_service() we expand one of these paths...
https://gitweb.torproject.org/stem.git/tree/stem/control.py#n2303
{{{
if not os.path.isabs(hs_path):
cwd = stem.util.system.cwd(controller.get_pid(None))
if cwd:
hs_path = stem.util.system.expand_path(hs_path, cwd)
}}}
-----
{{{
ap = ArgumentParser()
...
}}}
So, this is what ArgumentParser looks like. For what it's worth here's the
pattern I used for tor-prompt and arm...
https://gitweb.torproject.org/stem.git/tree/stem/interpreter/arguments.py
Personally I like it, but I do a lot more validation and customization
than this.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/14320#comment:2>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs