Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to implement android signature algorithm

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

In this article Xiaobian for you to introduce in detail the "android signature algorithm how to achieve", the content is detailed, the steps are clear, the details are handled properly, I hope this article "android signature algorithm how to achieve" article can help you solve doubts, following the editor's ideas slowly in depth, together to learn new knowledge.

1 、 The packet grab tool grabs a request POST / rest/n/feed/nearby?app=0&kpf=ANDROID_PHONE&ver=6.5&c=HUAWEI_KWAI&mod=HUAWEI%28HWI-AL00%29&appver=6.5.5.9591&ftt=&isp=CUCC&kpn=KUAISHOU&lon=102.698614&language=zh-cn&sys=ANDROID_9&max_memory=384&ud=0&country_code=cn&oc=HUAWEI_KWAI&hotfix_ver=&did_gt=1584622753889&iuid=&net=WIFI&did=ANDROID_9ba4839bf09a1834&lat=25.002707 HTTP/1.1 type=10&page=1&token=&count=20&id=9&refreshTimes=0&coldStart=false& Source=1&browseType=1&seid=60ed7899-e25e-4b9b-b971-3f75b4df00fd&os=android&sig=75e33af6cb4a795c039e0f94a9bd27bf&client_key=3c2cd3f32, Analysis.

You can see that among the requested parameters, there is a field called sig. The main work we need to do is to calculate the sig through the parameters. Through reverse analysis, we find that the sig is calculated as follows:

Put the parameters in url into map1

Put the parameters in the form into map2

Put the elements in map1 and map2 into arraylist in the form of key=value

Sort arraylist

Concatenate the elements in arraylist into a string str in order

Convert str to bytearray

Call CPU.getClock (), pass in str to calculate the signature

CPU.getClock () is a native method that is implemented in libcore.so

3. Put the code from sig import signatureimport requestspara = {"app": "0", "kpf": "ANDROID_PHONE", "ver": "6.5", "c": "HUAWEI_KWAI", "mod": "HUAWEI (HWI-AL00)", "appver": "6.5.5.9591", # "ftt": "", "isp": "CUCC", "kpn": "KUAISHOU" # "lon": "102.698614", "language": "zh-cn", "sys": "ANDROID_9", "max_memory": "384", "ud": "0", "country_code": "cn", "oc": "HUAWEI_KWAI", # "hotfix_ver": "", "did_gt": "1584622753889", # "iuid": "", "net": "WIFI" "did": "ANDROID_9ba4839bf09a1834", # "lat": "25.002707"} post = {"type": "10", "page": "1", "token": "count": "20", "id": "9", "refreshTimes": "0", "coldStart": "false", "source": "1", "browseType": "1" "seid": "60ed7899-e25e-4b9b-b971-3f75b4df00fd", "os": "android", "client_key": "3c2cd3f3"} j = signature.WeChat_YY_yhzf.sig_post ("https://apissl.ksapisrv.com/rest/n/feed/nearby",para,post)header = {" Content-Type ":" application/x-www-form-urlencoded "} resp = requests.post (j [" para "], data=j [" data "], headers=header) print (resp.text)

The request result is as follows:

Cdn.nlark.com/yuque/0/2020/png/97322/1606958397549-a4664517-e9df-496f-8f5f-8816042a6582.png?x-oss-process=image/resize,w_1500 ">

After reading this, the article "how to implement the android signature algorithm" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it yourself to understand it. If you want to know more about related articles, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report