Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.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 3.x 尝试在python ftp_tls模块中启动命令时出现eof错误_Python 3.x_Ssl_Server_Ftp_Tls1.2 - Fatal编程技术网

Python 3.x 尝试在python ftp_tls模块中启动命令时出现eof错误

Python 3.x 尝试在python ftp_tls模块中启动命令时出现eof错误,python-3.x,ssl,server,ftp,tls1.2,Python 3.x,Ssl,Server,Ftp,Tls1.2,我买了两台服务器,都是从同一家主机公司和同一个软件包买的, 购买的第一台服务器工作正常,这只是为了测试和实验, 支持团队告诉我的另一台服务器,它们的ssl和ftp版本相同 不起作用,并且在尝试启动命令时在python脚本中出现错误 ''' from ftplib_custom import FTP_TLS import ssl import ftplib_custom import socket def launch(): #Wait upon user input print("Press

我买了两台服务器,都是从同一家主机公司和同一个软件包买的, 购买的第一台服务器工作正常,这只是为了测试和实验, 支持团队告诉我的另一台服务器,它们的ssl和ftp版本相同 不起作用,并且在尝试启动命令时在python脚本中出现错误

'''

from ftplib_custom import FTP_TLS
import ssl
import ftplib_custom
import socket

def launch():
#Wait upon user input
print("Press Enter To Initialise Server Connection: ")
input()

#Info
print("Server Found")
print("Admin Auto Login...")
print("\n")

#Connection Initiation

#Working Test Server
ftp = FTP_TLS('MyHostname', user='Username', passwd='Password')

#Not Working Server
ftp = FTP_TLS('MyHostname', user='Username', passwd='Password')

ftp.ssl_version = ssl.PROTOCOL_TLS

print(ftp.getwelcome())
ftp.set_debuglevel(1)
ftp.set_pasv(True)
ftp.prot_p()
ftp.ccc()

print ("Login Successful")

def listLineCallback(line):
    msg = ("** %s*"%line)
    print(msg)

#Commands
ftp.pwd()
ftp.cwd("/")
ftp.retrlines('LIST', listLineCallback)
#ftp.dir()

launch()
'''
这是我从工作的测试服务器得到的

'''
Press Enter To Initialise Server Connection: 

Server Found
Admin Auto Login...


220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 1 of 50 allowed.
220-Local time is now 10:53. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.
*cmd* 'PBSZ 0'
*resp* '200 PBSZ=0'
*cmd* 'PROT P'
*resp* '200 Data protection level set to "private"'
*cmd* 'CCC'
*resp* '200 Control connection unencrypted'
Login Successful
*cmd* 'PWD'
*resp* '257 "/" is your current location'
*cmd* 'CWD /'
*resp* '250 OK. Current directory is /'
*cmd* 'TYPE A'
*resp* '200 TYPE is now ASCII'
*cmd* 'PASV'
*resp* '227 Entering Passive Mode (91,103,219,222,232,11)'
*cmd* 'LIST'
*resp* '150 Accepted data connection'
** drwxr-xr-x    2 sensitive   sensitive         4096 Dec 18 15:53 .*
** drwxr-xr-x    2 sensitive   sensitive         4096 Dec 18 15:53 ..*
** -rw-------    1 sensitive   sensitive            4 Oct 28 15:59 .ftpquota*
*resp* '226-Options: -a -l \n226 3 matches total'
'''
'''
Server Found
Admin Auto Login...


220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 1 of 50 allowed.
220-Local time is now 10:57. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.
*cmd* 'PBSZ 0'
*resp* '200 PBSZ=0'
*cmd* 'PROT P'
*resp* '200 Data protection level set to "private"'
*cmd* 'CCC'
*resp* '200 Control connection unencrypted'
Login Successful
*cmd* 'PWD'
*resp* '257 "/" is your current location'
*cmd* 'CWD /'
*resp* '250 OK. Current directory is /'
*cmd* 'TYPE A'
*resp* '200 TYPE is now ASCII'
*cmd* 'PASV'
*resp* '227 Entering Passive Mode (91,146,105,202,253,214)'
*cmd* 'LIST'
*resp* '150 Accepted data connection'
Traceback (most recent call last):
  File "C:\Users\install\Desktop\WebsiteConnecting\Website_FTP_Testing.py", line 54, in <module>
    launch()
  File "C:\Users\install\Desktop\WebsiteConnecting\Website_FTP_Testing.py", line 51, in launch
    ftp.retrlines('LIST', listLineCallback)
  File "C:\Users\install\AppData\Local\Programs\Python\Python37\lib\ftplib_custom.py", line 488, in retrlines
    return self.voidresp()
  File "C:\Users\install\AppData\Local\Programs\Python\Python37\lib\ftplib_custom.py", line 251, in voidresp
    resp = self.getresp()
  File "C:\Users\install\AppData\Local\Programs\Python\Python37\lib\ftplib_custom.py", line 236, in getresp
    resp = self.getmultiline()
  File "C:\Users\install\AppData\Local\Programs\Python\Python37\lib\ftplib_custom.py", line 222, in getmultiline
    line = self.getline()
  File "C:\Users\install\AppData\Local\Programs\Python\Python37\lib\ftplib_custom.py", line 210, in getline
    raise EOFError
EOFError
'''
这是我尝试连接到主服务器时得到的

'''
Press Enter To Initialise Server Connection: 

Server Found
Admin Auto Login...


220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 1 of 50 allowed.
220-Local time is now 10:53. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.
*cmd* 'PBSZ 0'
*resp* '200 PBSZ=0'
*cmd* 'PROT P'
*resp* '200 Data protection level set to "private"'
*cmd* 'CCC'
*resp* '200 Control connection unencrypted'
Login Successful
*cmd* 'PWD'
*resp* '257 "/" is your current location'
*cmd* 'CWD /'
*resp* '250 OK. Current directory is /'
*cmd* 'TYPE A'
*resp* '200 TYPE is now ASCII'
*cmd* 'PASV'
*resp* '227 Entering Passive Mode (91,103,219,222,232,11)'
*cmd* 'LIST'
*resp* '150 Accepted data connection'
** drwxr-xr-x    2 sensitive   sensitive         4096 Dec 18 15:53 .*
** drwxr-xr-x    2 sensitive   sensitive         4096 Dec 18 15:53 ..*
** -rw-------    1 sensitive   sensitive            4 Oct 28 15:59 .ftpquota*
*resp* '226-Options: -a -l \n226 3 matches total'
'''
'''
Server Found
Admin Auto Login...


220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 1 of 50 allowed.
220-Local time is now 10:57. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.
*cmd* 'PBSZ 0'
*resp* '200 PBSZ=0'
*cmd* 'PROT P'
*resp* '200 Data protection level set to "private"'
*cmd* 'CCC'
*resp* '200 Control connection unencrypted'
Login Successful
*cmd* 'PWD'
*resp* '257 "/" is your current location'
*cmd* 'CWD /'
*resp* '250 OK. Current directory is /'
*cmd* 'TYPE A'
*resp* '200 TYPE is now ASCII'
*cmd* 'PASV'
*resp* '227 Entering Passive Mode (91,146,105,202,253,214)'
*cmd* 'LIST'
*resp* '150 Accepted data connection'
Traceback (most recent call last):
  File "C:\Users\install\Desktop\WebsiteConnecting\Website_FTP_Testing.py", line 54, in <module>
    launch()
  File "C:\Users\install\Desktop\WebsiteConnecting\Website_FTP_Testing.py", line 51, in launch
    ftp.retrlines('LIST', listLineCallback)
  File "C:\Users\install\AppData\Local\Programs\Python\Python37\lib\ftplib_custom.py", line 488, in retrlines
    return self.voidresp()
  File "C:\Users\install\AppData\Local\Programs\Python\Python37\lib\ftplib_custom.py", line 251, in voidresp
    resp = self.getresp()
  File "C:\Users\install\AppData\Local\Programs\Python\Python37\lib\ftplib_custom.py", line 236, in getresp
    resp = self.getmultiline()
  File "C:\Users\install\AppData\Local\Programs\Python\Python37\lib\ftplib_custom.py", line 222, in getmultiline
    line = self.getline()
  File "C:\Users\install\AppData\Local\Programs\Python\Python37\lib\ftplib_custom.py", line 210, in getline
    raise EOFError
EOFError
'''

能否使用与Python代码在同一台机器上运行的任何FTPS客户端检索目录列表如果可以,请向我们展示其日志文件。是的,我可以连接Filezilla,但是如果我将其配置为通过tls隐式连接,它将不起作用,我将立即更新post,而通过tls显式连接,我可以连接到服务器。我已向您索要成功连接的日志文件。您发布的内容看起来不像是成功的连接。它也不是一个日志文件。它看起来像是FileZilla GUI中消息日志的副本,对于任何调试都没有用处。