Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
python sshtunnel ssh到代理_Python_Linux_Proxy_Socks - Fatal编程技术网

python sshtunnel ssh到代理

python sshtunnel ssh到代理,python,linux,proxy,socks,Python,Linux,Proxy,Socks,我想从ssh-linux服务器创建代理/socks服务。我已经使用sshtunnel for mysql创建了端口转发器,示例代码: from sshtunnel import SSHTunnelForwarder from sqlalchemy import create_engine from sqlalchemy.engine.url import URL with SSHTunnelForwarder(('mydomain.com', 22), ssh_username='root',

我想从ssh-linux服务器创建代理/socks服务。我已经使用sshtunnel for mysql创建了端口转发器,示例代码:

from sshtunnel import SSHTunnelForwarder
from sqlalchemy import create_engine
from sqlalchemy.engine.url import URL

with SSHTunnelForwarder(('mydomain.com', 22), ssh_username='root', ssh_password='password', local_bind_address=('127.0.0.1', 3306), remote_bind_address=('127.0.0.1', 3306)) as server:
    myDB = URL(drivername='mysql+pymysql', host='127.0.0.1', database='test_db', username='root', password='THawr_tapH3f', port=3306)

    engine = create_engine(name_or_url=myDB)
    connection = engine.connect()    
    connection.close() 

我想用python在proxy/socks4/5服务中转换我的ssh linux机器;我该怎么做

它需要是python吗
ssh-D 1080 mydomain.com
使ssh侦听端口1080并充当socks5代理。这是一个简单的解决方案,但在我的应用程序中需要使用python