TransWikia.com

Automated script for selecting fast TOR circuit?

Tor Asked on September 28, 2021

I noticed a significant variance in bandwidth with different TOR circuits. Some are fast enough for streaming HD videos, while others take ages just loading web pages unless Javascript is deactivated. Therefore, when first launching the TOR browser, I usually keep hitting the "New Identity" button (which AFAIK builds a new circuit) until the loading time for a certain web page is reasonably short. In most cases, this takes 4-5 attempts. The difference in speed can be huge, so I always do this before streaming media or browsing script-heavy sites.

Is it possible to automatize this startup procedure, i.e. have the TOR browser start, build a circuit, gauge the bandwidth, and build a new circuit if a certain bandwidth threshold isn’t reached? Could this, for instance, be done with a Bash or Python script?

Something along the lines of:

i==0;
WHILE i < 10:
    START tor_browser
    DOWNLOAD https://blah.com/test.png
    bw = DOWNLOAD.bandwidth()
    IF bw > bw_min:    #e.g. 2 Mbps
        BREAK
    ELSE:
        QUIT tor_browser
    i++1
END

Where would one even start? Does the TOR browser have an API that can interface e.g. with Python? How does one make the browser download a file (in contrast to using curl or the like) and how measure the bandwidth? Is it something like "TOR uses a certain port and there exists a Python package that can monitor the traffic through it"?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP