From 187f843b75b2dacb3c1bc0f4f2e238d5361a0e94 Mon Sep 17 00:00:00 2001 From: doskel downtime Date: Mon, 1 Jun 2026 21:48:55 -0600 Subject: [PATCH 1/2] added a flag to allow setting an ftp banner --- copyparty/__main__.py | 1 + copyparty/ftpd.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/copyparty/__main__.py b/copyparty/__main__.py index 60bd185e..5a6cd255 100644 --- a/copyparty/__main__.py +++ b/copyparty/__main__.py @@ -1519,6 +1519,7 @@ def add_ftp(ap): ap2.add_argument("--ftp-wt", metavar="SEC", type=int, default=7, help="grace period for resuming interrupted uploads (any client can write to any file last-modified more recently than \033[33mSEC\033[0m seconds ago)") ap2.add_argument("--ftp-nat", metavar="ADDR", type=u, default="", help="the NAT address to use for passive connections") ap2.add_argument("--ftp-pr", metavar="P-P", type=u, default="", help="the range of TCP ports to use for passive connections, for example \033[32m12000-13000") + ap2.add_argument("--ftp-banner", metavar="BANNER", type=u, default="copyparty ftpd", help="banner to send before ftp login") def add_webdav(ap): diff --git a/copyparty/ftpd.py b/copyparty/ftpd.py index ccbd423c..3b0ea9e6 100644 --- a/copyparty/ftpd.py +++ b/copyparty/ftpd.py @@ -629,7 +629,7 @@ class Ftpd(object): FtpHandler.hub = h2.hub = hub FtpHandler.args = h2.args = hub.args FtpHandler.authorizer = h2.authorizer = FtpAuth(hub) - + FtpHandler.banner = self.args.ftp_banner if self.args.ftp_pr: p1, p2 = [int(x) for x in self.args.ftp_pr.split("-")] if self.args.ftp and self.args.ftps: From 035929fec75ffb3a28961ded182a258bcf92e486 Mon Sep 17 00:00:00 2001 From: doskel downtime Date: Mon, 1 Jun 2026 22:30:51 -0600 Subject: [PATCH 2/2] convert literal \n characters to the \r\n required for pyftpdlib to do newline --- copyparty/ftpd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copyparty/ftpd.py b/copyparty/ftpd.py index 3b0ea9e6..f6a7b2f1 100644 --- a/copyparty/ftpd.py +++ b/copyparty/ftpd.py @@ -629,7 +629,7 @@ class Ftpd(object): FtpHandler.hub = h2.hub = hub FtpHandler.args = h2.args = hub.args FtpHandler.authorizer = h2.authorizer = FtpAuth(hub) - FtpHandler.banner = self.args.ftp_banner + FtpHandler.banner = self.args.ftp_banner.replace("\\n", "\r\n") if self.args.ftp_pr: p1, p2 = [int(x) for x in self.args.ftp_pr.split("-")] if self.args.ftp and self.args.ftps: