I want to do strange thing. I write a custom application (distributed forums node) that will run on the same computer with TorBrowser and use tor process to create temporary hidden service and serve HTTP from it. Also it will perform outgoing connections to speak other nodes. Outgoing connections work perfectly (I just send socks4a header to localhost:9150, receive response and proceed as normal tcp connection).
Hard part is to make my application talk to control port to create hidden service without manually editing torrc.
Tor control port requires authentication. torrc needs to be edited to add hashed password or authentication cookie file.
I want to make easy-to-setup application and I don't want to ask user to find torrc file and edit it manually. It must be done different way.
What is the right way to go here? Should I ask user to edit torrc file of TorBrowser to make my application talk to tor control port?
Is it possible for my application to handle this without user interaction?
Is it acceptable to edit torrc file automatically from my application?
TorBrowser uses tor control port to retrieve circuit details that user may see in torButton for each site. Is it possible to use the same authentication method in my application and use same password? If TorBrowser uses cookie file, can I sniff contents of this file and use it to authenticate?
Is there authentication cookie file somewhere in the TorBrowser directory, that other applications can use to talk to control port?
My programming language is C and application will run on Windows.
UPD: Short question: Is it acceptable behavior to edit torrc configuration file automatically? Can I avoid torrc editing and still be able somehow to authenticate to tor control port?