How to get port in FTP protocol from passive mode?

Secret picture Secret · Apr 1, 2012 · Viewed 43.6k times · Source

When I entered passive mode in FTP, I have got:

227 Entering Passive Mode (213,180,204,183,230,205).

First 4 numbers are the IP addresses, but what are the two last?

Are they two ports?

Answer

user1131997 picture user1131997 · Apr 1, 2012

the last two are: p1 and p2 from RFC of ftp: http://www.faqs.org/rfcs/rfc959.html

to get port, use:

p1 * 256 + p2, then connect to this port