1

So I have currently setup a hidden service to give me an onion address and the port it runs off is port 80 or 443. For some cybersecurity research I'm doing, I was initially going to setup an exit node however there's so many issues with monitoring-related studies, that the hidden service is my next best option - since I'm only monitoring myself. I do this as follows:

HiddenServiceDir /usr/local/etc/tor/hidden_service/robot
HiddenServicePort 443 127.0.0.1:443
HiddenServicePort 80 127.0.0.1:80

I have some TLS pcap data which I was planning on replaying to understand the impact of Tor in my use case, and monitoring the incoming data on the host (another machine of mine) running the hidden service to capture the "tor" packets.

My question is, how can I use Python (as an example, as I can use ScaPy for TLS replaying) for sending the data to the hidden service (i.e. socks?) so I can then monitor the incoming data on the hidden service machine using Wireshark?

Thanks!

2 Answers 2

1

I would have your python script call torsocks curl and let curl do the hard work of connecting to the onion service rather than trying to code the same thing in python.

For example:

torsocks curl https://check.torproject.org | grep browser

will confirm that curl is working with Tor.

If you have something like a RESTful API, you can use curl PUT commands to send requests to the onion service.

If you specifically need to know how to do this directly with Python, then that's more of a Python programming question than a Tor question. I would research how to use a socks5 proxy with your Python script and then just use the Socks proxy that the Tor daemon provides.

0

Tor is just a SOCKS5s or HTTPS+DNS proxy, you're free to use anything - and you don't need any kind of an external tool like torsocks or proxychains

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.