Peeking out from the engine room, I’m delighted to announce Stem 1.7. A full year’s accumulation of fixes and improvements.
What is Stem, you ask? For those who aren’t familiar with it Stem is a Python library for interacting with Tor. With it you can script against your relay, descriptor data, or even write applications like Nyx.
https://stem.torproject.org/
So what’s new in this release?
ORPort Descriptor Downloads
Stem can now download descriptors through ORPorts just like Tor!
reply = stem.descriptor.remote.get_server_descriptors( endpoints = (stem.ORPort('128.31.0.34', 9101),), )
This is just the tip of the iceberg for the ORPorts capabilities we hope Stem will have. Whats next, python tor clients? Relays? Stay tuned!
stem.directory module
In collaboration with teor, Stem now provides authority and fallback directory information through our new stem.directory module…
import stem.directory COLUMN_FORMAT = '%-17s%-20s%-10s%-10s' try: authorities = stem.directory.Authority.from_remote() except IOError as exc: print('%s\n' % exc) authorities = stem.directory.Authority.from_cache() print(COLUMN_FORMAT % ('Name', 'Address', 'ORPort', 'DirPort')) for authority in authorities.values(): print(COLUMN_FORMAT % (authority.nickname, authority.address, authority.or_port, authority.dir_port))
% python demo.py Name Address ORPort DirPort maatuska 171.25.193.9 80 443 tor26 86.59.21.38 443 80 Bifroest 37.218.247.217 443 80 longclaw 199.58.81.140 443 80 dizum 194.109.206.212 443 80 bastet 204.13.164.118 443 80 gabelmoo 131.188.40.189 443 80 moria1 128.31.0.39 9101 9131 dannenberg 193.23.244.244 443 80 Faravahar 154.35.175.225 443 80
Descriptor Compression
Stem now supports Tor’s new ZSTD and LZMA compression. ZSTD and LZMA’s higher compression ratio comes at a CPU cost and are less available, so when using these to save bandwidth you should provide a fallback…
reply = stem.descriptor.remote.get_server_descriptors( compression = ( Compression.LZMA, # higher compression but often unavailable Compression.GZIP, # decent compression and always available ) )