From 0c3bace49e439086990e8763f326e4f5c4e71844 Mon Sep 17 00:00:00 2001 From: TheDudeFromCI Date: Tue, 3 Aug 2021 03:00:23 -0700 Subject: [PATCH 1/3] Added custom port support for ftp access --- src/handlers/handle_ftp.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/handlers/handle_ftp.py b/src/handlers/handle_ftp.py index 655156a..eb03403 100644 --- a/src/handlers/handle_ftp.py +++ b/src/handlers/handle_ftp.py @@ -10,9 +10,10 @@ from handlers.handle_config import configurationValues def createFTPConnection(): configValues = configurationValues() - ftp = ftplib.FTP(configValues.sftp_server, user=configValues.sftp_user, \ - passwd=configValues.sftp_password) try: + ftp = ftplib.FTP() + ftp.connect(configValues.sftp_server, configValues.sftp_port) + ftp.login(configValues.sftp_user, configValues.sftp_password) return ftp except UnboundLocalError: print(oColors.brightRed + "[FTP]: Check your config.ini!" + oColors.standardWhite) From 92898728312e91895e33a8dece675af163b6958f Mon Sep 17 00:00:00 2001 From: TheDudeFromCI Date: Tue, 3 Aug 2021 03:01:51 -0700 Subject: [PATCH 2/3] Removed warning in default config --- src/handlers/handle_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/handlers/handle_config.py b/src/handlers/handle_config.py index 62b886f..7cb1c0f 100644 --- a/src/handlers/handle_config.py +++ b/src/handlers/handle_config.py @@ -72,7 +72,7 @@ def createConfig(): config['SFTP - Remote Server']['Server'] = '0.0.0.0' config['SFTP - Remote Server']['Username'] = 'user' config['SFTP - Remote Server']['Password'] = 'password' - config['SFTP - Remote Server'][';'] = 'If a different Port for SFTP needs to be used (Works only for SFTP)' + config['SFTP - Remote Server'][';'] = 'If a different Port for SFTP needs to be used' config['SFTP - Remote Server']['SFTPPort'] = '22' config['SFTP - Remote Server'][';_'] = 'Change the path below if the plugin folder path is different on the SFTP/FTP server (Change only if you know what you are doing)' config['SFTP - Remote Server']['PluginFolderOnServer'] = '/plugins' From 1c74d8501c02fdefc1a337eb05196c2e12c5f34e Mon Sep 17 00:00:00 2001 From: TheDudeFromCI Date: Wed, 4 Aug 2021 19:52:10 -0700 Subject: [PATCH 3/3] Apply suggestions from code review Co-authored-by: Neocky --- src/handlers/handle_config.py | 4 +++- src/handlers/handle_ftp.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/handlers/handle_config.py b/src/handlers/handle_config.py index 7cb1c0f..a77a357 100644 --- a/src/handlers/handle_config.py +++ b/src/handlers/handle_config.py @@ -72,8 +72,10 @@ def createConfig(): config['SFTP - Remote Server']['Server'] = '0.0.0.0' config['SFTP - Remote Server']['Username'] = 'user' config['SFTP - Remote Server']['Password'] = 'password' - config['SFTP - Remote Server'][';'] = 'If a different Port for SFTP needs to be used' + config['SFTP - Remote Server'][';'] = 'If a different Port for SFTP needs to be used (Default: 22)' config['SFTP - Remote Server']['SFTPPort'] = '22' + config['SFTP - Remote Server'][';_'] = 'If a different Port for FTP needs to be used (Default: 21)' + config['SFTP - Remote Server']['FTPPort'] = '21' config['SFTP - Remote Server'][';_'] = 'Change the path below if the plugin folder path is different on the SFTP/FTP server (Change only if you know what you are doing)' config['SFTP - Remote Server']['PluginFolderOnServer'] = '/plugins' config['SFTP - Remote Server'][';__'] = 'If you want to use FTP instead of SFTP change to (False) else use (True)' diff --git a/src/handlers/handle_ftp.py b/src/handlers/handle_ftp.py index eb03403..f1ab4cf 100644 --- a/src/handlers/handle_ftp.py +++ b/src/handlers/handle_ftp.py @@ -12,7 +12,7 @@ def createFTPConnection(): configValues = configurationValues() try: ftp = ftplib.FTP() - ftp.connect(configValues.sftp_server, configValues.sftp_port) + ftp.connect(configValues.sftp_server, configValues.ftp_port) ftp.login(configValues.sftp_user, configValues.sftp_password) return ftp except UnboundLocalError: