Exemplo n.º 1
0
def main():
    port = 6687
    server_factory = CollabServerFactory()
    shell_factory = ShellFactory()

    server_endpoint = TCP4ServerEndpoint(reactor, port)

    shell_factory.username = ""
    shell_factory.password = ""

    def get_client():
        for i in server_factory.protocols:
            return server_factory.protocols[i]

    def run_packets():
        c = get_client()
        c.document_added(add_packet)
        c.document_opened(open_packet)
        c.text_modified(text_mod_packet)
    shell_factory.namespace['get_client'] = get_client
    shell_factory.namespace['runp'] = run_packets
    shell_factory.namespace['factory'] = server_factory

    server_connection = server_endpoint.listen(server_factory)
    shell_connection = reactor.listenTCP(6684, shell_factory)
    reactor.run()
Exemplo n.º 2
0
def main():
    port = 6687
    address = '127.0.0.1'

    collab_factory = PollFactory()
    shell_factory = ShellFactory()

    shell_factory.username = ""
    shell_factory.password = ""

    def get_client():
        for i in collab_factory.protocols:
            return collab_factory.protocols[i]

    def run_packets():
        c = get_client()
        c.transport.write(add_packet)
        c.transport.write(open_packet)
        c.transport.write(text_mod_packet)
    shell_factory.namespace['factory'] = collab_factory
    shell_factory.namespace['get_client'] = get_client
    shell_factory.namespace['runp'] = run_packets
    shell_factory.namespace.update(packets)

    collab_connection = collab_factory.connect_to_server(address, port)
    manhole_connection = reactor.listenTCP(6686, shell_factory)

    reactor.run()
Exemplo n.º 3
0
    def enable(self):
        log.debug ("Manhole: Enabled")
        self.config = deluge.configmanager.ConfigManager("manhole.conf", DEFAULT_PREFS)

        sf = ShellFactory()
        sf.username = self.config['username']
        sf.password = self.config['password']

        self.listenport = reactor.listenTCP(self.config['port'], sf)
Exemplo n.º 4
0
def main():
    port = 6687
    address = '127.0.0.1'

    collab_factory = CollabClientFactory()
    shell_factory = ShellFactory()

    shell_factory.username = ""
    shell_factory.password = ""
    shell_factory.namespace['factory'] = collab_factory
    shell_factory.namespace.update(packets)

    collab_connection = collab_factory.connect_to_server(address, port)
    manhole_connection = reactor.listenTCP(6686, shell_factory)

    reactor.run()
Exemplo n.º 5
0
    def makeService(self, options):
        """
        Construct a TCPServer from a factory defined in myproject.
        """
        s = MultiService()

        irp = internet.TCPServer(int(options["port"]), IRPServerFactory())
        irp.setServiceParent(s)

        manholeFactory = ShellFactory()
        manholeFactory.username = "******"
        manholeFactory.password = "******"
        manholeFactory.namespace["foo"] = 12
        manholeService = internet.TCPServer(8000, manholeFactory)
        manholeService.setServiceParent(s)

        return s
Exemplo n.º 6
0
    reactor.addSystemEventTrigger('during', 'shutdown', beforeandaftershutdown, 'During')
    reactor.addSystemEventTrigger('after', 'shutdown', beforeandaftershutdown, 'After')

if config.rpc_enabled:
    internet.TCPServer(
        config.rpc_port, server.Site(s.getRPC()),
        interface="127.0.0.1").setServiceParent(serviceCollection)

if config.statsd:
    from bnw.core import statsd
    hostport = config.statsd.split(':',1)
    statsd.setup(hostport[0], int(hostport[1]))

if config.manhole:
    shell_factory = ShellFactory()
    shell_factory.password = config.manhole
    shell_tcp_server = internet.TCPServer(4040, shell_factory, interface="127.0.0.1")
    shell_tcp_server.setServiceParent(serviceCollection)

if config.webui_enabled:
    import bnw.web.site
    http_server = bnw.web.site.get_site()
    http_server.listen(config.webui_port, "127.0.0.1")

bnw.core.base.timertime = 0
def checkload(lasttime):
    currenttime = time()
    if lasttime is not None:
        bnw.core.base.timertime = currenttime - lasttime
    reactor.callLater(1, checkload, currenttime)
checkload(None)
Exemplo n.º 7
0
def start(reactor, namespace, port, username, password):
    shell_factory = ShellFactory()
    shell_factory.username = username
    shell_factory.password = password
    shell_factory.namespace = namespace
    reactor.listenTCP(port, shell_factory)