1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
| import requests import uuid import base64 import ddddocr
def fetch_image_code(mobile, app_key, device_identify): res = requests.get( url="https://newappuser.jiuxian.com/messages/graphCode.htm", params={ "appKey": app_key, "appVersion": "9.1.13", "areaId": "2707", "channelCode": "0", "cpsId": "tencent", "deviceIdentify": device_identify, "deviceType": "ANDROID", "deviceTypeExtra": "0", "equipmentType": "Pixel 2 XL", "mobile": mobile, "netEnv": "wifi", "screenReslolution": "1440x2712", "supportWebp": "1", "sysVersion": "10", "type": "4" }, headers={ "secure": "false", "Accept-Encoding": "gzip", 'user-agent': "okhttp/3.14.9", 'Host': "newappuser.jiuxian.com", 'Connection': "keep-alive" }, verify=False )
image_str = res.json()['result']["imgCode"]
img = base64.b64decode(image_str)
ocr = ddddocr.DdddOcr(show_ad=False) code = ocr.classification(img) return code
def check_image_code(mobile, code, app_key, device_identify): res = requests.get( url='https://newappuser.jiuxian.com/messages/mobileCode.htm', params={ "appKey": app_key, "appVersion": "9.1.13", "areaId": "2707", "channelCode": "0", "code": code, "cpsId": "tencent", "deviceIdentify": device_identify, "deviceType": "ANDROID", "deviceTypeExtra": "0", "equipmentType": "Pixel 2 XL", "mobile": mobile, "netEnv": "wifi", "screenReslolution": "1440x2712", "supportWebp": "1", "sysVersion": "10", "type": "1" }, verify=False ) data_dict = res.json()
return data_dict.get('success') == "1"
def login_by_sms(mobile, sms_code, app_key, device_identify): res = requests.post( url="https://newappuser.jiuxian.com/user/loginMobileFast.htm", data={ "appKey": app_key, "appVersion": "9.1.13", "areaId": "2707", "channelCode": "0", "cpsId": "tencent", "deviceIdentify": device_identify, "deviceType": "ANDROID", "deviceTypeExtra": "0", "equipmentType": "Pixel 2 XL", "mobile": mobile, "netEnv": "wifi", "screenReslolution": "1440x2712", "supportWebp": "1", "sysVersion": "10", "verifyCode": sms_code }, verify=False ) data_dict = res.json() return data_dict.get("success") == "1", data_dict.get('result')
def run(): mobile = "18953675221" app_key = device_identify = str(uuid.uuid4()) while True: img_code = fetch_image_code(mobile, app_key, device_identify) status = check_image_code(mobile, img_code, app_key, device_identify) if status: break
sms_code = input("请输入验证码:")
status, data_dict = login_by_sms(mobile, sms_code, app_key, device_identify) if not status: print("登录失败") return print("登录成功") print(data_dict)
if __name__ == '__main__': run()
''' {'userInfo': {'apiVersion': 1.0, 'areaId': 500, 'channelCode': '0', 'isClubUser': False, 'isNewUser': False, 'loginUnionFirst': 0, 'loginWay': 2, 'mobile': '18953675221', 'needBindMobile': False, 'rank': 1, 'rankName': '酒虫', 'sex': 0, 'token': '6494ac1cd90b462fbd3c953a69a70861210440860', 'uid': 210440860, 'uname': 'jxw485893769', 'userImg': 'https://misc.jiuxian.com/img/usercenter/sbbgg.jpg'}}
'''
|