txtorcon.util Module


class txtorcon.util.NetLocation(ipaddr)

Represents the location of an IP address, either city or country level resolution depending on what GeoIP database was loaded. If the ASN database is available you get that also.

ipaddr should be a dotted-quad


util.process_from_address(port, torstate=None)

Determines the PID from the address/port provided by using lsof and returns it as an int (or None if it couldn’t be determined). In the special case the addr is ‘(Tor_internal)’ then the PID of the Tor process (as gotten from the torstate object) is returned (or 0 if unavailable, e.g. a Tor which doesn’t implement ‘GETINFO process/pid’). In this case if no TorState instance is given, None is returned.



For every path in args, try to delete it as a file or a directory tree. Ignores deletion errors.