亚洲国产精品乱码一区二区,美景房屋2免费观看,哎呀哎呀在线观看视频高清国语,从镜子里看我是怎么C哭你

Article / 文章中心

Python爬取APP數(shù)據(jù),進行APP逆向分析!

發(fā)布時間:2023-09-06 點擊數(shù):1472

某漫畫app逆向

  • 一工具的準備
  • 二項目思路
  • 三簡易代碼提供參考

一工具的準備

  • 1.fiddler抓包工具 ,夜神模擬器
  • 2.python環(huán)境,Java環(huán)境
  • 3.漫畫app準備
  • 4.java反編譯工具

二項目思路

很多人學(xué)習(xí)python,掌握了基本語法過后,不知道在哪里尋找案例上手。

很多已經(jīng)做案例的人,卻不知道如何去學(xué)習(xí)更加高深的知識。

那么針對這三類人,我給大家提供一個好的學(xué)習(xí)平臺,免費領(lǐng)取視頻教程,電子書籍,以及課程的源代碼!

QQ群:701698587


配置好抓包工具和夜神模擬器
豆瓣夾下載漫畫applink.
安裝到夜神模擬器


抓取app數(shù)據(jù)


解析抓取的數(shù)據(jù):
post請求
變化的參數(shù)client-time, client-sign
client-time 比較明顯是時間戳
client-sign 是加密數(shù)據(jù)

client_type = 'android'
app_devicetoken = "e571dd8bd67803995b9bdcfefb58662b"
phone_mark = "58D83850AA58CCB094954B30F9C4D3C4"
client_time = str(int(time.time() * 1000))

 



解析app
將apk安裝包后綴修改為rar, 解壓壓縮包得到app對應(yīng)文件

得到Java的classes文件
對獲取的classes.dex進行反編譯,工具可以自行查找,或者溝通群獲取
將classes.dex 移動到解析的文件夾
進入windows powershell cd 到反編譯的文件夾
執(zhí)行命令 .\d2j-dex2jar.bat .\classes.dex
得到 classes-dex2jar.jar 文件 這個就是java的源代碼了

將代碼拖動到你的java反編譯器 JD-GUI


就能得到全部的java代碼


搜索對應(yīng)的加密參數(shù):client-sign
確定生成client-sign 為b.class 打開對應(yīng)文件
找到數(shù)據(jù)的加密規(guī)則
原來加密的方式是md5
加密的數(shù)據(jù)是由時間戳來決定的

  1.  

 

content = '3.0.1' + client_type + str(client_time) + app_devicetoken + phone_mark + "0" + "" + "{54563A97-2BBA-7F31-D4C1-8EF72F4A98E6}"
client_sign = hashlib.md5(content.encode("utf-8")).hexdigest()
1
2
確定請求頭的全部參數(shù)
 
headers = {
    'client-ver': '3.0.1',
    'client-type': client_type,
    'client-time': str(client_time),
    'phone-mark': phone_mark,
    'app-devicetoken': app_devicetoken,
    'sina-uid': '0',
    'sina-token': '',
    'VREADREFER': 'vmh_client',
    'client-sign': client_sign,
    'Cache-Control': 'no-cache',
    'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
    'Content-Length': '223',
    'Host': 'api.manhua.weibo.com',
    'Connection': 'Keep-Alive',
    'Accept-Encoding': 'gzip',
    'User-Agent': 'okhttp/3.8.0',
 
}


需要傳遞的參數(shù)

data = "client_ver=3.0.1&client_type={}&client_time={}&phone_mark={}&app_devicetoken={}&sina_uid=0&sina_token=&client_sign={}".format(client_type, client_time, phone_mark, app_devicetoken, client_sign)


三簡易代碼提供參考
內(nèi)容涉及該app, 只限技術(shù)探討

import requests
import time
import hashlib
import os
 
 
client_type = 'android'
app_devicetoken = "e571dd8bd67803995b9bdcfefb58662b"
phone_mark = "58D83850AA58CCB094954B30F9C4D3C4"
client_time = str(int(time.time() * 1000))
content = '3.0.1' + client_type + str(client_time) + app_devicetoken + phone_mark + "0" + "" + "{54563A97-2BBA-7F31-D4C1-8EF72F4A98E6}"
client_sign = hashlib.md5(content.encode("utf-8")).hexdigest()
headers = {
    'client-ver': '3.0.1',
    'client-type': client_type,
    'client-time': str(client_time),
    'phone-mark': phone_mark,
    'app-devicetoken': app_devicetoken,
    'sina-uid': '0',
    'sina-token': '',
    'VREADREFER': 'vmh_client',
    'client-sign': client_sign,
    'Cache-Control': 'no-cache',
    'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
    'Content-Length': '223',
    'Host': 'api.manhua.weibo.com',
    'Connection': 'Keep-Alive',
    'Accept-Encoding': 'gzip',
    'User-Agent': 'okhttp/3.8.0',
 
}
data = "client_ver=3.0.1&client_type={}&client_time={}&phone_mark={}&app_devicetoken={}&sina_uid=0&sina_token=&client_sign={}".format(client_type, client_time, phone_mark, app_devicetoken, client_sign)
 
 
def parse_data(url):
    response = requests.post(url, headers=headers, data=data).json()
    page_list = response["data"]["chapter_list"]
    for x in page_list:
        page_url = "http://api.manhua.weibo.com/client/comic/show?comic_id=68236/client/comic/play?chapter_id={}".format(x["chapter_id"])
        dir_name = r"漫畫\\" + x["chapter_name"]
        page_data = requests.post(page_url, headers=headers, data=data).json()["data"]["json_content"]["page"]
        y = 0
        for i in page_data:
            if not os.path.exists(dir_name):
                os.makedirs(dir_name)
            result = requests.get(i["mobileImgUrl"]).content
            path = dir_name + "\\" + str(y) + ".jpg"
            with open(path, "wb")as f:
                f.write(result)
                print("正在下載", path)
            y += 1
 
 
def main():
    url = "http://api.manhua.weibo.com/client/comic/show?comic_id=68236"
    parse_data(url)
 
 
if __name__ == '__main__':
    main()