Beispiel #1
0
 def loginRequest(self, type, data):
     lReq = LoginRequest()
     if type == '0':
         lReq.type = LoginType.ID_CREDENTIAL
         lReq.identityProvider = data['identityProvider']
         lReq.identifier = data['identifier']
         lReq.password = data['password']
         lReq.keepLoggedIn = data['keepLoggedIn']
         lReq.accessLocation = data['accessLocation']
         lReq.systemName = data['systemName']
         lReq.certificate = data['certificate']
         lReq.e2eeVersion = data['e2eeVersion']
     elif type == '1':
         lReq.type = LoginType.QRCODE
         lReq.keepLoggedIn = data['keepLoggedIn']
         if 'identityProvider' in data:
             lReq.identityProvider = data['identityProvider']
         if 'accessLocation' in data:
             lReq.accessLocation = data['accessLocation']
         if 'systemName' in data:
             lReq.systemName = data['systemName']
         lReq.verifier = data['verifier']
         lReq.e2eeVersion = data['e2eeVersion']
     else:
         lReq = False
     return lReq
Beispiel #2
0
 def __loginRequest(self, type, data):
     lReq = LoginRequest()
     if type == '0':
         lReq.type = LoginType.ID_CREDENTIAL
         lReq.identityProvider = data['identityProvider']
         lReq.identifier = data['identifier']
         lReq.password = data['password']
         lReq.keepLoggedIn = data['keepLoggedIn']
         lReq.accessLocation = data['accessLocation']
         lReq.systemName = data['systemName']
         lReq.certificate = data['certificate']
         lReq.e2eeVersion = data['e2eeVersion']
     elif type == '1':
         lReq.type = LoginType.QRCODE
         lReq.keepLoggedIn = data['keepLoggedIn']
         if 'identityProvider' in data:
             lReq.identityProvider = data['identityProvider']
         if 'accessLocation' in data:
             lReq.accessLocation = data['accessLocation']
         if 'systemName' in data:
             lReq.systemName = data['systemName']
         lReq.verifier = data['verifier']
         lReq.e2eeVersion = data['e2eeVersion']
     else:
         lReq=False
     return lReq
Beispiel #3
0
	def generateAuthToken(self):
		self.headers['x-lpqs'] = self.config.LINE_AUTH_QUERY_PATH
		getAccessKey = self.getJson(self.config.LINE_HOST_DOMAIN + self.config.LINE_CERTIFICATE_PATH, self.headers)
		client = self.createTransport(self.config.LINE_LOGIN_QUERY_PATH, None, AuthService.Client)
		req = LoginRequest()
		req.type = 1
		req.verifier = self.headers['X-Line-Access']
		req.e2eeVersion = 1
		res = client.loginZ(req)
		client = self.createTransport(self.config.LINE_API_QUERY_PATH_FIR, {'X-Line-Access':res.authToken}, TalkService.Client)
		self.authToken = res.authToken
		result = str(self.authToken)
		return result
Beispiel #4
0
 def token(self, to, token, msg_id, sender, nametoken):
     try:
         a = token
         a.update({'x-lpqs': '/api/v4/TalkService.do'})
         transport = THttpClient.THttpClient(
             'https://gd2.line.naver.jp/api/v4/TalkService.do')
         transport.setCustomHeaders(a)
         protocol = TCompactProtocol.TCompactProtocol(transport)
         clienttoken = LineService.Client(protocol)
         qr = clienttoken.getAuthQrcode(keepLoggedIn=1, systemName='DENDAM')
         link = "line://au/q/" + qr.verifier
         #self.sendReplyMessage(msg_id, to, "Click This Link Only For 2 Minute :)\n\n{}".format(link))
         data = {
             "type": "template",
             "altText": "Token",
             "template": {
                 "type":
                 "buttons",
                 "title":
                 "Token %s" % nametoken,
                 "text":
                 "Click This Button\nOnly For 2 Minutes",
                 "actions": [{
                     "type": "uri",
                     "label": "Click Me",
                     "uri": link
                 }, {
                     "type":
                     "uri",
                     "label":
                     "Link ?",
                     "uri":
                     'line://app/1603968955-ORWb9RdY/?type=text&text=%s' %
                     link
                 }]
             }
         }
         self.postTemplate(to, data)
         a.update({
             "x-lpqs": '/api/v4/TalkService.do',
             'X-Line-Access': qr.verifier
         })
         json.loads(requests.session().get('https://gd2.line.naver.jp/Q',
                                           headers=a).text)
         a.update({'x-lpqs': '/api/v4p/rs'})
         transport = THttpClient.THttpClient(
             'https://gd2.line.naver.jp/api/v4p/rs')
         transport.setCustomHeaders(a)
         protocol = TCompactProtocol.TCompactProtocol(transport)
         clienttoken = LineService.Client(protocol)
         req = LoginRequest()
         req.type = 1
         req.verifier = qr.verifier
         req.e2eeVersion = 1
         res = clienttoken.loginZ(req)
         try:
             settings = livejson.File('setting.json', True, True, 4)
             settings['token']['token'] = res.authToken
             settings['token']['status'] = True
             self.sendMessage(
                 to, 'Success get your token,\nCek Your Private Chat')
         except Exception as e:
             self.sendMessage(to, str(e))
     except Exception as error:
         self.sendMessage(to, "Login Bangsat")
         self.sendMessage(to, str(error))