示例#1
0
 def received_message(self, m):
   if m.data == "getactive":
     active = self.parent.botnetserver.getactive
     cherrypy.log("ui: " + str(active))
     for v in active():
       self.__class__.sendall(common.phoneStatusUpdate(v))
       self.__class__.sendall(common.commandListUpdate(v))
示例#2
0
    def close(self, code, reason):
      v = self.parent.botnetserver.statuses[self.phone]
      if v.videostatus == common.VideoStatus.RECORDING: self.stop()
      v.videostatus = common.VideoStatus.NOTSENDING
      self.parent.uicls.sendall(common.phoneStatusUpdate(v))

      self.__class__.phones[self.phone].remove(self)

      super(self.__class__, self).close()
示例#3
0
 def updatestatus(self, serial, status, model, port, servercommands):
   knowyou = True
   try: self.statuses[str(serial)]
   except KeyError:
     knowyou = False
     self.statuses[str(serial)] = common.Phone(str(model), status=="on", int(port), request.remote.ip, json.loads(servercommands), str(serial), common.VideoStatus.NOTSENDING)
    
   p = self.statuses[str(serial)]
   self.uicommchannel(common.phoneStatusUpdate(p))
   self.uicommchannel(common.commandListUpdate(p))
   return "ok, " + ("already know you" if knowyou else "don't know you")
示例#4
0
    def stop(self):
      e = common.VideoStatus
      v = self.parent.botnetserver.statuses[self.phone]
      if not (v.videostatus == e.RECORDING):
        cherrypy.log("tried stopping video that isn't recording!")
        return

      path = self.gen_video(v.serial)
      self.parent.uicls.sendall(common.newVideo(path,v))

      v.videostatus = e.SENDING
      self.parent.uicls.sendall(common.phoneStatusUpdate(v))
示例#5
0
 def opened(self):
   super(self.__class__, self).opened()
   try:
     phonesenlist = self.__class__.phones[self.phone]
   except KeyError:
     phonesenlist = self.__class__.phones[self.phone] = []
   phonesenlist.append(self)
   try: 
     v = self.parent.botnetserver.statuses[self.phone]
   except KeyError:
     raise Exception("this phone wasn't registered in the status register! i.e. /updatestatus wasn't called")
   v.videostatus = common.VideoStatus.SENDING
   self.parent.uicls.sendall(common.phoneStatusUpdate(v))
示例#6
0
 def start(self):
   try: 
     v = self.parent.botnetserver.statuses[self.phone]
   except KeyError:
     cherrypy.log("starting nonexistant phone")
     return
   e = common.VideoStatus
   if not v.videostatus in [e.SENDING]:
     cherrypy.log("can't start phone not sending")
     return
   v.videostatus = e.RECORDING
   self.frameno = 0
   self.parent.uicls.sendall(common.phoneStatusUpdate(v))