예제 #1
0
		import ftp_server
		import chat_server
		import resolver
		import 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 ('', string.atoi (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()
예제 #2
0
hss = https_server.https_server('', HTTPS_PORT, ssl_ctx)

fs = filesys.os_filesystem(os.path.abspath(os.curdir))
#fs=filesys.os_filesystem('/usr/local/pkg/apache/htdocs')
#fs=filesys.os_filesystem('c:/pkg/jdk130/docs')
dh = default_handler.default_handler(fs)
hs.install_handler(dh)
hss.install_handler(dh)

#class rpc_demo (xmlrpc_handler.xmlrpc_handler):
#    def call (self, method, params):
#        print 'method="%s" params=%s' % (method, params)
#        return "Sure, that works"
#rpch = rpc_demo()
#hs.install_handler(rpch)
#hss.install_handler(rpch)

ph = poison_handler.poison_handler(10)
hs.install_handler(ph)
hss.install_handler(ph)

fauthz = ftp_server.anon_authorizer('/usr/local/pkg/apache/htdocs')
ftps = ftps_server.ftp_tls_server(fauthz, ssl_ctx, port=FTP_PORT)

sh = status_handler.status_extension([hs, hss, ftps])
hs.install_handler(sh)
hss.install_handler(sh)

asyncore.loop()
Rand.save_file('../randpool.dat')
예제 #3
0
        import ftp_server
        import chat_server
        import resolver
        import 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 ('', string.atoi (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()
예제 #4
0
fs=filesys.os_filesystem(os.path.abspath(os.curdir))
#fs=filesys.os_filesystem('/usr/local/pkg/apache/htdocs')
#fs=filesys.os_filesystem('c:/pkg/jdk118/docs')
dh=default_handler.default_handler(fs)
hs.install_handler(dh)
hss.install_handler(dh)

# Cribbed from xmlrpc_handler.py.
# This is where you implement your RPC functionality.
class rpc_demo (xmlrpc_handler.xmlrpc_handler):
    def call (self, method, params):
        print 'method="%s" params=%s' % (method, params)
        return "Sure, that works"

rpch = rpc_demo()
hs.install_handler(rpch)
hss.install_handler(rpch)

ph=poison_handler.poison_handler(10)
hs.install_handler(ph)
hss.install_handler(ph)

sh=status_handler.status_extension([hss])
hs.install_handler(sh)
hss.install_handler(sh)

asyncore.loop()
Rand.save_file('../randpool.dat')

예제 #5
0
fs = filesys.os_filesystem(os.path.abspath(os.curdir))
#fs=filesys.os_filesystem('/usr/local/pkg/apache/htdocs')
#fs=filesys.os_filesystem('c:/pkg/jdk118/docs')
dh = default_handler.default_handler(fs)
hs.install_handler(dh)
hss.install_handler(dh)


# Cribbed from xmlrpc_handler.py.
# This is where you implement your RPC functionality.
class rpc_demo(xmlrpc_handler.xmlrpc_handler):
    def call(self, method, params):
        print 'method="%s" params=%s' % (method, params)
        return "Sure, that works"


rpch = rpc_demo()
hs.install_handler(rpch)
hss.install_handler(rpch)

ph = poison_handler.poison_handler(10)
hs.install_handler(ph)
hss.install_handler(ph)

sh = status_handler.status_extension([hss])
hs.install_handler(sh)
hss.install_handler(sh)

asyncore.loop()
Rand.save_file('../randpool.dat')
예제 #6
0
# These are objects that can report their status via the HTTP server.
# You may comment out any of these, or add more of your own.  The only
# requirement for a 'status-reporting' object is that it have a method
# 'status' that will return a producer, which will generate an HTML
# description of the status of the object.

status_objects = [
	hs,
#	ftp,
	ms,
	rs,
	lg
	]

# Create a status handler.  By default it binds to the URI '/status'...
sh = status_handler.status_extension(status_objects)
# ... and install it on the web server.
hs.install_handler (sh)

# become 'nobody'
if os.name == 'posix':
	import os
	if hasattr (os, 'seteuid'):
		# look in ~medusa/patches for {set,get}euid.
		import pwd
		[uid, gid] = pwd.getpwnam ('nobody')[2:4]
		os.seteuid (uid)
		os.setegid (gid)

# Finally, start up the server loop!  This loop will not exit until
# all clients and servers are closed.  You may cleanly shut the system
예제 #7
0
파일: START.py 프로젝트: mdlx/M2Crypto
#fs=filesys.os_filesystem(os.path.abspath(os.curdir))
fs=filesys.os_filesystem('/usr/local/pkg/apache/htdocs')
#fs=filesys.os_filesystem('c:/pkg/jdk130/docs')
dh=default_handler.default_handler(fs)
hs.install_handler(dh)
hss.install_handler(dh)

#class rpc_demo (xmlrpc_handler.xmlrpc_handler):
#    def call (self, method, params):
#        print 'method="%s" params=%s' % (method, params)
#        return "Sure, that works"
#rpch = rpc_demo()
#hs.install_handler(rpch)
#hss.install_handler(rpch)

ph=poison_handler.poison_handler(10)
hs.install_handler(ph)
hss.install_handler(ph)

fauthz = ftp_server.anon_authorizer('/usr/local/pkg/apache/htdocs')
ftps = ftps_server.ftp_tls_server(fauthz, ssl_ctx, port=FTP_PORT)

sh=status_handler.status_extension([hs, hss, ftps])
hs.install_handler(sh)
hss.install_handler(sh)

asyncore.loop()
Rand.save_file('../randpool.dat')

예제 #8
0
# These are objects that can report their status via the HTTP server.
# You may comment out any of these, or add more of your own.  The only
# requirement for a 'status-reporting' object is that it have a method
# 'status' that will return a producer, which will generate an HTML
# description of the status of the object.

status_objects = [
    hs,
    #	ftp,
    ms,
    rs,
    lg
]

# Create a status handler.  By default it binds to the URI '/status'...
sh = status_handler.status_extension(status_objects)
# ... and install it on the web server.
hs.install_handler(sh)

# become 'nobody'
if os.name == 'posix':
    import os
    if hasattr(os, 'seteuid'):
        # look in ~medusa/patches for {set,get}euid.
        import pwd
        [uid, gid] = pwd.getpwnam('nobody')[2:4]
        os.seteuid(uid)
        os.setegid(gid)

# Finally, start up the server loop!  This loop will not exit until
# all clients and servers are closed.  You may cleanly shut the system