xc_login.py 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. # -*- coding: utf-8 -*-
  2. # Author : Charley
  3. # Python : 3.10.8
  4. # Date : 2025/7/17 13:19
  5. import time
  6. import requests
  7. from get_sign import get_sign
  8. HEADERS = {
  9. "User-Agent": "Mozilla/5.0 (Linux; Android 11; Pixel 5 Build/RQ3A.211001.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/83.0.4103.106 Mobile Safari/537.36 uni-app Html5Plus/1.0 (Immersed/52.727272)",
  10. "Connection": "Keep-Alive",
  11. "Accept": "application/json",
  12. "Accept-Encoding": "gzip",
  13. "Content-Type": "application/json",
  14. "Cache-Control": "no-cache",
  15. # "sign": "fd46b7d70f03e77686ecb2c149409742",
  16. "x-token": "",
  17. "client": "yingyongbao",
  18. "appversion": "2.6.20",
  19. # "nonce": "46e7c3842eaaf5e1",
  20. "deviceid": "null",
  21. "jrd": "100d85590861f713a85",
  22. # "timestamp": "1752729582950"
  23. }
  24. def send_msg():
  25. url = "https://api.xingchao6.com/AppClient/v1/util/vcode/send"
  26. ts = int((time.time()) * 1000)
  27. data = {
  28. "phone": phone,
  29. "type": 1,
  30. "timestamp": ts
  31. }
  32. sign, nonce = get_sign(data, ts)
  33. headers = HEADERS.copy()
  34. headers["sign"] = sign
  35. headers["nonce"] = nonce
  36. headers["timestamp"] = str(ts)
  37. response = requests.post(url, headers=headers, json=data)
  38. print(response.text)
  39. def login():
  40. url = "https://api.xingchao6.com/AppClient/v1/auth/login/phone"
  41. ts = int((time.time()) * 1000)
  42. data = {
  43. "phone": phone,
  44. # "code": "977196",
  45. "code": sms_code,
  46. "timestamp": ts
  47. }
  48. sign, nonce = get_sign(data, ts)
  49. headers = HEADERS.copy()
  50. headers["sign"] = sign
  51. headers["nonce"] = nonce
  52. headers["timestamp"] = str(ts)
  53. response = requests.post(url, headers=headers, json=data)
  54. print(response.text)
  55. if __name__ == '__main__':
  56. phone = '19521500850'
  57. # phone = '13014617614'
  58. send_msg()
  59. sms_code = input("请输入短信验证码:")
  60. login()