Module Expr Str Import alias Import alias Import alias Import alias Import alias identifier Assign NameStore Call AttributeLoad NameLoad attr ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str If NameLoad body Assign AttributeStore NameLoad attr NameLoad orelse Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Lambda arguments args defaults Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assert CompareLtELt AttributeLoad NameLoad attr NameLoad BinOpAdd AttributeLoad NameLoad attr AttributeLoad NameLoad attr BinOpMod Str NameLoad If CompareGt NameLoad AttributeLoad NameLoad attr body Assign NameStore ListLoad Call AttributeLoad NameLoad attr Str keyword BinOpSub Num AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str keyword BinOpSub BinOpSub NameLoad Num AttributeLoad NameLoad attr orelse Assign NameStore ListLoad Call AttributeLoad NameLoad attr Str keyword BinOpSub NameLoad AttributeLoad NameLoad attr Assign NameStore ListComp Call AttributeLoad NameLoad attr NameLoad NameLoad comprehension NameStore NameLoad Return Call AttributeLoad Str attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore BinOpMod NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr If CompareGtE NameLoad NameLoad body Assign NameStore BinOpSub NameLoad NameLoad orelse Assign NameStore BinOpAdd BinOpSub AttributeLoad NameLoad attr NameLoad NameLoad If CompareLt NameLoad AttributeLoad NameLoad attr body AugAssignAdd NameStore AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad BinOpMod NameLoad AttributeLoad NameLoad attr NameLoad NameLoad Return NameLoad decorator_list decorator_list Assign NameStore NameLoad
N/A N/A 
Provides code to morph a chunk of data to a given probability distribution.

The class provides an interface to morph a network packet's length to a
previously generated probability distribution.  The packet lengths of the
morphed network data should then match the probability distribution.
 N/A random N/A message N/A probdist N/A const N/A obfsproxy.common.log logging N/A log N/A N/A logging get_obfslogger PacketMorpher N/A object N/A N/A 
    Implements methods to morph data to a target probability distribution.

    This class is used to modify ScrambleSuit's packet length distribution on
    the wire.  The class provides a method to determine the padding for packets
    smaller than the MTU.
     __init__ N/A N/A self dist N/A None N/A N/A 
        Initialise the packet morpher with the given distribution `dist'.

        If `dist' is `None', a new discrete probability distribution is
        generated randomly.
         N/A dist N/A N/A N/A self dist dist N/A N/A N/A self dist N/A N/A probdist new N/A N/A N/A N/A N/A N/A random randint N/A const HDR_LENGTH N/A const MTU N/A getPadding N/A N/A self sendCrypter sendHMAC dataLen N/A N/A N/A 
        Based on the burst's size, return a ready-to-send padding blurb.
         N/A padLen N/A N/A self calcPadding dataLen N/A N/A N/A const HDR_LENGTH padLen N/A N/A const MTU N/A const HDR_LENGTH N/A Invalid padding length %d. padLen N/A N/A padLen N/A const MTU N/A N/A padMsgs N/A N/A N/A message new paddingLen N/A 700 N/A const HDR_LENGTH N/A N/A message new paddingLen N/A N/A padLen 700 N/A const HDR_LENGTH N/A N/A padMsgs N/A N/A N/A message new paddingLen N/A padLen N/A const HDR_LENGTH N/A blurbs N/A N/A N/A msg encryptAndHMAC sendCrypter sendHMAC N/A msg padMsgs N/A N/A N/A join blurbs N/A calcPadding N/A N/A self dataLen N/A N/A N/A 
        Based on `dataLen', determine and return a burst's padding.

        ScrambleSuit morphs the last packet in a burst, i.e., packets which
        don't fill the link's MTU.  This is done by drawing a random sample
        from our probability distribution which is used to determine and return
        the padding for such packets.  This effectively gets rid of Tor's
        586-byte signature.
         N/A dataLen N/A dataLen N/A const MTU N/A sampleLen N/A N/A N/A self dist randomSample N/A N/A sampleLen dataLen N/A N/A padLen N/A sampleLen dataLen N/A N/A padLen N/A N/A N/A const MTU dataLen sampleLen N/A N/A padLen N/A const HDR_LENGTH N/A N/A padLen N/A const MTU N/A N/A N/A log debug N/A Morphing the last %d-byte packet to %d bytes by adding %d bytes of padding. N/A N/A dataLen N/A const MTU sampleLen padLen N/A padLen N/A N/A N/A new PacketMorpher