[Pkg-privacy-commits] [obfsproxy] 24/353: PEP 8 reformatting

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 13:01:34 UTC 2015


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch master
in repository obfsproxy.

commit ea2407c72378e8faab64a03c70b5d76879763f4b
Author: Brandon Wiley <brandon at blanu.net>
Date:   Wed Aug 1 16:21:19 2012 -0500

    PEP 8 reformatting
---
 src/cli.py                                 |  16 ++-
 src/obfsproxy/crypto/aes.py                |  29 +++--
 src/obfsproxy/framework/managed/client.py  |   6 +-
 src/obfsproxy/transports/base.py           |  33 +++--
 src/obfsproxy/transports/dummy.py          |  12 +-
 src/obfsproxy/transports/dust_transport.py |  45 ++++---
 src/obfsproxy/transports/obfs2.py          | 187 ++++++++++++++++++-----------
 src/obfsproxy/transports/obfs3.py          |  45 ++++---
 src/obfsproxy/transports/rot13.py          |   7 ++
 9 files changed, 250 insertions(+), 130 deletions(-)

diff --git a/src/cli.py b/src/cli.py
index e42c66c..de87145 100644
--- a/src/cli.py
+++ b/src/cli.py
@@ -5,13 +5,16 @@ import os
 import sys
 import logging
 
-logging.basicConfig(filename='/home/brandon/py-obfsproxy/pyobfslog.txt', loglevel=logging.DEBUG)
+logging.basicConfig(filename='/home/brandon/py-obfsproxy/pyobfslog.txt'
+                    , loglevel=logging.DEBUG)
 logging.error('py-obfsproxy CLI loaded')
-logging.error('argv: '+str(sys.argv))
+logging.error('argv: ' + str(sys.argv))
 
 import argparse
 
-sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__), "../../pyptlib/src")))
+sys.path.insert(0,
+                os.path.realpath(os.path.join(os.path.dirname(__file__),
+                '../../pyptlib/src')))
 
 from pyptlib.easy.util import checkClientMode
 
@@ -52,7 +55,7 @@ if __name__ == '__main__':
     logging.error('to parse')
     try:
         args = parser.parse_args()
-    except Exception as e:
+    except Exception, e:
         logging.error('Exception parsing')
         logging.error(str(e))
     else:
@@ -60,7 +63,7 @@ if __name__ == '__main__':
     logging.error('parsed')
 
 #    if args.log_file and len(args.log_file)>0:
-#	print('file logging: '+str(args.log_file[0]))
+# ....print('file logging: '+str(args.log_file[0]))
 #        logging.basicConfig(filename=args.log_file[0])
 
     logging.error('py-obfsproxy CLI loaded2')
@@ -74,7 +77,8 @@ if __name__ == '__main__':
             logging.error('server')
             daemon = ManagedServer()
     else:
-        logging.error('Unsupported mode. Only managed mode is available at the moment.')
+        logging.error('Unsupported mode. Only managed mode is available at the moment.'
+                      )
 
 #        if dest:
 #            daemon = ExternalClient()
diff --git a/src/obfsproxy/crypto/aes.py b/src/obfsproxy/crypto/aes.py
index 214dd48..ff73130 100644
--- a/src/obfsproxy/crypto/aes.py
+++ b/src/obfsproxy/crypto/aes.py
@@ -1,29 +1,40 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
 from Crypto.Cipher import AES
 from Crypto.Util import Counter
 import base64
 import os
 
 # the block size for the cipher object; must be 16, 24, or 32 for AES
+
 BLOCK_SIZE = 32
 
 # the character used for padding--with a block cipher such as AES, the value
 # you encrypt must be a multiple of BLOCK_SIZE in length.  This character is
 # used to ensure that your value is always a multiple of BLOCK_SIZE
+
 PADDING = '{'
 
 # one-liner to sufficiently pad the text to be encrypted
+
 pad = lambda s: s + (BLOCK_SIZE - len(s) % BLOCK_SIZE) * PADDING
 
+
 class AESCoder(object):
-  def __init__(self, key):
-    counterIn=Counter.new(128)
-    self.cipherIn=AES.new(key, mode=AES.MODE_CTR, counter=counterIn)
 
-    counterOut=Counter.new(128)
-    self.cipherOut=AES.new(key, mode=AES.MODE_CTR, counter=counterOut)
+    def __init__(self, key):
+        counterIn = Counter.new(128)
+        self.cipherIn = AES.new(key, mode=AES.MODE_CTR,
+                                counter=counterIn)
+
+        counterOut = Counter.new(128)
+        self.cipherOut = AES.new(key, mode=AES.MODE_CTR,
+                                 counter=counterOut)
+
+    def encrypt(self, data):
+        return self.cipherOut.encrypt(pad(data))
+
+    def decrypt(self, data):
+        return self.cipherIn.decrypt(data).rstrip(PADDING)
 
-  def encrypt(self, data):
-    return self.cipherOut.encrypt(pad(data))
 
-  def decrypt(self, data):
-    return self.cipherIn.decrypt(data).rstrip(PADDING)
diff --git a/src/obfsproxy/framework/managed/client.py b/src/obfsproxy/framework/managed/client.py
index c11b666..d362816 100755
--- a/src/obfsproxy/framework/managed/client.py
+++ b/src/obfsproxy/framework/managed/client.py
@@ -29,12 +29,12 @@ class ManagedClient:
     def __init__(self):
         self.handler = SocksHandler()
 
-        self.supportedTransports={
+        self.supportedTransports = {
             'dummy': DummyClient,
             'rot13': Rot13Client,
             'dust': DustClient,
             'obfs3': Obfs3Client,
-        }
+            }
 
         matchedTransports = init(self.supportedTransports.keys())
         for transport in matchedTransports:
@@ -53,7 +53,7 @@ class ManagedClient:
             raise TransportLaunchException('Tried to launch unsupported transport %s'
                      % name)
 
-        clientClass=self.supportedTransports[name]
+        clientClass = self.supportedTransports[name]
         client = clientClass(self)
         self.handler.setTransport(client)
         add_service(Service(self.handler.handle, port=port))
diff --git a/src/obfsproxy/transports/base.py b/src/obfsproxy/transports/base.py
index e1feebf..bb011d5 100644
--- a/src/obfsproxy/transports/base.py
+++ b/src/obfsproxy/transports/base.py
@@ -1,19 +1,30 @@
 #!/usr/bin/python
 # -*- coding: utf-8 -*-
 
+
 class BaseDaemon:
 
     def __init__(self, decodedSocket, encodedSocket):
-        self.decodedSocket=decodedSocket
-        self.encodedSocket=encodedSocket
-
-    def read(self, socket, data, maxlen):
-        remaining=maxlen-len(data)
-        return data+socket.read(remaining)
-
-    def checkTransition(self, data, maxlen, newState):
-        if len(data)==maxlen:
-            state=newState
+        self.decodedSocket = decodedSocket
+        self.encodedSocket = encodedSocket
+
+    def read(
+        self,
+        socket,
+        data,
+        maxlen,
+        ):
+        remaining = maxlen - len(data)
+        return data + socket.read(remaining)
+
+    def checkTransition(
+        self,
+        data,
+        maxlen,
+        newState,
+        ):
+        if len(data) == maxlen:
+            state = newState
             return True
         else:
             return False
@@ -29,3 +40,5 @@ class BaseDaemon:
 
     def end(self):
         pass
+
+
diff --git a/src/obfsproxy/transports/dummy.py b/src/obfsproxy/transports/dummy.py
index 43d392c..7f1e69c 100644
--- a/src/obfsproxy/transports/dummy.py
+++ b/src/obfsproxy/transports/dummy.py
@@ -3,17 +3,25 @@
 
 from obfsproxy.transports.base import BaseDaemon
 
+
 class DummyDaemon(BaseDaemon):
+
     def receivedDecoded(self):
-        data=self.decodedSocket.readAll()
+        data = self.decodedSocket.readAll()
         self.encodedSocket.write(data)
 
     def receivedEncoded(self):
-        data=self.encodedSocket.readAll()
+        data = self.encodedSocket.readAll()
         self.decodedSocket.write(data)
 
+
 class DummyClient(DummyDaemon):
+
     pass
 
+
 class DummyServer(DummyDaemon):
+
     pass
+
+
diff --git a/src/obfsproxy/transports/dust_transport.py b/src/obfsproxy/transports/dust_transport.py
index 2da0436..f9d9a39 100644
--- a/src/obfsproxy/transports/dust_transport.py
+++ b/src/obfsproxy/transports/dust_transport.py
@@ -1,60 +1,73 @@
 #!/usr/bin/python
 # -*- coding: utf-8 -*-
 
-from dust.extensions.lite.lite_socket2 import lite_socket, makeSession, makeEphemeralSession, createEphemeralKeypair
+from dust.extensions.lite.lite_socket2 import lite_socket, makeSession, \
+    makeEphemeralSession, createEphemeralKeypair
 from dust.core.dust_packet import IV_SIZE, KEY_SIZE
 
 from obfsproxy.transports.base import BaseDaemon
 
-HANDSHAKE=0
-STREAM=1
+HANDSHAKE = 0
+STREAM = 1
+
+HANDSHAKE_SIZE = IV_SIZE + KEY_SIZE
 
-HANDSHAKE_SIZE=IV_SIZE+KEY_SIZE
 
 class DustDaemon(BaseDaemon):
 
     def __init__(self, decodedSocket, encodedSocket):
         BaseDaemon.__init__(self, decodedSocket, encodedSocket)
 
-        self.state=HANDSHAKE_WRITE
-        self.ekeypair=createEphemeralKeypair()
-        self.epub=bytes('')
+        self.state = HANDSHAKE_WRITE
+        self.ekeypair = createEphemeralKeypair()
+        self.epub = bytes('')
 
     def start(self):
         self.encodedSocket.write(self.ekeypair.public.bytes)
 
     def receivedDecoded(self):
+
         # If we're in streaming mode, encode and write the incoming data
-        if self.state==STREAM:
-            data=self.decodedSocket.readAll()
+
+        if self.state == STREAM:
+            data = self.decodedSocket.readAll()
             if data:
                 self.encodedSocket.write(self.coder.encode(data))
+
         # Else do nothing, data will buffer until we've done the handshake
 
     def receivedEncoded(self, data):
-        if self.state==HANDSHAKE:
-            self.epub=self.read(self.encodedSocket, self.epub, HANDSHAKE_SIZE)
+        if self.state == HANDSHAKE:
+            self.epub = self.read(self.encodedSocket, self.epub,
+                                  HANDSHAKE_SIZE)
             if self.checkTransition(self.epub, HANDSHAKE_SIZE, STREAM):
-                esession=makeEphemeralSession(self.ekeypair, self.epub)
-                self.coder=lite_socket(esession)
+                esession = makeEphemeralSession(self.ekeypair,
+                        self.epub)
+                self.coder = lite_socket(esession)
 
-                data=self.decodedSocket.readAll()
+                data = self.decodedSocket.readAll()
                 if data:
                     self.encodedSocket.write(self.coder.encode(data))
 
-                data=self.encodedSocket.readAll()
+                data = self.encodedSocket.readAll()
                 if data:
                     self.decodedSocket.write(self.coder.decode(data))
         else:
-            data=self.encodedSocket.readAll()
+            data = self.encodedSocket.readAll()
             if data:
                 self.decodedSocket.write(self.coder.decode(data))
 
     def end(self):
         pass
 
+
 class DustClient(DustDaemon):
+
     pass
 
+
 class DustServer(DustDaemon):
+
     pass
+
+
diff --git a/src/obfsproxy/transports/obfs2.py b/src/obfsproxy/transports/obfs2.py
index 00952f4..203adb6 100644
--- a/src/obfsproxy/transports/obfs2.py
+++ b/src/obfsproxy/transports/obfs2.py
@@ -12,162 +12,213 @@ from obfsproxy.crypto.aes import AESCoder
 from obfsproxy.util import decode, uncompact
 from obfsproxy.transports.base import BaseDaemon
 
-MAGIC_VALUE      = decode('2BF5CA7E')
-SEED_LENGTH      = 16
-MAX_PADDING      = 8192
-HASH_ITERATIONS  = 100000
+MAGIC_VALUE = decode('2BF5CA7E')
+SEED_LENGTH = 16
+MAX_PADDING = 8192
+HASH_ITERATIONS = 100000
 
-KEYLEN = 16 # is the length of the key used by E(K,s) -- that is, 16.
-IVLEN  = 16 # is the length of the IV used by E(K,s) -- that is, 16.
+KEYLEN = 16  # is the length of the key used by E(K,s) -- that is, 16.
+IVLEN = 16  # is the length of the IV used by E(K,s) -- that is, 16.
 
-HASHLEN = 16 # is the length of the output of H() -- that is, 32.
+HASHLEN = 16  # is the length of the output of H() -- that is, 32.
+
+READ_SEED = 0
+READ_PADKEY = 1
+READ_PADLEN = 2
+READ_PADDING = 3
+STREAM = 4
 
-READ_SEED=0
-READ_PADKEY=1
-READ_PADLEN=2
-READ_PADDING=3
-STREAM=4
 
 # H(x) is SHA256 of x.
+
 def h(x):
     hasher = hashlib.sha256()
     hasher.update(x)
     return hasher.digest()
 
+
 # H^n(x) is H(x) called iteratively n times.
+
 def hn(x, n):
-    data=x
+    data = x
     for x in range(n):
-        data=h(data)
+        data = h(data)
     return data
 
+
 # E(k,s) is the AES-CTR-128 encryption of s using K as key.
+
 def e(k, s):
-    cipher=AESCoder(k)
+    cipher = AESCoder(k)
     return cipher.encode(s)
 
+
 # D(k, s) is the AES-CTR-128 decryption of s using K as key.
+
 def d(k, s):
-    cipher=AESCoder(k)
+    cipher = AESCoder(k)
     return cipher.decode(s)
 
+
 # UINT32(n) is the 4 byte value of n in big-endian (network) order.
+
 def uint32(n):
-    return struct.pack('!I', (n))
+    return struct.pack('!I', n)
+
 
 def decodeUint32(bs):
     return struct.unpack('!I', bs)[0]
 
+
 # SR(n) is n bytes of strong random data.
+
 def sr(n):
     return os.urandom(n)
 
+
 # WR(n) is n bytes of weaker random data.
+
 def wr(n):
-    return ''.join(chr(random.randint(0,255)) for _ in range(n))
+    return ''.join(chr(random.randint(0, 255)) for _ in range(n))
+
 
 # MAC(s, x) = H(s | x | s)
+
 def mac(s, x):
-    return h(s+x+s)
+    return h(s + x + s)
+
 
 class Obfs2Daemon(BaseDaemon):
 
     def __init__(self, decodedSocket, encodedSocket):
-        self.decodedSocket=decodedSocket
-        self.encodedSocket=encodedSocket
-        self.otherSeed=bytes('')
-        self.otherPadKeyEncrypted=bytes('')
-        self.otherPadLenBytes=bytes('')
+        self.decodedSocket = decodedSocket
+        self.encodedSocket = encodedSocket
+        self.otherSeed = bytes('')
+        self.otherPadKeyEncrypted = bytes('')
+        self.otherPadLenBytes = bytes('')
 
     def start(self):
+
         # The initiator generates:
         # INIT_SEED = SR(SEED_LENGTH)
 
-        self.seed=sr(SEED_LENGTH)
-        self.padKey=self.derivePadKey(self.seed, self.padString)
+        self.seed = sr(SEED_LENGTH)
+        self.padKey = self.derivePadKey(self.seed, self.padString)
 
         # Each then generates a random number PADLEN in range from 0 through MAX_PADDING (inclusive).
-        self.padLen=random.nextInt(MAX_PADDING) % MAX_PADDING
+
+        self.padLen = random.nextInt(MAX_PADDING) % MAX_PADDING
 
         # The initiator then sends:
         # INIT_SEED | E(INIT_PAD_KEY, UINT32(MAGIC_VALUE) | UINT32(PADLEN) | WR(PADLEN))
-        self.server.write(self.seed+e(self.padKey, uint32(MAGIC_VALUE))+uint32(self.padLen)+wr(self.padLen))
 
-        self.state=READ_SEED
+        self.server.write(self.seed + e(self.padKey,
+                          uint32(MAGIC_VALUE)) + uint32(self.padLen)
+                          + wr(self.padLen))
+
+        self.state = READ_SEED
 
     def receivedDecoded(self):
-        if state==STREAM:
-            data=self.decodedSocket.readAll()
-            encodedData=encode(data)
+        if state == STREAM:
+            data = self.decodedSocket.readAll()
+            encodedData = encode(data)
             self.encodedSocket.write(encodedData)
 
     def receivedEncoded(self):
-        if state==READ_SEED:
-            self.otherSeed=self.read(self.encodedSocket, self.otherSeed, SEED_LENGTH)
-            if self.checkTransition(self.otherSeed, SEED_LENGTH, READ_PADKEY):
-                self.otherPadKeyDerived=self.derivePadKey(self.otherSeed, not self.server)
-        elif state==READ_PADKEY:
-            self.otherPadKeyEncrypted=self.read(self.encodedSocket, self.otherPadKeyEncrypted, KEYLEN)
-            if self.checkTransition(self.otherPadKeyEncrypted, KEYLEN, READ_PADLEN):
-                if self.otherPadKeyEncrypted!=self.otherPadKeyDerived:
+        if state == READ_SEED:
+            self.otherSeed = self.read(self.encodedSocket,
+                    self.otherSeed, SEED_LENGTH)
+            if self.checkTransition(self.otherSeed, SEED_LENGTH,
+                                    READ_PADKEY):
+                self.otherPadKeyDerived = \
+                    self.derivePadKey(self.otherSeed, not self.server)
+        elif state == READ_PADKEY:
+            self.otherPadKeyEncrypted = self.read(self.encodedSocket,
+                    self.otherPadKeyEncrypted, KEYLEN)
+            if self.checkTransition(self.otherPadKeyEncrypted, KEYLEN,
+                                    READ_PADLEN):
+                if self.otherPadKeyEncrypted != self.otherPadKeyDerived:
                     self.encodedSocket.disconnect()
                     self.decodedSocket.disconnect()
-        elif state==READ_PADLEN:
-            self.otherPadLenBytes=self.read(self.encodedSocket, self.otherPadLenBytes, 4)
-            if self.checkTransition(self.otherPadLenBytes, 4, READ_PADDING):
-                self.otherPadLen=decodeUint32(self.otherPadLenBytes)
-                if self.otherPadLen>MAX_PADDING:
+        elif state == READ_PADLEN:
+            self.otherPadLenBytes = self.read(self.encodedSocket,
+                    self.otherPadLenBytes, 4)
+            if self.checkTransition(self.otherPadLenBytes, 4,
+                                    READ_PADDING):
+                self.otherPadLen = decodeUint32(self.otherPadLenBytes)
+                if self.otherPadLen > MAX_PADDING:
                     self.encodedSocket.disconnect()
                     self.decodedSocket.disconnect()
-        elif state==READ_PADDING:
-            self.otherPadding=self.read(self.encodedSocket, self.otherPadding, self.otherPadLen)
-            if self.checkTransition(self.otherPadding, self.otherPadLen, READ_PADDING):
-                self.secret=self.deriveSecret(self.seed, self.otherSeed, self.server)
-                self.otherSecret=self.deriveSecret(self.otherSeed, self.seed, not self.server)
+        elif state == READ_PADDING:
+            self.otherPadding = self.read(self.encodedSocket,
+                    self.otherPadding, self.otherPadLen)
+            if self.checkTransition(self.otherPadding,
+                                    self.otherPadLen, READ_PADDING):
+                self.secret = self.deriveSecret(self.seed,
+                        self.otherSeed, self.server)
+                self.otherSecret = self.deriveSecret(self.otherSeed,
+                        self.seed, not self.server)
+
                 # INIT_KEY = INIT_SECRET[:KEYLEN]
                 # RESP_KEY = RESP_SECRET[:KEYLEN]
-                self.key=self.secret[:KEYLEN]
-                self.otherKey=self.otherSecret[:KEYLEN]
+
+                self.key = self.secret[:KEYLEN]
+                self.otherKey = self.otherSecret[:KEYLEN]
 
                 # INIT_IV = INIT_SECRET[KEYLEN:]
                 # RESP_IV = RESP_SECRET[KEYLEN:]
-                self.iv=self.secret[KEYLEN:]
-                self.otheriv=self.otherSecret[KEYLEN:]
-
-                self.cipher=initCipher(self.iv, self.key)
-                self.otherCipher=initCipher(self.otheriv, self.otherKey)
-        elif state==STREAM:
-            data=self.encodedSocket.readAll()
-            decodedData=decode(data)
+
+                self.iv = self.secret[KEYLEN:]
+                self.otheriv = self.otherSecret[KEYLEN:]
+
+                self.cipher = initCipher(self.iv, self.key)
+                self.otherCipher = initCipher(self.otheriv,
+                        self.otherKey)
+        elif state == STREAM:
+            data = self.encodedSocket.readAll()
+            decodedData = decode(data)
             self.decodedSocket.write(decodedData)
 
     def derivePadKey(self, seed, padString):
         return mac(padString, seed)[:KEYLEN]
 
-    def deriveSecret(self, seed, otherSeed, server):
+    def deriveSecret(
+        self,
+        seed,
+        otherSeed,
+        server,
+        ):
         if server:
+
             # RESP_SECRET = MAC("Responder obfuscated data", INIT_SEED|RESP_SEED)
-            return mac(self.padString, otherSeed+seed)
+
+            return mac(self.padString, otherSeed + seed)
         else:
+
             # INIT_SECRET = MAC("Initiator obfuscated data", INIT_SEED|RESP_SEED)
-            return mac(self.padString, seed+otherSeed)
+
+            return mac(self.padString, seed + otherSeed)
 
     def initCipher(self, iv, key):
-        coder=AESCoder(key)
+        coder = AESCoder(key)
         coder.encode(iv)
         return coder
 
     def end(self):
         pass
 
+
 class Obfs2Client(Obfs2Daemon):
 
     def __init__(self, decodedSocket, encodedSocket):
-        self.padString='Initiator obfuscation padding'
-        self.otherPadString='Responder obfuscation padding'
+        self.padString = 'Initiator obfuscation padding'
+        self.otherPadString = 'Responder obfuscation padding'
+
 
 class Obfs2Server(Obfs2Daemon):
 
     def __init__(self, decodedSocket, encodedSocket):
-        self.padString='Responder obfuscation padding'
-        self.otherPadString='Initiator obfuscation padding'
+        self.padString = 'Responder obfuscation padding'
+        self.otherPadString = 'Initiator obfuscation padding'
+
+
diff --git a/src/obfsproxy/transports/obfs3.py b/src/obfsproxy/transports/obfs3.py
index 72644d0..a4c10b4 100644
--- a/src/obfsproxy/transports/obfs3.py
+++ b/src/obfsproxy/transports/obfs3.py
@@ -1,61 +1,74 @@
 #!/usr/bin/python
 # -*- coding: utf-8 -*-
 
-from dust.extensions.lite.lite_socket2 import makeSession, makeEphemeralSession, createEphemeralKeypair
+from dust.extensions.lite.lite_socket2 import makeSession, \
+    makeEphemeralSession, createEphemeralKeypair
 from dust.core.dust_packet import IV_SIZE, KEY_SIZE
 
 from obfsproxy.crypto.aes import AESCoder
 from obfsproxy.transports.base import BaseDaemon
 
-HANDSHAKE=0
-STREAM=1
+HANDSHAKE = 0
+STREAM = 1
+
+HANDSHAKE_SIZE = IV_SIZE + KEY_SIZE
 
-HANDSHAKE_SIZE=IV_SIZE+KEY_SIZE
 
 class Obfs3Daemon(BaseDaemon):
 
     def __init__(self, decodedSocket, encodedSocket):
         BaseDaemon.__init__(self, decodedSocket, encodedSocket)
 
-        self.state=HANDSHAKE_WRITE
-        self.ekeypair=createEphemeralKeypair()
-        self.epub=bytes('')
+        self.state = HANDSHAKE_WRITE
+        self.ekeypair = createEphemeralKeypair()
+        self.epub = bytes('')
 
     def start(self):
         self.encodedSocket.write(self.ekeypair.public.bytes)
 
     def receivedDecoded(self):
+
         # If we're in streaming mode, encode and write the incoming data
-        if self.state==STREAM:
-            data=self.decodedSocket.readAll()
+
+        if self.state == STREAM:
+            data = self.decodedSocket.readAll()
             if data:
                 self.encodedSocket.write(self.coder.encode(data))
+
         # Else do nothing, data will buffer until we've done the handshake
 
     def receivedEncoded(self, data):
-        if self.state==HANDSHAKE:
-            self.epub=self.read(self.encodedSocket, self.epub, HANDSHAKE_SIZE)
+        if self.state == HANDSHAKE:
+            self.epub = self.read(self.encodedSocket, self.epub,
+                                  HANDSHAKE_SIZE)
             if self.checkTransition(self.epub, HANDSHAKE_SIZE, STREAM):
-                esession=makeEphemeralSession(self.ekeypair, self.epub)
-                self.coder=AESCoder(esession)
+                esession = makeEphemeralSession(self.ekeypair,
+                        self.epub)
+                self.coder = AESCoder(esession)
 
-                data=self.decodedSocket.readAll()
+                data = self.decodedSocket.readAll()
                 if data:
                     self.encodedSocket.write(self.coder.encode(data))
 
-                data=self.encodedSocket.readAll()
+                data = self.encodedSocket.readAll()
                 if data:
                     self.decodedSocket.write(self.coder.decode(data))
         else:
-            data=self.encodedSocket.readAll()
+            data = self.encodedSocket.readAll()
             if data:
                 self.decodedSocket.write(self.coder.decode(data))
 
     def end(self):
         pass
 
+
 class Obfs3Client(Obfs3Daemon):
+
     pass
 
+
 class Obfs3Server(Obfs3Daemon):
+
     pass
+
+
diff --git a/src/obfsproxy/transports/rot13.py b/src/obfsproxy/transports/rot13.py
index 1539582..113de18 100644
--- a/src/obfsproxy/transports/rot13.py
+++ b/src/obfsproxy/transports/rot13.py
@@ -16,6 +16,7 @@ def rot13(data):
 
 
 class Rot13Daemon:
+
     def __init__(self, client, server):
         pass
 
@@ -25,8 +26,14 @@ class Rot13Daemon:
     def decode(self, data):
         return rot13(data)
 
+
 class Rot13Client(Rot13Daemon):
+
     pass
 
+
 class Rot13Server:
+
     pass
+
+

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/obfsproxy.git



More information about the Pkg-privacy-commits mailing list