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

Side by Side Diff: third_party/pyftpdlib/demo/md5_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
« no previous file with comments | « third_party/pyftpdlib/demo/basic_ftpd.py ('k') | third_party/pyftpdlib/demo/throttled_ftpd.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # md5_ftpd.py
3
4 """A basic ftpd storing passwords as hash digests (platform independent).
5 """
6
7 import md5
8 import os
9
10 from pyftpdlib import ftpserver
11
12
13 class DummyMD5Authorizer(ftpserver.DummyAuthorizer):
14
15 def validate_authentication(self, username, password):
16 hash = md5.new(password).hexdigest()
17 return self.user_table[username]['pwd'] == hash
18
19 if __name__ == "__main__":
20 # get a hash digest from a clear-text password
21 hash = md5.new('12345').hexdigest()
22 authorizer = DummyMD5Authorizer()
23 authorizer.add_user('user', hash, os.getcwd(), perm='elradfmw')
24 authorizer.add_anonymous(os.getcwd())
25 ftp_handler = ftpserver.FTPHandler
26 ftp_handler.authorizer = authorizer
27 address = ('', 21)
28 ftpd = ftpserver.FTPServer(address, ftp_handler)
29 ftpd.serve_forever()
OLDNEW
« no previous file with comments | « third_party/pyftpdlib/demo/basic_ftpd.py ('k') | third_party/pyftpdlib/demo/throttled_ftpd.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698