Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/288.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
Whonix上的Dh键太小(Python FTP)_Python_Python 3.x_Networking_Ftp - Fatal编程技术网

Whonix上的Dh键太小(Python FTP)

Whonix上的Dh键太小(Python FTP),python,python-3.x,networking,ftp,Python,Python 3.x,Networking,Ftp,我正在尝试从Whonix操作系统内将文件上载到服务器。我在Whonix中使用Filezilla成功地完成了这项工作,因此我不确定Python代码为什么不能工作 from ftplib import FTP, FTP_TLS import os ftp = FTP_TLS() ftp.set_debuglevel(2) ftp.connect('ftp.server.com', 21) ftp.login('Username', 'Password') item_name = 'myfile.m

我正在尝试从Whonix操作系统内将文件上载到服务器。我在Whonix中使用Filezilla成功地完成了这项工作,因此我不确定Python代码为什么不能工作

from ftplib import FTP, FTP_TLS
import os

ftp = FTP_TLS()
ftp.set_debuglevel(2)
ftp.connect('ftp.server.com', 21)
ftp.login('Username', 'Password')
item_name = 'myfile.mp4'
item_path = os.path.abspath(item_name)

fp = open(item_path, 'rb')
ftp.storbinary('STOR {}'.format(item_name), fp, 8192)
fp.close()
有人知道我应该如何更改Python代码,以便能够从Whonix中成功上传文件吗?作为参考,当我直接在Windows中运行Python代码时,它可以正常工作。只有当我从Whonix内部尝试时,它才会失败,我不知道为什么

这是我得到的错误,我不明白:

*get* '220-This is a private system - No anonymous login\n'
*get* '220-IPv6 connections are also welcome on this server.\n'
*get* '220 You will be disconnected after 30 minutes of inactivity.\n'
*resp* '220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------\n220-You are user number 17 of 50 allowed.\n220-Local time is now 01:28. Server port: 21.\n220-This is a private system - No anonymous login\n220-IPv6 connections are also welcome on this server.\n220 You will be disconnected after 30 minutes of inactivity.'
*cmd* 'AUTH TLS'
*put* 'AUTH TLS\r\n'
*get* '234 AUTH TLS OK.\n'
*resp* '234 AUTH TLS OK.'
Traceback (most recent call last):
  File "test.py", line 8, in <module>
    ftp.login('Username', 'Password')
  File "/usr/lib/python3.7/ftplib.py", line 749, in login
    self.auth()
  File "/usr/lib/python3.7/ftplib.py", line 761, in auth
    server_hostname=self.host)
  File "/usr/lib/python3.7/ssl.py", line 412, in wrap_socket
    session=session
  File "/usr/lib/python3.7/ssl.py", line 853, in _create
    self.do_handshake()
  File "/usr/lib/python3.7/ssl.py", line 1117, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: DH_KEY_TOO_SMALL] dh key too small (_ssl.c:1056)
*get*'220这是一个私有系统-没有匿名登录\n
*get*'此服务器上也欢迎220-IPv6连接。\n'
*get*'220您将在30分钟不活动后断开连接。\n'
*resp*'220------欢迎使用纯FTPd[privsep][TLS]--------\n220您是允许的50个用户中的17个。\n220本地时间现在是01:28。服务器端口:21。\n220这是一个专用系统-此服务器上不欢迎匿名登录\n220-IPv6连接。\n220不活动30分钟后,您将断开连接。”
*cmd*“认证TLS”
*放置*'AUTH TLS\r\n'
*get*'234验证TLS正常。\n'
*resp*“234认证TLS正常。”
回溯(最近一次呼叫最后一次):
文件“test.py”,第8行,在
ftp.login('用户名','密码')
文件“/usr/lib/python3.7/ftplib.py”,第749行,登录
self.auth()
文件“/usr/lib/python3.7/ftplib.py”,第761行,在auth中
服务器(主机名=self.host)
文件“/usr/lib/python3.7/ssl.py”,第412行,在wrap_套接字中
会话=会话
文件“/usr/lib/python3.7/ssl.py”,第853行,在创建
self.do_握手
文件“/usr/lib/python3.7/ssl.py”,第1117行,在do_握手中
赛尔夫:握手
ssl.SSLError:[ssl:DH_-KEY_-TOO_-SMALL]DH-KEY-TOO-SMALL(_-ssl.c:1056)