Python FTP server library (pyftpdlib)
http://code.google.com/p/pyftpdlib/Python FTP服务器是一个使用异步接口的服务器,基于asyncore模块的pyftpdlib提供Python语言最完整支持RFC959 的FTP服务器。
Python FTP server library provides a high-level portable interface to easily write asynchronous FTP servers with Python. Based on asyncore framework pyftpdlib is actually the most complete RFC959 FTP server implementation available for Python programming language.
Features
[*]High portability:
[*]Entirely written in pure Python, no third party modules are used. It just should work on any system where select( ) or poll( )are available.
[*]Extremely flexible system of "authorizers" able to interact with account and password database of different systems (Windows NT, Unix/Linux, OSx and so on...).
[*]High performance: thanks to asyncore framework it permits multiplexing I/O with various client connections within a single process / thread.
[*]Extremely simple and highly customizable thanks to its simpler Object Oriented API.
[*]Compact: the entire library is distributed in a single file (ftpserver.py).
[*]Support for FXP, site-to-site transfers.
[*]NAT/Firewall support with PASV (passive) mode connections.
[*]Support for resumed transfers.
[*]Per-user messages configurability.
[*]Maximum connections limit.
[*]Per-source-IP limits.
Quick start
>>> from pyftpdlib import ftpserver
>>> authorizer = ftpserver.DummyAuthorizer()
>>> authorizer.add_user('user', '12345', '/home/user', perm=('r', 'w'))
>>> authorizer.add_anonymous('/home/nobody')
>>> ftp_handler = ftpserver.FTPHandler
>>> ftp_handler.authorizer = authorizer
>>> address = ("127.0.0.1", 21)
>>> ftpd = ftpserver.FTPServer(address, ftp_handler)
>>> ftpd.serve_forever()
Serving FTP on 127.0.0.1:21
[]127.0.0.1:2503 connected.
127.0.0.1:2503 ==> 220 Ready.
127.0.0.1:2503331 Username ok, send password.
127.0.0.1:2503230 Login successful.
@127.0.0.1:2503 User anonymous logged in.
127.0.0.1:2503200 Type set to: ASCII.
127.0.0.1:2503227 Entering passive mode (127,0,0,1,9,201).
127.0.0.1:2503150 File status okay. About to open data connection.
@127.0.0.1:2503 OK LIST "/". Transfer starting.
127.0.0.1:2503 ==> 226 Transfer complete.
@127.0.0.1:2503 Transfer complete. 706 bytes transmitted.
127.0.0.1:2503221 Goodbye.
@127.0.0.1:2503 Disconnected.
页:
[1]