Example #1
0
 def __init__(self, params=None):
     if not params:
         #head
         super(self.__class__, self).__init__()
         self.opcode = KidSockOpcode.s_cookies
         self.type = 1
         # body
         self.manager_id = current_device_manager.get_manager_id()
         self.attr_id = 0
         self.cookies = []
         return
     params = super(self.__class__, self).compress_encrypt(params, False)
     str_head = params[0:SockHead.sock_head_len]
     str_body = params[SockHead.sock_head_len:]
     super(self.__class__, self).__init__(str_head)
     (self.manager_id,
      self.attr_id,
      str_body) = struct.unpack(self.__struct_analysis_rule % (len(str_body)-4-8),
                                  str_body)
     self.cookies = []
     while str_body:
         cookie_len = struct.unpack('=H', str_body[:2])[0]
         str_cookie = str_body[0:cookie_len+2]
         cookie_info = Coookie(str_cookie)
         self.cookies.append(cookie_info)
         str_body = str_body[cookie_len+2:]
Example #2
0
 def __init__(self, params=None):
     if params == None:
         #head
         super(self.__class__, self).__init__()
         self.opcode = KidSockOpcode.c_data_save_info
         self.type = 1
         # body
         self.manager_id = current_device_manager.get_manager_id()
         self.token = current_device_manager.get_token()
         self.storages = []
         return
     params = super(self.__class__, self).compress_encrypt(params, False)
     str_head = params[0:SockHead.sock_head_len]
     str_body = params[SockHead.sock_head_len:]
     str_no_storages = str_body[0:struct.
                                calcsize(self.__struct_analysis_rule_no_kv)]
     super(self.__class__, self).__init__(str_head)
     (self.manager_id,
      self.token) = struct.unpack(self.__struct_analysis_rule_no_kv,
                                  str_no_storages)
     str_storages = str_body[struct.calcsize(self.
                                             __struct_analysis_rule_no_kv):]
     self.storages = []
     while str_storages:
         str_storage = str_storages[0:StorageInfo.storage_info_length]
         storage = StorageInfo(str_storage)
         self.storages.append(storage)
         str_storages = str_storages[StorageInfo.storage_info_length:]
Example #3
0
 def __init__(self, params=None):
     if not params:
         #head
         super(self.__class__, self).__init__()
         self.opcode = KidSockOpcode.s_IP_info
         self.type = 1
         # body
         self.manager_id = current_device_manager.get_manager_id()
         self.job_id = 0
         self.forge_info = []
         return
     params = super(self.__class__, self).compress_encrypt(params, False)
     str_head = params[0:SockHead.sock_head_len]
     str_body = params[SockHead.sock_head_len:]
     super(self.__class__, self).__init__(str_head)
     (self.manager_id,
     self.job_id,
     str_body) = struct.unpack(self.__struct_analysis_rule % (len(str_body)-4-8),
                              str_body)
     self.forge_info = []
     while str_body:
         str_task = str_body[0:IPInfo.ip_info_length]
         forge_info = IPInfo(str_task)
         self.forge_info.append(forge_info)
         str_body = str_body[IPInfo.ip_info_length:]
Example #4
0
 def __init__(self, params=None):
     if params == None:
         #head
         super(self.__class__, self).__init__()
         self.opcode = KidSockOpcode.s_crawling_amount
         self.type = 1
         # body
         self.manager_id = current_device_manager.get_manager_id()
         self.job_id = 0
         return
     params = super(self.__class__, self).compress_encrypt(params, False)
     str_head = params[0:SockHead.sock_head_len]
     str_body = params[SockHead.sock_head_len:]
     super(self.__class__, self).__init__(str_head)
     (self.manager_id,
      self.job_id) = struct.unpack(self.__struct_analysis_rule, str_body)
Example #5
0
 def __init__(self, params=None):
     if params == None:
         #head
         super(self.__class__, self).__init__()
         self.opcode = KidSockOpcode.c_device_info
         self.type = 1
         # body
         self.manager_id = current_device_manager.get_manager_id()
         self.token = current_device_manager.get_token()
         self.cpu = str(current_device_manager.get_cpu_usage())
         self.mem = str(current_device_manager.get_mem_usage())
         return
     params = super(self.__class__, self).compress_encrypt(params, False)
     str_head = params[0:SockHead.sock_head_len]
     str_body = params[SockHead.sock_head_len:]
     super(self.__class__, self).__init__(str_head)
     (self.manager_id, self.token, self.cpu,
      self.mem) = struct.unpack(self.__struct_analysis_rule, str_body)
Example #6
0
 def __init__(self, params=None):
     if params == None:
         #head
         super(self.__class__, self).__init__()
         self.opcode = KidSockOpcode.c_achieve_UA_IP
         self.type = 1
         # body
         self.manager_id = current_device_manager.get_manager_id()
         self.token = current_device_manager.get_token()
         self.job_id = 0
         self.state = 0
         self.num = 0
         return
     params = super(self.__class__, self).compress_encrypt(params, False)
     str_head = params[0:SockHead.sock_head_len]
     str_body = params[SockHead.sock_head_len:]
     super(self.__class__, self).__init__(str_head)
     (self.manager_id, self.token, self.job_id, self.state,
      self.num) = struct.unpack(self.__struct_analysis_rule, str_body)
Example #7
0
 def __init__(self, params=None):
     if params == None:
         #head
         super(self.__class__, self).__init__()
         self.opcode = KidSockOpcode.s_distribute_task
         self.type = 1
         # body
         self.manager_id = current_device_manager.get_manager_id()
         self.tasks = []
         return
     params = super(self.__class__, self).compress_encrypt(params, False)
     str_head = params[0:SockHead.sock_head_len]
     str_body = params[SockHead.sock_head_len:]
     super(self.__class__, self).__init__(str_head)
     (self.manager_id,
     str_body) = struct.unpack(self.__struct_analysis_rule % (len(str_body)-4),
                               str_body)
     self.tasks = []
     while str_body:
         str_task = str_body[0:TaskInfo.task_info_length]
         task = TaskInfo(str_task)
         self.tasks.append(task)
         str_body = str_body[TaskInfo.task_info_length:]