twisteroidambassador / ptadapter Goto Github PK
View Code? Open in Web Editor NEWPluggable Transports Python interface & standalone tunnels
License: GNU General Public License v3.0
Pluggable Transports Python interface & standalone tunnels
License: GNU General Public License v3.0
For obfs4proxy, I could pass arguments to enable logging:
[ronlam@localhost pluggabletransportadapter]$ obfs4proxy --help
Usage of obfs4proxy:
-enableLogging
Log to TOR_PT_STATE_LOCATION/obfs4proxy.log
-logLevel string
Log level (ERROR/WARN/INFO/DEBUG) (default "ERROR")
-obfs4-distBias
Enable obfs4 using ScrambleSuit style table generation
-unsafeLogging
Disable the address scrubber
-version
Print version and exit
But using the script to pass arguments will cause error:
[ronlam@localhost pluggabletransportadapter]$ ./standalone_server.py standalone_server_config.ini -vv
[2016-08-24 14:13:16,839] root DEBUG Verbosity level set
[2016-08-24 14:13:16,839] root DEBUG Arguments:
[2016-08-24 14:13:16,839] root DEBUG Namespace(configfile=<_io.TextIOWrapper name='standalone_server_config.ini' mode='r' encoding='UTF-8'>, verbose=2)
[2016-08-24 14:13:16,840] root INFO Read config file
[2016-08-24 14:13:16,840] root DEBUG Transports:
[2016-08-24 14:13:16,840] root DEBUG {'obfs4': {'bindaddr': '127.0.0.1:7900'}}
[2016-08-24 14:13:16,840] pluggabletransportadapter INFO Environment variables prepared for server /usr/local/bin/obfs4proxy -enableLogging
[2016-08-24 14:13:16,840] pluggabletransportadapter DEBUG Environment variables:
[2016-08-24 14:13:16,840] pluggabletransportadapter DEBUG {'TOR_PT_ORPORT': '127.0.0.1:7000', 'TOR_PT_SERVER_BINDADDR': 'obfs4-127.0.0.1:7900', 'TOR_PT_MANAGED_TRANSPORT_VER': '1', 'TOR_PT_STATE_LOCATION': '/tmp/.pt-state', 'TOR_PT_SERVER_TRANSPORTS': 'obfs4'}
Traceback (most recent call last):
File "./standalone_server.py", line 91, in <module>
main_cli()
File "./standalone_server.py", line 73, in main_cli
server.start()
File "/home/ronlam/pluggabletransportadapter/pluggabletransportadapter/baseserverclient.py", line 187, in start
self.run_ptexec()
File "/home/ronlam/pluggabletransportadapter/pluggabletransportadapter/baseserverclient.py", line 49, in run_ptexec
env=self.env, universal_newlines=True)
File "/usr/lib64/python3.4/subprocess.py", line 859, in __init__
restore_signals, start_new_session)
File "/usr/lib64/python3.4/subprocess.py", line 1457, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/bin/obfs4proxy -enableLogging'
standalone_server_config.ini :
[ronlam@localhost pluggabletransportadapter]$ cat standalone_server_config.ini
[common]
exec = /usr/local/bin/obfs4proxy -enableLogging
statedir = /tmp/.pt-state
forward = 127.0.0.1:7000
[transports]
obfs4 = 127.0.0.1:7900
As stated in code, the standalone_server.py use subprocess.Popen(). The script pass whole '/usr/local/bin/obfs4proxy -enableLogging' as string, so the problem occurred.
May this script possible to use something like shlex.split() to split exec string to list before passing to the subprocess.Popen()?
This is running on Windows 10 with Python 3.11.4.
close_tasks, _ = await asyncio.wait([w.wait_closed() for w in writers])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Passing coroutines is forbidden, use tasks explicitly.
I want to connect with ptadapter and obfs3 to openvpn server the config files are below:
##Client config:
[client]
exec = "D:\MyApp\ptadapter_config\obfs4proxy.exe"
#state = "D:\MyApp\ptadapter_config\state"
tunnels = fn_obfs_4 fn_obfs_3
[fn_obfs_3]
transport = obfs3
listen = 127.0.0.1:3883
upstream = x.x.x.x:10113
##Server Config
[server]
exec = /usr/bin/obfs4proxy -enableLogging
state = ./state
forward = 127.0.0.1:1194
tunnels = server_obfs4 server_obfs3
[server_obfs3]
transport = obfs3
listen = 127.0.0.1:10113
i did use socks proxy on openvpn client also and after i click on connect button the below error occured on client terminal:
[2023-01-04 16:03:32,857] WARNING handler PT reported error while connecting to upstream ('x.x.x.x', 10113): PTSOCKS5ConnectError(<SOCKS5Reply.GENERAL_FAILURE: b'\x01'>)
[2023-01-04 16:03:32,859] ERROR handler Unexpected error
Traceback (most recent call last):
File "C:\Users\Mori\AppData\Roaming\Python\Python311\site-packages\ptadapter\contexts.py", line 45, in log_unhandled_exc
yield
File "C:\Users\Mori\AppData\Roaming\Python\Python311\site-packages\ptadapter\console_script.py", line 52, in handle_client_connection
async with contexts.log_unhandled_exc(handler_logger),
File "C:\Program Files\Python311\Lib\contextlib.py", line 211, in aexit
await anext(self.gen)
File "C:\Users\Mori\AppData\Roaming\Python\Python311\site-packages\ptadapter\contexts.py", line 29, in aclosing_multiple_writers
close_tasks, _ = await asyncio.wait([w.wait_closed() for w in writers])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\asyncio\tasks.py", line 415, in wait
raise TypeError("Passing coroutines is forbidden, use tasks explicitly.")
TypeError: Passing coroutines is forbidden, use tasks explicitly.
C:\Users\Mori\AppData\Roaming\Python\Python311\site-packages\ptadapter\console_script.py:52: RuntimeWarning: coroutine 'StreamWriter.wait_closed' was never awaited
async with contexts.log_unhandled_exc(handler_logger),
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Maybe its a bug idk but i have same problem when i tried obfs4 connection btw.
Tanks for your great work.
In the current version, I run the program with
python3 ./standalone.py --server --verbose ./standalone_server_config.ini
with the recent version of obfs4proxy for TorBrowser.
The config file:
[obfs4-options]
iat-mode = 0
(In other words, the config options node-id, private-key, public-key, drbg-seed are left out, like the manual suggests.)
The program does not run, instead it produces error
future: <Future finished exception=PTExecSMethodError("SMETHOD-ERROR obfs4 missing argument 'node-id'",)>
Declaring any options-* in the config file results in ValueError: too many values to unpack (expected 2)
I am following instructions on installing obfs4proxy with openvpn here: https://mosin.ca/index.php/2018/09/05/setting-up-openvpn-with-obfs4proxy/
The startup script includes:
ExecStart=/usr/bin/python3 /etc/openvpn/pluggabletransportadapter/standalone.py --server /etc/openvpn/pluggabletransportadapter/standalone_server_config.ini
However, the git clone directory does not include the scripts 'standalone.py' or 'standalone_server_config.ini'. I have created the server ini file from the example_config.ini, but am stuck without the standalone.py file.
I am also using a redhat fork (like centos) which has python 3.6 installed. The original howto called for python3. Will 3.6 work the same?
I am assuming the files have changed since the howto was published. Can you please advise the current procedure?
This is the "standalone_client_config.ini".
[transports]
# Define transports supported by the PT here. Each supported transport type may
# have several clients with different options. Syntax:
# <config-section> = <transport-name>
# config-section is case-insensitive, and must not be "common" or "default".
obfs4-client1 = obfs4
obfs4-client2 = obfs4
obfs4-client3 = obfs4
We can use single client process manage three-more client instance.
And is there any possible to forward so much more address and port by single server process?
("standalone_server_config.ini")
Can you show an example of CONF_FILE for Windows systems ?? Thanks for you work.
Downloading/unpacking https://pypi.python.org/packages/61/a7/48f627413200d5dfd0a5da8b494d34ccac03f8a87a6b2d765b7d81e175e
3/configparser-3.5.0b2.tar.gz
Downloading configparser-3.5.0b2.tar.gz
Running setup.py (path:/tmp/pip-GbaYGD-build/setup.py) egg_info for package from https://pypi.python.org/packages/61/a
7/48f627413200d5dfd0a5da8b494d34ccac03f8a87a6b2d765b7d81e175e3/configparser-3.5.0b2.tar.gz
Installing collected packages: configparser
Running setup.py install for configparser
Skipping installation of /usr/local/lib/python2.7/dist-packages/backports/__init__.py (namespace package)
Installing /usr/local/lib/python2.7/dist-packages/configparser-3.5.0b2-nspkg.pth
Successfully installed configparser
Cleaning up...
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pluggabletransportadapter/standalone_server.py", line 13, in
from pluggabletransportadapter import PluggableTransportServerAdapter
File "/usr/local/lib/python2.7/dist-packages/pluggabletransportadapter/pluggabletransportadapter/init.py", line 1,
in
from .baseserverclient import PluggableTransportServerAdapter,
File "/usr/local/lib/python2.7/dist-packages/pluggabletransportadapter/pluggabletransportadapter/baseserverclient.py",
line 439
buf = yield from reader.read(self.RELAY_BUFFER_SIZE)
^
SyntaxError: invalid syntax
Hi.
Strange error. Works fine when using meek testing on localhost, but bombs out repeatedly (after a few seconds at most) when deploying meek on cloud platform. Have attached stderr output example.
Is this meek_client or wrapper issue?
Github not support upload 7z so this is not a zip archive,
download and rename to 7z
ptadapter-3.0.0_windows_x64.zip
ptadapter-3.0.0_linux_x64.zip
Pack ptadapter to pyinstaller then later use in other environment
# Process PYTHONPATH
import os
import sys
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.dirname(SCRIPT_DIR))
# Other code from upstream
.*\.py\n
.*:
#.*\n
os.path
etc.)import
as --hidden-import
pyinstaller (2) main.py
Imagine main.exe as main.py, it can't survive without other source files.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.