[Pkg-privacy-commits] [obfsproxy] 65/353: Delete the rot13 transport and replace it with a base64 one.
Ximin Luo
infinity0 at moszumanska.debian.org
Sat Aug 22 13:01:40 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 673efff7cf2e664964a953d17947d90a57c725bf
Author: George Kadianakis <desnacked at riseup.net>
Date: Mon Sep 17 04:10:02 2012 +0300
Delete the rot13 transport and replace it with a base64 one.
I'm not even sure how to do rot13 to non-alphabetic characters.
---
src/obfsproxy/transports/b64.py | 59 +++++++++++++++++++++++++++++++++
src/obfsproxy/transports/rot13.py | 69 ---------------------------------------
2 files changed, 59 insertions(+), 69 deletions(-)
diff --git a/src/obfsproxy/transports/b64.py b/src/obfsproxy/transports/b64.py
new file mode 100644
index 0000000..bd7c5d4
--- /dev/null
+++ b/src/obfsproxy/transports/b64.py
@@ -0,0 +1,59 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+""" This module contains an implementation of the 'b64' transport. """
+
+from obfsproxy.transports.base import BaseDaemon
+
+import base64
+
+import obfsproxy.common.log as log
+
+class B64Daemon(BaseDaemon):
+
+ """
+ B64Daemon is the base class for B64Client and B64Server.
+ Since the protocol is so simple, B64Daemon provides all of the functionality for the b64 protocol implementation.
+ """
+
+ def receivedDownstream(self, data, circuit):
+ """ XXX DOCDOC
+ receivedDownstream is the event which is called when bytes are received from the downstream socket.
+ The b64 protocol encodes them with the b64 function and then writes the result to the upstream socket.
+ """
+
+ log.warning("downstream: Received '''%s'''" % (str(data)))
+ circuit.upstream.write(base64.b64decode(data))
+ return ''
+
+ def receivedUpstream(self, data, circuit):
+ """
+ receivedUpstream is the event which is called when bytes are received from the upstream socket.
+ The b64 protocol encodes them with the b64 function and then writes the result to the downstream socket.
+ """
+
+ log.warning("upstream: Received '''%s'''" % (str(data)))
+ circuit.downstream.write(base64.b64encode(data))
+ return ''
+
+
+class B64Client(B64Daemon):
+
+ """
+ B64Client is a client for the 'b64' protocol.
+ Since this protocol is so simple, the client and the server are identical and both just trivially subclass B64Daemon.
+ """
+
+ pass
+
+
+class B64Server(B64Daemon):
+
+ """
+ B64Server is a server for the 'b64' protocol.
+ Since this protocol is so simple, the client and the server are identical and both just trivially subclass B64Daemon.
+ """
+
+ pass
+
+
diff --git a/src/obfsproxy/transports/rot13.py b/src/obfsproxy/transports/rot13.py
deleted file mode 100644
index c5d5b33..0000000
--- a/src/obfsproxy/transports/rot13.py
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-
-""" This module contains an implementation of the 'rot13' transport. """
-
-from obfsproxy.transports.base import BaseDaemon
-
-
-class Rot13Daemon(BaseDaemon):
-
- """
- Rot13Daemon is the base class for Rot13Client and Rot13Server.
- Since the protocol is so simple, Rot13Daemon provides all of the functionality for the rot13 protocol implementation.
- """
-
- def rot13(self, data):
- """
- The rot13 method performs a rot13 transformation on just the alphabetical characters in the data.
- """
-
- for x in range(len(data)):
- ascii = ord(data[x])
- if ascii >= 97 and ascii <= 122: # a-z
- data[x] = (ascii - 97 + 13) % 26 + 97
- elif ascii >= 65 and ascii <= 90:
-
- # A-Z
-
- data[x] = (ascii - 65 + 13) % 26 + 65
-
- return data
-
- def receivedDownstream(self, data):
- """
- receivedDownstream is the event which is called when bytes are received from the downstream socket.
- The rot13 protocol encodes them with the rot13 function and then writes the result to the upstream socket.
- """
-
- return self.rot13(data)
-
- def receivedUpstream(self, data):
- """
- receivedUpstream is the event which is called when bytes are received from the upstream socket.
- The rot13 protocol encodes them with the rot13 function and then writes the result to the downstream socket.
- """
-
- return self.rot13(data)
-
-
-class Rot13Client(Rot13Daemon):
-
- """
- Rot13Client is a client for the 'rot13' protocol.
- Since this protocol is so simple, the client and the server are identical and both just trivially subclass Rot13Daemon.
- """
-
- pass
-
-
-class Rot13Server:
-
- """
- Rot13Server is a server for the 'rot13' protocol.
- Since this protocol is so simple, the client and the server are identical and both just trivially subclass Rot13Daemon.
- """
-
- 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