How to see how much data (in Mo for download/upload) was sent through my Tor usage? I know that tor.exe in windows says how much data was sent if the connection is re-established, but does it store it somewhere? And I don't know how to look up this in Linux (which I'm using right now).
This is already a built in feature in the anonymizing relay monitor (Arm) which provides real time statistics for:
- bandwidth (upload/download), cpu and memory usage
- relay's current configuration
- logged events connection details (ip, hostname, fingerprint, and consensus data)
(Picture above for the case of a relay, but it also works for a client)
This will provide the traffic read and written by the Tor daemon since it was last launched.
from stem.control import Controller with Controller.from_port(port = 9051) as controller: controller.authenticate() # provide the password here if you set one bytes_read = controller.get_info("traffic/read") bytes_written = controller.get_info("traffic/written") print("My Tor relay has read %s bytes and written %s." % (bytes_read, bytes_written))
While it explicitly states relay, which is it's example use case, this also applies to clients. The above script assumes that Tor is running a control port on 9051/tcp on localhost.