示例#1
0
 def __init__(self, botAddress):
     CLIShell.__init__(self, prompt=self.PROMPT)
     self.__botAddress = botAddress
     self.__connectPort = self.RAW_PORT
     self.protocol = None
     self.password = "******"
     self.toPassword = "******"
 def __init__(self, botAddress):
     CLIShell.__init__(self, prompt=self.PROMPT)
     self.__botAddress = botAddress
     self.__connectPort = self.RAW_PORT
     self.protocol = None
     self.password = "******"
     self.toPassword = "******"
     self.deferreds = []
     self.success = False
     self.finalAddr = "notsetyet"
示例#3
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)
示例#4
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()
示例#5
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()
示例#6
0
 def __init__(self, botAddress, password="******"):
     CLIShell.__init__(self, prompt=self.PROMPT)
     self.__botAddress = botAddress
     self.__connectPort = self.RAW_PORT
     self.__protocol = None
     self.__password = password
示例#7
0
 def __init__(self, fromaddr, candcaddr):
     CLIShell.__init__(self, prompt="[NOT CONNECTED] >> ")
     self.__protocol = None
     self.__reqId = 1
     self.peeraddr = candcaddr
     self.hostaddr = fromaddr
示例#8
0
 def __init__(self):
     CLIShell.__init__(self, prompt="[NOT CONNECTED] >> ")
     self.__protocol = None
     self.__reqId = 1