返回顶部
首页 > 资讯 > 后端开发 > Python >ks协议请求APP sig __NS_sig3 __NStokensig
  • 249
分享到

ks协议请求APP sig __NS_sig3 __NStokensig

javapythonandroid 2023-09-01 12:09:50 249人浏览 八月长安

Python 官方文档:入门教程 => 点击学习

摘要

前面已经公布了一些流程,除了sig3在so层,其他都是java层; 目前看了下最新版,9-最新版本逻辑一致,9以下 sig3 42位。 快手__nsTokensig和sig签名 : https://c

前面已经公布了一些流程,除了sig3在so层,其他都是java层;

目前看了下最新版,9-最新版本逻辑一致,9以下 sig3 42位。

快手__nsTokensig和sig签名 :

https://codeooo.blog.csdn.net/article/details/127639252

抓包:
https://codeooo.blog.csdn.net/article/details/127637178

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述看了下参数:
keyWord关键词
client_key : 3c2cd3f3
token是登陆账号的值,这里测试关键词搜索可以忽略;

关键词API:

import uuidimport requestsfrom sig import sig3_start, getsig3url = "https://apijs.gifshow.com/rest/n/search/new?earphoneMode=1&mod=Xiaomi%28MI%208%20Lite%29&appver=11.1.40.29872&isp=&language=zh-cn&ud=0&did_tag=0&egid=DFP8FD17773009A01528832DDF38472E89F25E8A6302690B44B87CC4BA032C66&net=WIFI&kcv=1507&app=0&kpf=Android_PHONE&bottom_navigation=false&ver=11.1&oDid=ANDROID_1df15ab612781d06&android_os=0&boardPlatfORM=sdm660&kpn=KUaiSHOU&androidApiLevel=27&newOc=XIAOMI&slh=0&country_code=CN&nbh=130&hotfix_ver=&did_gt=1689592942281&keyconfig_state=2&cdid_tag=7&sys=ANDROID_8.1.0&max_memory=256&cold_launch_time_ms=1689642804517&oc=XIAOMI&sh=2280&ddpi=440&deviceBit=0&browseType=4&socName=Qualcomm%20SnapdraGon%20660&is_background=0&c=XIAOMI&sw=1080&ftt=&abi=arm64&userRecoBit=0&device_abi=arm64&totalMemory=5710&grant_browse_type=AUTHORIZED&iuid=&rdid=ANDROID_254db5af72b2742d&sbh=110&darkMode=false&did=ANDROID_1df15ab612781d06"headers = {    'X-Client-Info': 'model=V1923A;os=Android;nqe-score=4;network=WIFI;signal-strength=4;',    'User-Agent': 'Apifox/1.0.0 (Https://apifox.com)',    'Content-Type': 'application/x-www-form-urlencoded',    'Accept': '*/*',    'Host': 'apijs.ksapisrv.com',    'Connection': 'keep-alive'}data = {    "isRecoRequest": "false",    "ussid": "",    "fromPage": "4",    "fromPageSessionId": "",    "pcursor": "1",    "requestTabId": "",    "keyword": "捡到男鬼后脱单了",    "queryId": "",    "extParams": "{\"hasSelectedInterest\":false,\"searchTabId\":1,\"imei\":\"869809038521435\",\"layoutStyle\":2,\"referVideoId\":\"5259078570990334169\",\"referLog\":\"mK0HEgwV5jN3GgGrsx0WMuQeeCwDVHGyotnXt9E9FGCl+Y7h4SbxHUabOCL7u4LuFVpcZropLisGgpu3D+B5Nc6HYx0Bo56uQYl11HqvhORo+ftH2sf15fliA/zGpT1D\",\"isAd\":false,\"referAuthorId\":\"359335788\",\"kwaiSource\":\"search_entrance_bottom_featured\",\"disableCorrection\":false,\"filterType\":\"\",\"collContinuePlayInfo\":{},\"signalParams\":\"H4sIAAAAAAAAAFNi4WARYNSK5ZIvTk0sSs6IT80rKUrMS06NT8ovKcnPjU9LTSwpLUpNUbLi+A8DjAKT/u3ZMs1QitfN1TEkNMjVJT7A0d3VgNGC2UnY1MjU0sDcwtTcwNLSwNjYxNDMEgBhdY5yZQAAAA==\"}",    "videoModelCrowdTag": "1_99",    "os": "android",    "cs": "false",    "client_key": "3c2cd3f3",    "startSessionId": str(uuid.uuid4()),    "uQaTag": ""}sig, sig3str = sig3_start(url, data)sig3 = getsig3(sig3str)url = url + f"&sig={sig}&__NS_sig3={sig3}"response = requests.request("POST", url, headers=headers, data=data)print(response.text)

在这里插入图片描述

主页作品页:

用户主页这个得登陆了,登陆后会有个token参数;

在这里插入图片描述
这个token登陆时候,会生成一个盐值,可以使用hook sha256
在这里插入图片描述
去拿到入参,因为入参是 sig + 盐值,所以只需要取后32位:

在这里插入图片描述
在这里插入图片描述

8b9a761435578761df9a4838bc942cb58b0b05731c79f830684dd7436181859d
8b9a761435578761df9a4838bc942cb58b0b05731c79f830684dd7436181859d
8b0b05731c79f830684dd7436181859d 8b0b05731c79f830684dd7436181859d

token_client_salt : 8b0b05731c79f830684dd7436181859d

import requestsfrom urllib.parse import parse_qslfrom sig import sig3_start, getsig3, get_tokeningurl = "https://apijs2.gifshow.com/rest/n/feed/profile2?earphoneMode=1&mod=Xiaomi%28MI%208%20Lite%29&appver=11.1.40.29872&isp=&language=zh-cn&ud=3115604858&did_tag=0&egid=DFP4343AA6498BDCA87F15D3B59ADB3A045F45AE4152A8BA42C5CDA172EB32C3&net=WIFI&kcv=1507&app=0&kpf=ANDROID_PHONE&bottom_navigation=false&ver=11.1&oDid=ANDROID_1df15ab612781d06&android_os=0&boardPlatform=sdm660&kpn=KUAISHOU&androidApiLevel=27&newOc=XIAOMI&slh=0&country_code=CN&nbh=130&hotfix_ver=&did_gt=1689657031040&keyconfig_state=2&cdid_tag=7&sys=ANDROID_8.1.0&max_memory=256&cold_launch_time_ms=1689731923266&oc=XIAOMI&sh=2280&ddpi=440&deviceBit=0&browseType=4&socName=Qualcomm%20Snapdragon%20660&is_background=0&c=XIAOMI&sw=1080&ftt=&abi=arm64&userRecoBit=0&device_abi=arm64&totalMemory=5710&grant_browse_type=AUTHORIZED&iuid=&rdid=ANDROID_254db5af72b2742d&sbh=110&darkMode=false&did=ANDROID_1df15ab612781d06"headers = {    'Host': 'apijs.gifshow.com',    'User-Agent': 'kwai-android aegon/3.26.4',    'Content-Type': 'application/x-www-form-urlencoded'}payload = 'user_id=1471088950&lang=zh&count=20&privacy=public&pcursor=1.689605697445E12&referer=ks%3A%2F%2Fprofile%2F1351720628%2F5200250302942104746%2F1_u%2F2002357763686114370_bs4356%2F90&displayType=3&teenagerMode=false&tubeCustomParams=%7B%22tubeCardabparam%22%3A1%7D&preRequest=false&videoModelCrowdTag=1_16&os=android&token=98d1568e5e05486b86091441dfb93076-3115604858&cs=false&client_key=3c2cd3f3&kuaishou.api_st=&uQaTag=0%23'data = dict(parse_qsl(payload))print(data)sig, sig3str = sig3_start(url, data)tokensig = get_tokening(sig, "8b0b05731c79f830684dd7436181859d")sig3 = getsig3(sig3str)print(sig, sig3str, sig3)url = url + f"&sig={sig}&__NStokensig={tokensig}&__NS_sig3={sig3}"print(url)response = requests.request("POST", url, headers=headers, data=data)print(response.text)for res in response.JSON()['feeds']:    try:        time = res['time']        duration = res['duration']        caption = res['caption']        author = res['soundTrack']['name']        share_info = res['share_info']        print('caption: ' + str(caption) + '  author: ' + str(author) + '  time: ' + str(time) + '  duration: ' + str(            duration) + '  share_info: ' + str(share_info))    except Exception as a:        print(a)        continue

在这里插入图片描述

评论: API

# -*- coding: utf-8 -*-import requestsfrom sig import sig3_start, getsig3url = "https://api3.gifshow.com/rest/n/comment/list/v2?mod=Google%28Pixel%20XL%29&abi=arm32&country_code=CN&kpn=KUAISHOU&is_background=0&cdid_tag=7&deviceBit=0&oc=ANDROID_SHENMA_ZW_SSYQ_CPC&egid=DFP1B2A7E8DB6DEF92C673F3F4C5B7C685731D7598AD80345580EFAE1208BCA2&sbh=84&hotfix_ver=&appver=11.1.30.29775&sh=2560&grant_browse_type=AUTHORIZED&userRecoBit=0&cold_launch_time_ms=1689577363668&nbh=168&socName=Qualcomm%20MSM8996PRO-AB&newOc=ANDROID_SHENMA_ZW_SSYQ_CPC&androidApiLevel=25&max_memory=256&isp=&kcv=1507&earphoneMode=1&browseType=4&kpf=ANDROID_PHONE&ddpi=560&did=ANDROID_60a02c5de917fa4c&android_os=0&boardPlatform=msm8996&app=0&net=WIFI&device_abi=arm64&did_tag=0&ud=0&c=ANDROID_SHENMA_ZW_SSYQ_CPC&sys=ANDROID_7.1.2&bottom_navigation=false&slh=0&sw=1440&oDid=ANDROID_60a02c5de917fa4c&ftt=&keyconfig_state=2&rdid=ANDROID_453bb538c86218be&language=zh-cn&darkMode=false&totalMemory=3764&iuid=&did_gt=1689577366128&ver=11.1"headers = {    'Host': 'api3.gifshow.com',    'User-Agent': 'kwai-android aegon/3.26.4',    'Content-Type': 'application/x-www-form-urlencoded'}data = {    "photoId": "5249508419472077227",    "user_id": "1544872123",    "order": "desc",    "count": "10",    "photoPageType": "145",    "enableEmotion": "true",    "expTag": "1_i/2002353905121107874_scn0",    "urlPackagePage2": "USER_TAG_SEARCH",    "ptp": "",    "feedCommentCount": "83",    "commentPanelType": "1",    "client_key": "3c2cd3f3",    "uQaTag": "",    "cs": "false",    "os": "android",    "videoModelCrowdTag": "1_99"}sig, sig3str = sig3_start(url, data)sig3 = getsig3(sig3str)url = url + f"&sig={sig}&__NS_sig3={sig3}"print(sig, sig3str, sig3)response = requests.request("POST", url, headers=headers, data=data)print(response.text)

在这里插入图片描述

来源地址:https://blog.csdn.net/weixin_38927522/article/details/131848058

--结束END--

本文标题: ks协议请求APP sig __NS_sig3 __NStokensig

本文链接: https://lsjlt.com/news/388442.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作