50 lines
1.5 KiB
Python
50 lines
1.5 KiB
Python
"""
|
|
FTP Server Configuration
|
|
"""
|
|
|
|
# Server settings
|
|
FTP_HOST = '127.0.0.1'
|
|
FTP_PORT = 2121 # Use non-privileged port (21 requires admin rights)
|
|
DATA_PORT_RANGE = (20000, 20100)
|
|
|
|
# Server directories
|
|
SERVER_ROOT = './ftp_root'
|
|
TEST_FILES_DIR = './test_files'
|
|
|
|
# User credentials (in production, this should be in a database)
|
|
USERS = {
|
|
'admin': 'admin123',
|
|
'user': 'password',
|
|
'test': 'test123',
|
|
'guest': 'guest'
|
|
}
|
|
|
|
# FTP Response codes
|
|
FTP_RESPONSES = {
|
|
'150': '150 File status okay; about to open data connection.',
|
|
'200': '200 Command okay.',
|
|
'220': '220 Service ready for new user.',
|
|
'221': '221 Service closing control connection.',
|
|
'226': '226 Closing data connection.',
|
|
'227': '227 Entering Passive Mode',
|
|
'230': '230 User logged in, proceed.',
|
|
'250': '250 Requested file action okay, completed.',
|
|
'331': '331 User name okay, need password.',
|
|
'425': '425 Can\'t open data connection.',
|
|
'426': '426 Connection closed; transfer aborted.',
|
|
'450': '450 Requested file action not taken.',
|
|
'500': '500 Syntax error, command unrecognized.',
|
|
'501': '501 Syntax error in parameters or arguments.',
|
|
'502': '502 Command not implemented.',
|
|
'503': '503 Bad sequence of commands.',
|
|
'530': '530 Not logged in.',
|
|
'550': '550 Requested action not taken.',
|
|
'553': '553 Requested action not taken.'
|
|
}
|
|
|
|
# Supported commands
|
|
SUPPORTED_COMMANDS = [
|
|
'USER', 'PASS', 'QUIT', 'PWD', 'CWD', 'LIST', 'NLST',
|
|
'RETR', 'PASV', 'PORT', 'TYPE', 'SYST', 'NOOP'
|
|
]
|