TorCtl.TorUtil
index
/data/users/mikeperry/code/SOAT/torflow-trunk-clean/TorCtl/TorUtil.py

TorUtil -- Support functions for TorCtl.py and metatroller

 
Modules
       
ConfigParser
binascii
math
os
re
socket
sys
time

 
Classes
       
BufSock
Callable
Enum
Enum2
ListenSocket

 
class BufSock
    # XXX: Exception handling
 
  Methods defined here:
__init__(self, s)
close(self)
readline(self)
write(self, s)

 
class Callable
     Methods defined here:
__init__(self, anycallable)

 
class Enum
    Defines an ordered dense name-to-number 1-1 mapping
 
  Methods defined here:
__init__(self, start, names)

 
class Enum2
    Defines an ordered sparse name-to-number 1-1 mapping
 
  Methods defined here:
__init__(self, **args)

 
class ListenSocket
    # SocketServer.TCPServer is nuts..
 
  Methods defined here:
__init__(self, listen_ip, port)
accept(self)
close(self)

 
Functions
       
escape_dots(s, translate_nl=1)
plog(level, msg)
quote(s)
s2k_check(secret, k)
DOCDOC
s2k_gen(secret, rng=None)
DOCDOC
secret_to_key(secret, s2k_specifier)
Used to generate a hashed password string. DOCDOC.
sort_list(list, key)
Sort a list by a specified key
unescape_dots(s, translate_nl=1)
urandom_rng(n)
Try to read some entropy from the platform entropy source.
zprob(z)
Returns the area under the normal curve 'to the left of' the given z value.
Thus, 
    for z<0, zprob(z) = 1-tail probability
    for z>0, 1.0-zprob(z) = 1-tail probability
    for any z, 2.0*(1.0-zprob(abs(z))) = 2-tail probability
Adapted from z.c in Gary Perlman's |Stat.
 
Usage:   lzprob(z)

 
Data
        __all__ = ['Enum', 'Enum2', 'Callable', 'sort_list', 'quote', 'escape_dots', 'unescape_dots', 'BufSock', 'secret_to_key', 'urandom_rng', 's2k_gen', 's2k_check', 'plog', 'ListenSocket', 'zprob', 'logfile', 'loglevel']
logfile = None
loglevel = 'DEBUG'