Ejemplo n.º 1
0
 def __loadCommands(self):
     toggleCommandHandler = CLIShell.CommandHandler("toggle","Toggle between raw and advanced connection",self.__toggleConnection)
     reprogramCommandHandler = CLIShell.CommandHandler("reprogram", "Reprogram the bot's subsystems", defaultCb=self.__reprogram)
     getstatusCommandHandler = CLIShell.CommandHandler("status", "Get the bot's subsystems' status", defaultCb=self.__checkStatus)
     changePasswordCommandHandler = CLIShell.CommandHandler("passwd", "Change the bot's password", defaultCb=self.__changePassword)
     
     self.registerCommand(toggleCommandHandler)
     self.registerCommand(reprogramCommandHandler)
     self.registerCommand(getstatusCommandHandler)
     self.registerCommand(changePasswordCommandHandler)
Ejemplo n.º 2
0
    def connectionMade(self):
        moveCommandHandler = CLIShell.CommandHandler(
            "move",
            "Tell the bot to move (1=North, 2=South, 3=East, 4=West)",
            mode=CLIShell.CommandHandler.SINGLETON_MODE,
            defaultCb=self.__sendBotMove)
        lookCommandHandler = CLIShell.CommandHandler("look",
                                                     "Tell the Bot to scan",
                                                     self.__sendBotLook)
        workCommandHandler = CLIShell.CommandHandler("work",
                                                     "Tell the Bot to work",
                                                     self.__sendBotWork)
        inventoryCommandHandler = CLIShell.CommandHandler(
            "inventory", "Get the bot's inventory", self.__sendBotInventory)
        unloadCommandHandler = CLIShell.CommandHandler(
            "unload", "Tell the Bot to unload inventory", self.__sendBotUnload)
        locationCommandHandler = CLIShell.CommandHandler(
            "location", "Get the bot's location", self.__sendBotLocation)

        self.registerCommand(moveCommandHandler)
        self.registerCommand(lookCommandHandler)
        self.registerCommand(workCommandHandler)
        self.registerCommand(unloadCommandHandler)
        self.registerCommand(locationCommandHandler)
        self.registerCommand(inventoryCommandHandler)

        networkSettings = PlaygroundNetworkSettings()
        networkSettings.configureNetworkStackFromPath("./ProtocolStack")
        playgroundEndpoint = GateServerEndpoint(reactor, 10001,
                                                networkSettings)
        playgroundEndpoint.listen(self)

        self.deferToResponse = Deferred()
Ejemplo n.º 3
0
    def connectionMade(self):
        hackedCommandHandler = CLIShell.CommandHandler(
            "hack", "Notify the C&C they've been hacked", self.__hack)

        self.registerCommand(hackedCommandHandler)

        networkSettings = PlaygroundNetworkSettings()
        networkSettings.configureNetworkStackFromPath("./ProtocolStack")
        networkSettings.requestSpecificAddress(self.hostaddr)
        playgroundEndpoint = GateClientEndpoint(reactor, self.peeraddr, 10001,
                                                networkSettings)
        self.__protocol = SimpleCommandAndControlProtocol()
        self.__protocol.factory = self
        self.__d = connectProtocol(playgroundEndpoint, self.__protocol)
        self.__d.addCallback(self.candcConnectionMade)

        self.deferToResponse = Deferred()