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

Unified 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 12 years 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/pyftpdlib/demo/md5_ftpd.py
===================================================================
--- third_party/pyftpdlib/demo/md5_ftpd.py (revision 0)
+++ third_party/pyftpdlib/demo/md5_ftpd.py (revision 0)
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+# md5_ftpd.py
+
+"""A basic ftpd storing passwords as hash digests (platform independent).
+"""
+
+import md5
+import os
+
+from pyftpdlib import ftpserver
+
+
+class DummyMD5Authorizer(ftpserver.DummyAuthorizer):
+
+ def validate_authentication(self, username, password):
+ hash = md5.new(password).hexdigest()
+ return self.user_table[username]['pwd'] == hash
+
+if __name__ == "__main__":
+ # get a hash digest from a clear-text password
+ hash = md5.new('12345').hexdigest()
+ authorizer = DummyMD5Authorizer()
+ authorizer.add_user('user', hash, os.getcwd(), perm='elradfmw')
+ authorizer.add_anonymous(os.getcwd())
+ ftp_handler = ftpserver.FTPHandler
+ ftp_handler.authorizer = authorizer
+ address = ('', 21)
+ ftpd = ftpserver.FTPServer(address, ftp_handler)
+ ftpd.serve_forever()
« 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