[tor-dev] TOR socket for P2P in Python

Martin Neuenhofen martinneuenhofen at googlemail.com
Tue Aug 16 11:45:05 UTC 2022


Dear Matt Traudt,

Thank you for your answer.

Three remarks:
1) I only found your answer coincidentally when I googled for LSAG + WOT.
It would have been very nice if you had let me know that you answered.
2) Your answer sort of only repeats what is already written on Overflow.
Since that was unhelpful to me, I had asked the question your answer refers
to.
3) Your answer leaves out all the critical bits. Just to name the very
first, which caused the beginning of this conversation: The proxy did not
work because in windows the command "tor.exe" does nothing unless using the
expert bundle. Now, play a game and try to find the download link for the
expert bundle. I have lots of other things that leave me puzzled but it
would be unsuitable to post them publicly. Please feel invited to get in
touch if you want to have a discussion on certain things that appear to me
as dramatic design flaws.

Am Do., 11. Aug. 2022 um 17:13 Uhr schrieb Martin Neuenhofen <
martinneuenhofen at googlemail.com>:

> Sorry to bother again.
> An equally good solution to replacing
>
> *client_socket = socket.socket(socket.AF_INET,
> socket.SOCK_STREAM)client_socket.connect(ip,port)*
> with a TOR solution could be via a command line interface:
> os.system("torsocketprogram -send 123.45.67.89 9000 filename.bytes") and
> os.system("torsocketprogram -recv 123.45.67.89 9000 filename.bytes").
>
> Am Do., 11. Aug. 2022 um 11:27 Uhr schrieb Martin Neuenhofen <
> martinneuenhofen at googlemail.com>:
>
>> Dear Tor Developers,
>>
>> in my application, a client connects to a server via:
>>
>> *client_socket = socket.socket(socket.AF_INET,
>> socket.SOCK_STREAM)client_socket.connect(ip,port)*
>>
>> I want to replace these two lines to create a client_socket whose IP
>> address cannot be seen by the server. The application is e-polling.
>>
>> I looked into
>>
>>    - torpy (too many timeouts),
>>    - socks (requires too much external configuration),
>>    - and I have tor installed (unknown how to use from within python).
>>
>> I just need a replacement for the two-liner code above.
>>
>> *The ideal solution:* is device & OS agnostic, portable, uses no
>> peripherals or configuration (i.e., just one pip package to install), and
>> works reliably.
>> Thus, the below torpy solution would have been ideal if it had worked
>> reliably:
>>
>> *from torpy import TorClient # pip install torpy*
>> *class Torsocket:*
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *    def __init__(self,ip,port):        self.mgr1    = TorClient()
>> self.tor     = type(self.mgr1).__enter__(self.mgr1)        self.mgr2    =
>> self.tor.create_circuit(3)        self.circuit =
>> type(self.mgr2).__enter__(self.mgr2)        self.mgr3    =
>> self.circuit.create_stream((ip,port))        self.socket  =
>> type(self.mgr3).__enter__(self.mgr3)    def send(self,data):
>> self.socket.send(data)    def recv(self,size):        return
>> self.socket.recv(size)    def __del__(self):        for bla in
>> [self.mgr3,self.mgr2,self.mgr1]: type(bla).__exit__(bla, None, None, None)*
>>
>> It replaces the two-liner from the beginning with the below one-liner
>> *client_socket = Torsocket(*server_data.server_address)*
>>
>> My questions/requests:
>> - Is torpy connected to the real tor network (or is it a little toy
>> twin)? If it is the real tor network then I will close this issue and open
>> another one.
>> - Are practical solutions available to my problem already?, and which of
>> them works best for user-friendliness?
>> - Can a pip package for a torsocket be made, as described above? i.e.,
>> something like torpy, but connecting to the real network?
>> - Can I offer anything so that the ideal solution would be crafted and
>> packaged?*
>>
>> *) If it helps, I could tell a lot about my project and how I believe it
>> is significant and will be for the greater good of people. It is a fully
>> implemented 1000LOC LSAG+WOT decentral P2P e-polling program with GUI that
>> shall return trust and sovereignty into the people's hands. The only
>> missing bit is a reliable tor connection.
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tor-dev/attachments/20220816/9d27d6a1/attachment.htm>


More information about the tor-dev mailing list