uh = unix_user_handler.unix_user_handler ('public_html') hs.install_handler (uh) # =========================================================================== # FTP Server # =========================================================================== # Here we create an 'anonymous' ftp server. # Note: the ftp server is read-only by default. [in this mode, all # 'write-capable' commands are unavailable] ftp = ftp_server.ftp_server ( ftp_server.anon_authorizer ( PUBLISHING_ROOT ), ip=IP_ADDRESS, port=FTP_PORT, resolver=rs, logger_object=lg ) # =========================================================================== # Monitor Server: # =========================================================================== # This creates a secure monitor server, binding to the loopback # address on port 9999, with password 'fnord'. The monitor server # can be used to examine and control the server while it is running. # If you wish to access the server from another machine, you will # need to use '' or some other IP instead of '127.0.0.1'. ms = monitor.secure_monitor_server ('fnord', '127.0.0.1', MONITOR_PORT)
def start_Server(): # ftpServ = ftp_server.ftp_server( ftp_server.anon_authorizer( "D:\MyDocuments\MyDownloads"), port=21 ) ftpServ = ftp_server.ftp_server( Win32Authorizer(), port=21 ) asyncore.loop()
else: import supervisor.medusa.monitor as monitor import supervisor.medusa.filesys as filesys import supervisor.medusa.default_handler as default_handler import supervisor.medusa.ftp_server as ftp_server import supervisor.medusa.chat_server as chat_server import supervisor.medusa.resolver as resolver rs = resolver.caching_resolver('127.0.0.1') lg = logger.file_logger(sys.stdout) ms = monitor.secure_monitor_server('fnord', '127.0.0.1', 9999) fs = filesys.os_filesystem(sys.argv[1]) dh = default_handler.default_handler(fs) hs = http_server('', int(sys.argv[2]), rs, lg) hs.install_handler(dh) ftp = ftp_server.ftp_server(ftp_server.dummy_authorizer(sys.argv[1]), port=8021, resolver=rs, logger_object=lg) cs = chat_server.chat_server('', 7777) if '-p' in sys.argv: def profile_loop(): try: asyncore.loop() except KeyboardInterrupt: pass import profile profile.run('profile_loop()', 'profile.out') else: asyncore.loop()
if os.name == 'posix': from supervisor.medusa import unix_user_handler uh = unix_user_handler.unix_user_handler('public_html') hs.install_handler(uh) # =========================================================================== # FTP Server # =========================================================================== # Here we create an 'anonymous' ftp server. # Note: the ftp server is read-only by default. [in this mode, all # 'write-capable' commands are unavailable] ftp = ftp_server.ftp_server(ftp_server.anon_authorizer(PUBLISHING_ROOT), ip=IP_ADDRESS, port=FTP_PORT, resolver=rs, logger_object=lg) # =========================================================================== # Monitor Server: # =========================================================================== # This creates a secure monitor server, binding to the loopback # address on port 9999, with password 'fnord'. The monitor server # can be used to examine and control the server while it is running. # If you wish to access the server from another machine, you will # need to use '' or some other IP instead of '127.0.0.1'. ms = monitor.secure_monitor_server('fnord', '127.0.0.1', MONITOR_PORT) # ===========================================================================
# -*- Mode: Python -*- from supervisor.medusa import asyncore_25 as asyncore from supervisor.medusa import ftp_server # create a 'dummy' authorizer (one that lets everyone in) that returns # a read-only filesystem rooted at '/home/ftp' authorizer = ftp_server.dummy_authorizer('/home/ftp') # Create an ftp server using this authorizer, running on port 8021 # [the standard port is 21, but you are probably already running # a server there] fs = ftp_server.ftp_server(authorizer, port=8021) # Run the async main loop asyncore.loop() # to test this server, try # $ ftp myhost 8021 # when using the standard bsd ftp client, # $ ncftp -p 8021 myhost # when using ncftp, and # ftp://myhost:8021/ # from a web browser.
import supervisor.medusa.default_handler as default_handler import supervisor.medusa.status_handler as status_handler import supervisor.medusa.ftp_server as ftp_server import supervisor.medusa.chat_server as chat_server import supervisor.medusa.resolver as resolver import supervisor.medusa.logger as logger rs = resolver.caching_resolver ('127.0.0.1') lg = logger.file_logger (sys.stdout) ms = monitor.secure_monitor_server ('fnord', '127.0.0.1', 9999) fs = filesys.os_filesystem (sys.argv[1]) dh = default_handler.default_handler (fs) hs = http_server ('', int(sys.argv[2]), rs, lg) hs.install_handler (dh) ftp = ftp_server.ftp_server ( ftp_server.dummy_authorizer(sys.argv[1]), port=8021, resolver=rs, logger_object=lg ) cs = chat_server.chat_server ('', 7777) sh = status_handler.status_extension([hs,ms,ftp,cs,rs]) hs.install_handler (sh) if '-p' in sys.argv: def profile_loop (): try: asyncore.loop() except KeyboardInterrupt: pass import profile profile.run ('profile_loop()', 'profile.out') else: asyncore.loop()
def start_Server(): # ftpServ = ftp_server.ftp_server( ftp_server.anon_authorizer( "D:\MyDocuments\MyDownloads"), port=21 ) ftpServ = ftp_server.ftp_server(Win32Authorizer(), port=21) asyncore.loop()