From 027af16d6f087519d06e6f27f76484f5422eb5d0 Mon Sep 17 00:00:00 2001 From: mysticbbs Date: Sat, 7 Sep 2013 19:03:24 -0400 Subject: [PATCH] Now assigns random port based on IANI recommendations --- mdl/m_tcp_client_ftp.pas | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/mdl/m_tcp_client_ftp.pas b/mdl/m_tcp_client_ftp.pas index 7a63056..1e6ea51 100644 --- a/mdl/m_tcp_client_ftp.pas +++ b/mdl/m_tcp_client_ftp.pas @@ -15,6 +15,8 @@ Type DataIP : String; DataSocket : TIOSocket; IsPassive : Boolean; + MinPort : Word; + MaxPort : Word; Constructor Create (NetI: String); Override; Function OpenDataSession : Boolean; @@ -41,9 +43,11 @@ Constructor TFTPClient.Create (NetI: String); Begin Inherited Create(NetI); - IsPassive := False; - DataIP := ''; - DataPort := ftpDefaultDataPort; + IsPassive := False; + DataIP := ''; + MinPort := 49152; + MaxPort := 65535; + DataPort := Random(MaxPort - MinPort) + MinPort; End; Function TFTPClient.OpenDataSession : Boolean; @@ -154,7 +158,7 @@ Begin End; End Else Begin IsPassive := False; - DataPort := ftpDefaultDataPort; + DataPort := Random(MaxPort - MinPort) + MinPort; Result := SendCommand('PORT ' + strReplace(Client.PeerIP, '.', ',') + ',' + strI2S(WordRec(DataPort).Hi) + ',' + strI2S(WordRec(DataPort).Lo)) = 200; End; End;