obfsproxy: new package

From the Tor project page:

obfsproxy is a tool that attempts to circumvent censorship, by
transforming the Tor traffic between the client and the bridge. This
way, censors, who usually monitor traffic between the client and the
bridge, will see innocent-looking transformed traffic instead of the
actual Tor traffic.

This depends on:

- pyptlib (#2053)
- twisted (#2052)

Also, txsocksx (#2058) is necessary to use an outgoing SOCKS proxy,
and having either gmpy2 (#2067) or gmpy (#2051) installed will help
speed up calculations.

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
This commit is contained in:
Jeffery To
2015-12-11 20:10:09 +08:00
parent f0be8b0ea2
commit 48ebd8f0e5
7 changed files with 366 additions and 0 deletions
@@ -0,0 +1,13 @@
diff --git a/setup.py b/setup.py
index 2353a29..9d2a9a9 100644
--- a/setup.py
+++ b/setup.py
@@ -21,7 +21,7 @@ setup(
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
- packages = find_packages(),
+ packages = find_packages(exclude=['*.test', '*.test.*']),
entry_points = {
'console_scripts': [
'obfsproxy = obfsproxy.pyobfsproxy:run'
@@ -0,0 +1,16 @@
diff --git a/setup.py b/setup.py
index 2353a29..8d3d56d 100644
--- a/setup.py
+++ b/setup.py
@@ -27,6 +27,11 @@ setup(
'obfsproxy = obfsproxy.pyobfsproxy:run'
]
},
+ options = {
+ 'build_scripts': {
+ 'executable': '/usr/bin/python'
+ },
+ },
install_requires = [
'setuptools',
@@ -0,0 +1,12 @@
diff --git a/setup.py b/setup.py
index 2353a29..e04c5f5 100644
--- a/setup.py
+++ b/setup.py
@@ -32,7 +32,6 @@ setup(
'setuptools',
'PyCrypto',
'Twisted',
- 'argparse',
'pyptlib >= 0.0.6',
'pyyaml'
],
@@ -0,0 +1,51 @@
diff --git a/obfsproxy/common/log.py b/obfsproxy/common/log.py
index bb30296..79193d2 100644
--- a/obfsproxy/common/log.py
+++ b/obfsproxy/common/log.py
@@ -1,5 +1,6 @@
"""obfsproxy logging code"""
import logging
+import logging.handlers
import sys
from twisted.python import log
@@ -50,6 +51,18 @@ class ObfsLogger(object):
self.obfslogger.addHandler(log_handler)
+ def set_syslog(self, progname):
+ """Set up our logger so that it starts logging to syslog instead."""
+
+ # remove the default handler, and add the SysLogHandler:
+ self.obfslogger.removeHandler(self.default_handler)
+
+ log_handler = logging.handlers.SysLogHandler(address='/dev/log')
+ formatter = logging.Formatter(progname + "[%(process)d]: %(message)s")
+ log_handler.setFormatter(formatter)
+
+ self.obfslogger.addHandler(log_handler)
+
def set_log_severity(self, sev_string):
"""Update our minimum logging severity to 'sev_string'."""
diff --git a/obfsproxy/pyobfsproxy.py b/obfsproxy/pyobfsproxy.py
index 4a2faf6..eaf8a44 100755
--- a/obfsproxy/pyobfsproxy.py
+++ b/obfsproxy/pyobfsproxy.py
@@ -42,6 +42,7 @@ def set_up_cli_parsing():
parser.add_argument('-v', '--version', action='version', version=__version__)
parser.add_argument('--log-file', help='set logfile')
+ parser.add_argument('--syslog', metavar='PROGNAME', help='use syslog')
parser.add_argument('--log-min-severity',
choices=['error', 'warning', 'info', 'debug'],
help='set minimum logging severity (default: %(default)s)')
@@ -110,6 +111,8 @@ def consider_cli_args(args):
if args.log_file:
log.set_log_file(args.log_file)
+ elif args.syslog:
+ log.set_syslog(args.syslog)
if args.log_min_severity:
log.set_log_severity(args.log_min_severity)
if args.no_log: