Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: third_party/pyftpdlib/demo/basic_ftpd.py

Issue 16429: python based ftp server (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # basic_ftpd.py
3
4 """A basic FTP server which uses a DummyAuthorizer for managing 'virtual
5 users', setting a limit for incoming connections.
6 """
7
8 import os
9
10 from pyftpdlib import ftpserver
11
12
13 if __name__ == "__main__":
14
15 # Instantiate a dummy authorizer for managing 'virtual' users
16 authorizer = ftpserver.DummyAuthorizer()
17
18 # Define a new user having full r/w permissions and a read-only
19 # anonymous user
20 authorizer.add_user('user', '12345', os.getcwd(), perm='elradfmw')
21 authorizer.add_anonymous(os.getcwd())
22
23 # Instantiate FTP handler class
24 ftp_handler = ftpserver.FTPHandler
25 ftp_handler.authorizer = authorizer
26
27 # Define a customized banner (string returned when client connects)
28 ftp_handler.banner = "pyftpdlib %s based ftpd ready." %ftpserver.__ver__
29
30 # Specify a masquerade address and the range of ports to use for
31 # passive connections. Decomment in case you're behind a NAT.
32 #ftp_handler.masquerade_address = '151.25.42.11'
33 #ftp_handler.passive_ports = range(60000, 65535)
34
35 # Instantiate FTP server class and listen to 0.0.0.0:21
36 address = ('', 21)
37 ftpd = ftpserver.FTPServer(address, ftp_handler)
38
39 # set a limit for connections
40 ftpd.max_cons = 256
41 ftpd.max_cons_per_ip = 5
42
43 # start ftp server
44 ftpd.serve_forever()
OLDNEW
« no previous file with comments | « third_party/pyftpdlib/build/lib/pyftpdlib/ftpserver.py ('k') | third_party/pyftpdlib/demo/md5_ftpd.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698