[Pkg-privacy-commits] [obfsproxy] 15/353: Fixed imports and undefined symbols to get obfsproxy client and server modes working

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 13:01:33 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 27545c09ece6fb560d69e91145c726d8e0cc3b3e
Author: Brandon Wiley <brandon at blanu.net>
Date:   Wed Jul 4 16:39:54 2012 -0500

    Fixed imports and undefined symbols to get obfsproxy client and server modes working
---
 .gitignore                                |   2 ++
 bin/py-obfsproxy                          |   2 ++
 src/cli.py                                |   8 ++---
 src/obfsproxy/cli/obfsproxy.py            |  56 ------------------------------
 src/obfsproxy/framework/managed/client.py |  10 +++---
 src/obfsproxy/framework/managed/server.py |  12 +++----
 src/obfsproxy/framework/proxy.py          |   2 +-
 src/obfsproxy/framework/socks.py          |   2 +-
 src/obfsproxy/manager/__init__.pyc        | Bin 145 -> 0 bytes
 src/obfsproxy/manager/clientManager.py    |   5 ++-
 src/obfsproxy/manager/manager.py          |   8 ++---
 src/obfsproxy/manager/manager.pyc         | Bin 1156 -> 0 bytes
 src/obfsproxy/manager/serverManager.py    |   5 ++-
 src/obfsproxy/transports/__init__.pyc     | Bin 148 -> 0 bytes
 src/obfsproxy/transports/dummy.pyc        | Bin 1187 -> 0 bytes
 15 files changed, 28 insertions(+), 84 deletions(-)

diff --git a/.gitignore b/.gitignore
index 6b8dacf..cd0a31a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
+py-obfsproxy.sublime-project
+py-obfsproxy.sublime-workspace
 pytidy.py
 tidy.py
 tidyall
diff --git a/bin/py-obfsproxy b/bin/py-obfsproxy
new file mode 100755
index 0000000..3dbbf50
--- /dev/null
+++ b/bin/py-obfsproxy
@@ -0,0 +1,2 @@
+python -u src/cli.py $*
+
diff --git a/src/cli.py b/src/cli.py
index 3335ae6..aa9b8af 100644
--- a/src/cli.py
+++ b/src/cli.py
@@ -3,6 +3,8 @@
 
 import argparse
 
+from pyptlib.easy.util import checkClientMode
+
 from obfsproxy.framework.managed.server import ManagedServer
 from obfsproxy.framework.managed.client import ManagedClient
 
@@ -39,11 +41,9 @@ if __name__ == '__main__':
 
     args = parser.parse_args()
 
-    print args
-
     daemon = None
-    if managed:
-        if dest:
+    if args.managed:
+        if checkClientMode():
             daemon = ManagedClient()
         else:
             daemon = ManagedServer()
diff --git a/src/obfsproxy/cli/obfsproxy.py b/src/obfsproxy/cli/obfsproxy.py
deleted file mode 100644
index f219a99..0000000
--- a/src/obfsproxy/cli/obfsproxy.py
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-
-import argparse
-
-from pyptlib.framework.server import ManagedServer
-from pyptlib.framework.client import ManagedClient
-
-protocols = ['dummy', 'rot13']
-
-if __name__ == '__main__':
-    parser = \
-        argparse.ArgumentParser(description='* Available protocols: '
-                                + ' '.join(protocols))
-    parser.add_argument('--log-file', nargs=1, help='set logfile')
-    parser.add_argument('--log-min-severity', nargs=1, default='notice'
-                        , choices=['warn', 'notice', 'info', 'debug'],
-                        help='set minimum logging severity (default: %(default)s)'
-                        )
-    parser.add_argument('--no-log', action='store_false', default=True,
-                        help='disable logging')
-    parser.add_argument('--no-safe-logging', action='store_false',
-                        default=True,
-                        help='disable safe (scrubbed address) logging')
-    parser.add_argument('--managed', action='store_true',
-                        default=False,
-                        help='enabled managed mode, for use when called by tor'
-                        )
-
-#    parser.add_argument('--dest', nargs=1,
-#                        help='set destination, enable client mode instead of server mode'
-#                        )
-
-#    parser.add_argument('obfsproxy_args')
-#    parser.add_argument('protocol_name')
-#    parser.add_argument('protocol_args')
-#    parser.add_argument('protocol_options')
-#    parser.add_argument('protocol_name')
-
-    args = parser.parse_args()
-
-    print args
-
-    daemon = None
-    if managed:
-        if dest:
-            daemon = ManagedClient()
-        else:
-            daemon = ManagedServer()
-    else:
-        print 'Unsupported mode. Only managed mode is available at the moment.'
-
-#        if dest:
-#            daemon = ExternalClient()
-#        else:
-#            daemon = ExternalServer()
diff --git a/src/obfsproxy/framework/managed/client.py b/src/obfsproxy/framework/managed/client.py
index 49d6f19..03152d5 100755
--- a/src/obfsproxy/framework/managed/client.py
+++ b/src/obfsproxy/framework/managed/client.py
@@ -6,12 +6,12 @@ from monocle import _o, Return
 monocle.init('tornado')
 
 from monocle.stack import eventloop
-from monocle.stack.network import add_service
+from monocle.stack.network import add_service, Service
 
 from obfsproxy.framework.socks import SocksHandler
 from obfsproxy.transports.dummy import DummyClient
 
-from pyptlib.easy.client import init, reportSucess, reportFailure, \
+from pyptlib.easy.client import init, reportSuccess, reportFailure, \
     reportEnd
 
 
@@ -25,9 +25,9 @@ class ManagedClient:
     def __init__(self):
         self.handler = SocksHandler()
 
-        supportedTransports = ['dummy', 'rot13']
+        self.supportedTransports = ['dummy', 'rot13']
 
-        matchedTransports = init(supportedTransports)
+        matchedTransports = init(self.supportedTransports)
         for transport in matchedTransports:
             try:
                 self.launchClient(transport, 8182)
@@ -40,7 +40,7 @@ class ManagedClient:
         eventloop.run()
 
     def launchClient(self, name, port):
-        if name != self.supportedTransport:
+        if not name in self.supportedTransports:
             raise TransportLaunchException('Tried to launch unsupported transport %s'
                      % name)
 
diff --git a/src/obfsproxy/framework/managed/server.py b/src/obfsproxy/framework/managed/server.py
index a2c4516..b8cbd5c 100755
--- a/src/obfsproxy/framework/managed/server.py
+++ b/src/obfsproxy/framework/managed/server.py
@@ -6,12 +6,12 @@ from monocle import _o, Return
 monocle.init('tornado')
 
 from monocle.stack import eventloop
-from monocle.stack.network import add_service
+from monocle.stack.network import add_service, Service
 
 from obfsproxy.framework.proxy import ProxyHandler
-from obfsproxy.transports.dummy import DummyClient
+from obfsproxy.transports.dummy import DummyServer
 
-from pyptlib.easy.server import init, reportSucess, reportFailure, \
+from pyptlib.easy.server import init, reportSuccess, reportFailure, \
     reportEnd
 
 
@@ -25,9 +25,9 @@ class ManagedServer:
     def __init__(self):
         self.handler = ProxyHandler()
 
-        supportedTransports = ['dummy', 'rot13']
+        self.supportedTransports = ['dummy', 'rot13']
 
-        matchedTransports = init(supportedTransports)
+        matchedTransports = init(self.supportedTransports)
         for transport in matchedTransports:
             try:
                 self.launchServer(transport, 8182)
@@ -39,7 +39,7 @@ class ManagedServer:
         eventloop.run()
 
     def launchServer(self, name, port):
-        if name != self.supportedTransport:
+        if not name in self.supportedTransports:
             raise TransportLaunchException('Tried to launch unsupported transport %s'
                      % name)
 
diff --git a/src/obfsproxy/framework/proxy.py b/src/obfsproxy/framework/proxy.py
index 18bbeb9..46065b0 100644
--- a/src/obfsproxy/framework/proxy.py
+++ b/src/obfsproxy/framework/proxy.py
@@ -9,7 +9,7 @@ from monocle import _o, Return
 
 from pyptlib.util import encode
 
-from pyptlib.framework.shared import pump
+from obfsproxy.framework.shared import pump
 
 
 class ProxyHandler:
diff --git a/src/obfsproxy/framework/socks.py b/src/obfsproxy/framework/socks.py
index 107cfd0..57a32a6 100644
--- a/src/obfsproxy/framework/socks.py
+++ b/src/obfsproxy/framework/socks.py
@@ -9,7 +9,7 @@ from monocle import _o, Return
 
 from pyptlib.util import encode
 
-from pyptlib.framework.shared import pump
+from obfsproxy.framework.shared import pump
 
 
 def uncompact(x):
diff --git a/src/obfsproxy/manager/__init__.pyc b/src/obfsproxy/manager/__init__.pyc
deleted file mode 100644
index e3507ba..0000000
Binary files a/src/obfsproxy/manager/__init__.pyc and /dev/null differ
diff --git a/src/obfsproxy/manager/clientManager.py b/src/obfsproxy/manager/clientManager.py
index 7b1fbc5..8418c10 100644
--- a/src/obfsproxy/manager/clientManager.py
+++ b/src/obfsproxy/manager/clientManager.py
@@ -3,7 +3,7 @@
 
 import os
 
-from pyptlib.manager.manager import Manager
+from obfsproxy.manager.manager import Manager
 
 
 class ClientManager(Manager):
@@ -16,5 +16,4 @@ class ClientManager(Manager):
 
 if __name__ == '__main__':
     manager = ClientManager()
-    manager.launch('src/pyptlib/framework/client.py')
-
+    manager.launch()
\ No newline at end of file
diff --git a/src/obfsproxy/manager/manager.py b/src/obfsproxy/manager/manager.py
index 424936f..b5cffbe 100644
--- a/src/obfsproxy/manager/manager.py
+++ b/src/obfsproxy/manager/manager.py
@@ -12,14 +12,12 @@ class Manager:
         os.environ['TOR_PT_STATE_LOCATION'] = '/'
         os.environ['TOR_PT_MANAGED_TRANSPORT_VER'] = '1'
 
-    def launch(self, path):
-        p = subprocess.Popen(['python', '-u', path],
+    def launch(self):
+        p = subprocess.Popen(['python', '-u', 'src/cli.py', '--managed'],
                              stdout=subprocess.PIPE)
         line = p.stdout.readline().strip()
         while line != None and line != '':
             print str(line)
             sys.stdout.flush()
             line = p.stdout.readline().strip()
-        print 'Done!'
-
-
+        print 'Done!'
\ No newline at end of file
diff --git a/src/obfsproxy/manager/manager.pyc b/src/obfsproxy/manager/manager.pyc
deleted file mode 100644
index f171236..0000000
Binary files a/src/obfsproxy/manager/manager.pyc and /dev/null differ
diff --git a/src/obfsproxy/manager/serverManager.py b/src/obfsproxy/manager/serverManager.py
index d9f0c78..465208b 100644
--- a/src/obfsproxy/manager/serverManager.py
+++ b/src/obfsproxy/manager/serverManager.py
@@ -3,8 +3,7 @@
 
 import os
 
-from pyptlib.manager.manager import Manager
-
+from obfsproxy.manager.manager import Manager
 
 class ServerManager(Manager):
 
@@ -19,4 +18,4 @@ class ServerManager(Manager):
 
 if __name__ == '__main__':
     manager = ServerManager()
-    manager.launch('src/pyptlib/framework/server.py')
+    manager.launch()
\ No newline at end of file
diff --git a/src/obfsproxy/transports/__init__.pyc b/src/obfsproxy/transports/__init__.pyc
deleted file mode 100644
index 3ffbf76..0000000
Binary files a/src/obfsproxy/transports/__init__.pyc and /dev/null differ
diff --git a/src/obfsproxy/transports/dummy.pyc b/src/obfsproxy/transports/dummy.pyc
deleted file mode 100644
index c069ca6..0000000
Binary files a/src/obfsproxy/transports/dummy.pyc and /dev/null differ

-- 
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