Ejemplo n.º 1
0
 def __create_blank_user__():
     """
     当传入的已登录设备信息不可用时,虚拟一个空的未登录设备
     :return: 空设备信息
     """
     rsa_keys = rsa.create_key_pair(1024)
     return {
         'appKey': '',
         'sessionId': '',
         'exchangeFlag': True,
         'login': False,
         'serverPublicKey': '',
         'deviceId': str(random.randint(999999999999999, 9999999999999999)),
         'wanxiaoVersion': 10462101,
         'rsaKey': {
             'private': rsa_keys[1],
             'public': rsa_keys[0]
         }
     }
Ejemplo n.º 2
0
 def create_blank_user(self):
     '''
     当传入的已登录设备信息不可用时,虚拟一个空的未登录设备
     :return: 空设备信息
     '''
     rsa_keys = rsa.create_key_pair(1024)
     return {
         'appKey': '',
         'sessionId': '',
         'exchangeFlag': True,
         'login': False,
         'serverPublicKey': '',
         'deviceId': ‘866174014992651’,
         'wanxiaoVersion': 10531102,
         'rsaKey': {
             'private': rsa_keys[1],
             'public': rsa_keys[0]
         }
     }
Ejemplo n.º 3
0
 def exchange_secret(self):
     """
     交换密钥
     :return: if fail, raise error
     """
     rsa_keys = rsa.create_key_pair(1024)
     try:
         resp = requests.post(
             'https://app.17wanxiao.com/campus/cam_iface46/exchangeSecretkey.action',
             headers={'User-Agent': self.login_info['userAgent']},
             json={'key': rsa_keys[0]},
             verify=False,
             timeout=30)
         session_info = json.loads(
             rsa.rsa_decrypt(resp.text.encode(resp.apparent_encoding),
                             rsa_keys[1]))
         self.login_info['sessionId'] = session_info['session']
         self.login_info['appKey'] = session_info['key'][:24]
     except Exception as e:
         raise e.__class__("完美校园交换密钥失败", e)