Note that there are some explanatory texts on larger screens.

plurals
  1. POftplib: Passive & NAT/address translation
    text
    copied!<p>Is there a way to detect that the server returns its private network address when entering passive mode, and to translate it into its public address?<br> I don't have access to the server.</p> <pre><code>&gt;&gt;&gt; # Python 2.7.3rc2 &gt;&gt;&gt; from ftplib import FTP_TLS &gt;&gt;&gt; ftps = FTP_TLS() &gt;&gt;&gt; ftps.set_debuglevel(2) &gt;&gt;&gt; ftps.connect("example.com", 123) *get* '220 Welcome to Synchrony Gateway FTP server\r\n' *resp* '220 Welcome to Synchrony Gateway FTP server' '220 Welcome to Synchrony Gateway FTP server' &gt;&gt;&gt; ftps.auth() *cmd* 'AUTH TLS' *put* 'AUTH TLS\r\n' *get* '234 Using authentication type TLS\r\n' *resp* '234 Using authentication type TLS' '234 Using authentication type TLS' &gt;&gt;&gt; ftps.login("foo", "***") *cmd* 'AUTH TLS' *put* 'AUTH TLS\r\n' *get* '234 AUTH command OK, waiting handshake\r\n' *resp* '234 AUTH command OK, waiting handshake' *cmd* 'USER foo' *put* 'USER foo\r\n' *get* '331 Send password please\r\n' *resp* '331 Send password please' *cmd* 'PASS ************' *put* 'PASS ************\r\n' *get* '230 User logged in, proceed\r\n' *resp* '230 User logged in, proceed' '230 User logged in, proceed' &gt;&gt;&gt; ftps.prot_p() *cmd* 'PBSZ 0' *put* 'PBSZ 0\r\n' *get* '200 Command okay\r\n' *resp* '200 Command okay' *cmd* 'PROT P' *put* 'PROT P\r\n' *get* '200 Command okay\r\n' *resp* '200 Command okay' '200 Command okay' &gt;&gt;&gt; ftps.set_pasv(True) &gt;&gt;&gt; ftps.retrlines("LIST") *cmd* 'TYPE A' *put* 'TYPE A\r\n' *get* '200 Type set to A\r\n' *resp* '200 Type set to A' *cmd* 'PASV' *put* 'PASV\r\n' *get* '227 Entering Passive Mode (192,168,17,1,195,119)\r\n' *resp* '227 Entering Passive Mode (192,168,17,1,195,119)' </code></pre> <p>Thanks.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload