2

All the Tor Hidden Services seem to be written in PHP or just plain HTML. If this is possible, is there any reason not to do it? How would one go about doing it?

  • 1
    No, it's just programmer preference AFAIK. You'd do it same way you'd write one in PHP; they're all just programming languages. – user194 Feb 17 '14 at 3:51
2

Yes, you can use any tools you want to run hidden services. On the Tor Project's Hidden Service setup page for Step 1 you can use any webserver stack that suits your needs.

2

You can use any programming language for a hidden service. The reason why most of the hidden services using PHP might be the same why many services in the web use PHP. ;)

Your hidden service basically needs to listen on some TCP port. This can be for instance a webserver. Your application takes the request from that webserver and does something with it. You can also use the infamous Python example: python -m SimpleHTTPServer to service sites via hidden services.

So basically you write your application like you did it using no hidden services. When you are finished, you just tell Tor to forward the requests from the hidden service to the service you are running: HiddenServicePort 80 127.0.0.1:80. Each request which arrives at port 80 of your hidden service is mapped to port 80 on your machine. So when your hidden service also has a public address and serves the same service on that address, a client will get the same answer on the public way as on the hidden service way. It does not depend on programming languages.

1

The latest txtorcon supports endpoint-strings, so you can use Twisted built-in Web server to host any WSGI Web application (and twistd comes with SystemD support too). See here:

http://txtorcon.readthedocs.org/en/latest/howtos.html#endpoints-enable-tor-with-any-twisted-service

The command-line would look something like:

twistd web --port onion:hiddenServiceDir=/tmp/something --wsgi my.app.Main

(or just "onion:80" for the port to create a new ephemeral hidden-serivce with keys in $TMP)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.