Advertisement
kohpriwniranam

qr

Sep 10th, 2023
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.61 KB | None | 0 0
  1. import requests
  2. import urllib.parse
  3.  
  4. class NewQRLogin:
  5. API_URL = "https://api.lrtt.icu/secondaryQrCodeLogin.do"
  6. HEADERS = {
  7. "android_lite": {
  8. "User-Agent": "LLA/2.12.0 SKR-H0 9",
  9. "X-Line-Application": "ANDROIDLITE\t2.12.0\tAndroid OS\t9;SECONDARY"
  10. },
  11. "android": {
  12. "User-Agent": "Line/10.6.2",
  13. "X-Line-Application": "ANDROID\t10.6.2\tAndroid OS\t10"
  14. },
  15. "ios_ipad": {
  16. "User-Agent": "Line/10.1.1",
  17. "X-Line-Application": "IOSIPAD\t10.1.1\tiPhone 8\t11.2.5"
  18. },
  19. "ios": {
  20. "User-Agent": "Line/10.1.1",
  21. "X-Line-Application": "IOS\t10.1.1\tiPhone 8\t11.2.5"
  22. },
  23. "chrome": {
  24. "User-Agent": "MozilX-Line-Application/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36",
  25. "X-Line-Application": "CHROMEOS\t2.3.2\tChrome OS\t1"
  26. },
  27. "desktopwin": {
  28. "User-Agent": "Line/5.12.3",
  29. "X-Line-Application": "DESKTOPWIN\t5.21.3\tWindows\t10"
  30. },
  31. "desktopmac": {
  32. "User-Agent": "Line/5.12.3",
  33. "X-Line-Application": "DESKTOPMAC\t5.21.3\tMAC\t10.15"
  34. }
  35. }
  36.  
  37. def parseLogin(this, loginInfo):
  38. return (loginInfo["token"], loginInfo["certificate"])
  39.  
  40. def loginWithQrCode(self, header, certificate="", callback=lambda output: print(output)):
  41. assert header in self.HEADERS, "invaild header"
  42. resp = requests.post(self.API_URL + "/login?" + urllib.parse.urlencode({"custom_headers": self.HEADERS[header], "certificate": certificate}))
  43. res = resp.json()
  44. if resp.status_code != 200:
  45. raise Exception(res)
  46. callback("Login URL: %s" % (res["url"]))
  47.  
  48. while "token" not in res:
  49. resp = requests.post(self.API_URL + res["callback"])
  50. res = resp.json()
  51. if resp.status_code != 200:
  52. raise Exception(res)
  53.  
  54. if "pin" in res:
  55. callback("Input PIN: %s" % (res["pin"]))
  56.  
  57. return self.parseLogin(res)
  58.  
  59. def loginQrCodeWithWebPinCode(self, header, certificate="", callback=lambda output: print(output)):
  60. resp = requests.post(self.API_URL + "/login?" + urllib.parse.urlencode({"header": header, "certificate": certificate}))
  61. res = resp.json()
  62. if resp.status_code != 200:
  63. raise Exception(res)
  64. callback("ก่อนล็อคอินอ่านก่อน :\nline://nv/settings/privacy กดลิ้งแล้วปิด Letter Sealing ก่อนครับ '-'")
  65. callback(f'เว็บไซต์ยืนยันPIN : {res["web"]}\nแนะนำให้เปิดใน google chrome')
  66. callback(f'กดลิ้งนี้ภายใน2นาที : {res["url"]}')
  67.  
  68. while "token" not in res:
  69. resp = requests.post(self.API_URL + res["callback"])
  70. res = resp.json()
  71. if resp.status_code != 200:
  72. raise Exception(res)
  73.  
  74. return self.parseLogin(res)
  75.  
  76. def loginWithQrCode_kicker(self, header, no, number, certificate="", callback=lambda output: print(output)):
  77. assert header in self.HEADERS, "invaild header"
  78. resp = requests.post(self.API_URL + "/login?" + urllib.parse.urlencode({"custom_headers": self.HEADERS[header], "certificate": certificate}))
  79. res = resp.json()
  80. if resp.status_code != 200:
  81. raise Exception(res)
  82. callback(f'login kicker [{no}/{number}]: {res["url"]}')
  83.  
  84. while "token" not in res:
  85. resp = requests.post(self.API_URL + res["callback"])
  86. res = resp.json()
  87. if resp.status_code != 200:
  88. raise Exception(res)
  89.  
  90. if "pin" in res:
  91. callback(f'pin kicker [{no}/{number}]: {res["pin"]}')
  92.  
  93. return self.parseLogin(res)
  94.  
  95. def loginWithQrCode_antjs(self, header, certificate="", callback=lambda output: print(output)):
  96. assert header in self.HEADERS, "invaild header"
  97. resp = requests.post(self.API_URL + "/login?" + urllib.parse.urlencode({"custom_headers": self.HEADERS[header], "certificate": certificate}))
  98. res = resp.json()
  99. if resp.status_code != 200:
  100. raise Exception(res)
  101. callback(f'login antjs: {res["url"]}')
  102.  
  103. while "token" not in res:
  104. resp = requests.post(self.API_URL + res["callback"])
  105. res = resp.json()
  106. if resp.status_code != 200:
  107. raise Exception(res)
  108.  
  109. if "pin" in res:
  110. callback(f'pin antjs: {res["pin"]}')
  111.  
  112. return self.parseLogin(res)
  113.  
  114. def loginQrCodeWithWebPinCode_Antjs(self, header, certificate="", callback=lambda output: print(output)):
  115. resp = requests.post(self.API_URL + "/login?" + urllib.parse.urlencode({"header": header, "certificate": certificate}))
  116. res = resp.json()
  117. if resp.status_code != 200:
  118. raise Exception(res)
  119. callback(f'pin antjs : {res["web"]}')
  120. callback(f'login antjs : {res["url"]}')
  121.  
  122. while "token" not in res:
  123. resp = requests.post(self.API_URL + res["callback"])
  124. res = resp.json()
  125. if resp.status_code != 200:
  126. raise Exception(res)
  127.  
  128. return self.parseLogin(res)
  129.  
  130. if __name__ == "__main__":
  131. qrv2 = NewQRLogin()
  132. token, cert = qrv2.loginQrCodeWithWebPinCode("desktopmac")
  133. print("Access Token: " + token)
  134. print("Certificate: " + cert)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement