【2020-10-26】APP逆向之某某健康(2)

2020-10-29 10:00:30

宣告:本文只作學習研究,禁止用於非法用途,否則後果自負,如有侵權,請告知刪除,謝謝!



專案場景:


接上一篇https://blog.csdn.net/qq_26079939/article/details/109285783


1.上一篇講到了模擬登入,這一篇要實現的是上傳自己設定的步數到WX和ZFB。

2.準備階段
  1. 登入賬號
  2. 點選我的
  3. 點選資料共用
  4. 然後第三方同步到WX和ZFB

解決方案:


1.然後我們開始抓同步部署資料的包,由於現在博主用的是模擬器,無法增加步數,所以抓不到上傳步數的包,大家可以在手機端抓到。

2.這是我之前用手機抓到的上傳資料的請求。

	url = 'https://sports.lifesense.com/sport_service/sport/sport/uploadMobileStepV2?systemType=2&version=4.6.7'
	data = {
	    'list':
	        [
	            {
	                'DataSource': 2,
	                'active': 1,
	                'calories': int(step / 4),
	                'dataSource': 2,
	                'deviceId': 'M_NULL',
	                'distance': int(step / 3),
	                'exerciseTime': 0,
	                'isUpload': 0,
	                'measurementTime': time.strftime('%Y-%m-%d %H:%M:%S'),
	                'priority': 0,
	                'step': step,
	                'type': 2,
	                'updated': int(round(time.time() * 1000)),
	                'userId': login_result[0]
	            }
	        ]
	}
	

3.接下來我們實現修改步數的程式碼。

# 修改步數
def change_step():
    # 登入結果
    login_result = login()
    if login_result == '登入失敗':
        return '登入失敗'
    else:
        url = 'https://sports.lifesense.com/sport_service/sport/sport/uploadMobileStepV2?systemType=2&version=4.6.7'
        data = {
            'list':
                [
                    {
                        'DataSource': 2,
                        'active': 1,
                        'calories': int(step / 4),
                        'dataSource': 2,
                        'deviceId': 'M_NULL',
                        'distance': int(step / 3),
                        'exerciseTime': 0,
                        'isUpload': 0,
                        'measurementTime': time.strftime('%Y-%m-%d %H:%M:%S'),
                        'priority': 0,
                        'step': step,
                        'type': 2,
                        'updated': int(round(time.time() * 1000)),
                        'userId': login_result[0]
                    }
                ]
        }
        headers = {
            'Content-Type': 'application/json; charset=utf-8',
            'Cookie': 'accessToken=%s' % login_result[1]
        }
        response_result = requests.post(url, data=json.dumps(data), headers=headers,verify=False)
        status_code = response_result.status_code
        print('修改步數返回的資料:',response_result.text)
        if status_code == 200:
            print('修改步數為【%s】成功' % step)
        else:
            print('修改步數失敗')



4.然後我們執行一下,再去看看微信運動裡的資料,哈哈哈,修改成功了66666,馬上登頂封面了!

在這裡插入圖片描述

在這裡插入圖片描述