[Pkg-privacy-commits] [obfsproxy] 27/353: Added logging
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 74a9136e3e442597ed60ce92f450b3e97b2ee3c3
Author: Brandon Wiley <brandon at blanu.net>
Date: Fri Aug 3 15:09:14 2012 -0500
Added logging
---
src/cli.py | 16 +++++++++-------
src/obfsproxy/framework/managed/client.py | 7 +++----
src/obfsproxy/framework/socks.py | 19 ++++++++++---------
3 files changed, 22 insertions(+), 20 deletions(-)
diff --git a/src/cli.py b/src/cli.py
index de87145..25d1edf 100644
--- a/src/cli.py
+++ b/src/cli.py
@@ -14,12 +14,18 @@ import argparse
sys.path.insert(0,
os.path.realpath(os.path.join(os.path.dirname(__file__),
+ '../../Dust/py')))
+sys.path.insert(0,
+ os.path.realpath(os.path.join(os.path.dirname(__file__),
'../../pyptlib/src')))
from pyptlib.easy.util import checkClientMode
-from obfsproxy.framework.managed.server import ManagedServer
-from obfsproxy.framework.managed.client import ManagedClient
+try:
+ from obfsproxy.framework.managed.server import ManagedServer
+ from obfsproxy.framework.managed.client import ManagedClient
+except Exception as e:
+ logging.error('Error loading framework: '+str(e))
protocols = ['dummy', 'rot13']
@@ -52,21 +58,17 @@ if __name__ == '__main__':
# parser.add_argument('protocol_options')
# parser.add_argument('protocol_name')
- logging.error('to parse')
try:
args = parser.parse_args()
except Exception, e:
logging.error('Exception parsing')
logging.error(str(e))
- else:
- logging.error('else')
- logging.error('parsed')
# if args.log_file and len(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')
+ logging.error('py-obfsproxy CLI loaded')
daemon = None
if args.managed:
diff --git a/src/obfsproxy/framework/managed/client.py b/src/obfsproxy/framework/managed/client.py
index 1bf4b73..c928279 100755
--- a/src/obfsproxy/framework/managed/client.py
+++ b/src/obfsproxy/framework/managed/client.py
@@ -1,6 +1,8 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
+import logging
+
import monocle
from monocle import _o, Return
monocle.init('tornado')
@@ -38,6 +40,7 @@ class ManagedClient:
matchedTransports = init(self.supportedTransports.keys())
for transport in matchedTransports:
try:
+ logging.error('Launching %s' % (transport))
self.launchClient(transport, 8182)
reportSuccess(transport, 5, ('127.0.0.1', 8182), None,
None)
@@ -55,7 +58,3 @@ class ManagedClient:
clientClass = self.supportedTransports[name]
self.handler.setTransport(clientClass)
add_service(Service(self.handler.handle, port=port))
-
-
-if __name__ == '__main__':
- client = ManagedClient()
diff --git a/src/obfsproxy/framework/socks.py b/src/obfsproxy/framework/socks.py
index 0731428..f615796 100644
--- a/src/obfsproxy/framework/socks.py
+++ b/src/obfsproxy/framework/socks.py
@@ -1,6 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
+import logging
from struct import unpack
from socket import inet_ntoa
@@ -22,7 +23,7 @@ def uncompact(x):
@_o
def readHandshake(input):
version = (yield input.read(1))
- print 'version: ' + encode(str(version))
+ logging.info('version: %s' % (encode(str(version))))
nauth = (yield input.read(1))
nauth = unpack('B', nauth)[0]
auths = []
@@ -62,27 +63,27 @@ class SocksHandler:
@_o
def handle(self, conn):
- print 'handle_socks'
+ logging.info('handle_socks')
yield readHandshake(conn)
- print 'read handshake'
+ logging.info('read handshake')
yield sendHandshake(conn)
- print 'send handshake'
+ logging.info('send handshake')
dest = (yield readRequest(conn))
- print 'read request: ' + str(dest)
+ logging.info('read request: %s' % (str(dest)))
yield sendResponse(dest, conn)
- print 'sent response'
+ logging.info('sent response')
(addr, port) = uncompact(dest)
# addr='127.0.0.1'
# port=8183
- print addr
- print port
+ logging.info(addr)
+ logging.info(port)
client = Client()
yield client.connect(addr, port)
- print 'connected ' + str(addr) + ', ' + str(port)
+ logging.info('connected %s:%d' % (addr, port))
self.pump=Pump(conn, client, self.transport)
self.pump.run()
--
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