关于大数据:抖音Xgorgon算法0408版设备注册加密算法-抖音协议抖音爬虫-实现

39次阅读

共计 7388 个字符,预计需要花费 19 分钟才能阅读完成。

抖音 app 版本更新贼快,虽说小版本之前加密算法根本一样,但还是有稍微差别。今日实现了 120601 版本(貌似 9 月初公布)的 Xgorgon 加签及设施注册的加密。通过 Xgorgon 可失常爬取到数据,通过设施信息的加密可注册到新的设施号(device_id)。

一、反编译 APK(Xgorgon)

1、jadx 关上 apk 并搜寻 xgorgon,可定位到 init_gorgon

2、读 init_gorgon() 外面的伪代码,你会发现最新版在调用 native 前所进行的一系列操作,和老版本无二,那就依照老版本操作即可;
3、再读伪代码,会发现 byte[] r0 = com.ss.sys.ces.a.leviathan(r14, r10, r0),这个就是调用本地 so 库进行最终的加密

4、发一个最终成果看看(爬取视频的评论列表)

 申请的 url:https://api3-normal-c-hl.amemv.com/aweme/v2/comment/list/?aweme_id=6870816591416773899&cursor=0&count=20&address_book_access=1&gps_access=1&forward_page_type=1&channel_id=0&city=530100&hotsoon_filtered_count=0&hotsoon_has_more=0&follower_count=0&is_familiar=0&page_source=0&user_avatar_shrink=64_64&storage_type=2&manifest_version_code=120601&_rticket=1599995937170&app_type=normal&iid=xxx&channel=aweGW&device_type=Redmi+6A&language=zh&cpu_support64=false&host_abi=armeabi-v7a&uuid=xxx&resolution=720*1344&openudid=xxx&update_version_code=12609900&cdid=xxx&appTheme=dark&os_api=27&mac_address=xxx&dpi=320&oaid=xxx&ac=wifi&device_id=xxx&os_version=8.1.0&version_code=120600&app_name=aweme&version_name=12.6.0&device_brand=xiaomi&ssmix=a&device_platform=android&aid=1128&ts=1599995937
Xgorgon:040850000810d1290a78de2cbd25321d8cad6e072903b17e0700
获取后果:{"status_code":0,"comments":[{"cid":"6870835395178299406","text":"哈哈哈哈哈","aweme_id":"6870816591416773899","create_time":1599741031,"digg_count":379672,"status":1,"user":{"uid":"58857507866","short_id":"7046031","nickname":"演员吴晴","gender":2,"signature":"???? 演员,歌手。微博:吴晴 Kate(1045 万粉丝)\n(不定时直播)\n???? 电影代表作:《忠犬大营救》《毒战》《血戒》《四平风波》《迷城》《恋爱 101 度》《千门江湖》《荀灌娘》《特工少女》等作品 \n???? 个人专辑????《相思心》《抱的太使劲》《越痛越想你》《墨染江南》《最情话》《别叫我女神经》等 \n❤️感激大家的守护   私信音讯会回复 \nV:WQ777777768","avatar_larger":{"uri":"1080x1080/315bc00082e86dca01f05","url_list":["https://p26-dy.byteimg.com/aweme/1080x1080/315bc00082e86dca01f05.webp?from=2956013662\u0026s=PackSourceEnum_COMMENT_LIST\u0026se=false\u0026sh=\u0026sc=avatar\u0026l=202009131919050100280680780B463AF3","https://p1-dy-ipv6.byteimg.com/aweme/1080x1080/315bc00082e86dca01f05.webp?from=2956013662\u0026s=PackSourceEnum_COMMENT_LIST\u0026se=false\u0026sh=\u0026sc=avatar\u0026l=202009131919050100280680780B463AF3","https://p29-dy.byteimg.com/aweme/1080x1080/315bc00082e86dca01f05.webp?from=2956013662\u0026s=PackSourceEnum_COMMENT_LIST\u0026se=false\u0026sh=\u0026sc=avatar\u0026l=202009131919050100280680780B463AF3","https://p26-dy.byteimg.com/aweme/1080x1080/315bc00082e86dca01f05.jpeg?from=2956013662\u0026s=PackSourceEnum_COMMENT_LIST\u0026se=false\u0026sh=\u0026sc=avatar\u0026l=202009131919050100280680780B463AF3"],"width":720,"height":720},"avatar_thumb":{"uri":"100x100/315bc00082e86dca01f05","url_list":["https://p3-dy-ipv6.byteimg.com/aweme/100x100/315bc00082e86dca01f05.webp?from=2956013662\u0026s=PackSourceEnum_COMMENT_LIST\u0026se=false\u0026sh=\u0026sc=avatar\u0026l=202009131919050100280680780B463AF3","https://p29-dy.byteimg.com/aweme/100x100/315bc00082e86dca01f05.webp?from=2956013662\u0026s=PackSourceEnum_COMMENT_LIST\u0026se=false\u0026sh=\u0026sc=avatar\u0026l=202009131919050100280680780B463AF3","https://p26-dy.byteimg.com/aweme/100x100/315bc00082e86dca01f05.webp?from=2956013662\u0026s=PackSourceEnum_COMMENT_LIST\u0026se=false\u0026sh=\u0026sc=avatar\u0026l=202009131919050100280680780B463AF3","https://p3-dy-ipv6.byteimg.com/aweme/100x100/315bc00082e86dca01f05.jpeg?from=2956013662\u0026s=PackSourceEnum_COMMENT_LIST\u0026se=false\u0026sh=\u0026sc=avatar\u0026l=202009131919050100280680780B463AF3"],"width":720,"height":720},"avatar_medium":

二、反编译 APK(设施注册明文加密)

1、jadx 关上 apk 并搜寻 EncryptorUtil,可定位到 ttEncrypt

2、读代码,能够看到调用 native 传入了两个参数,一个是 bArr(即明文压缩后的 byte),还有一个是 bArr 的长度。至于传入的 bArr 是什么,间接 hook 就行了;
3、再发一个最终成果看看(注册 device_id)

 申请的 url:https://log-hl.snssdk.com/service/2/device_register/?ac=wifi&mac_address=80:6b:0a:ae:16:77&channel=aweGW&aid=1128&app_name=aweme&version_code=120000&version_name=12.0.0&device_platform=android&ssmix=a&device_type=Redmi+6A&device_brand=xiaomi&language=zh&os_api=27&os_version=8.1.0&uuid=867986272266552&openudid=086ea119dc4c389e&manifest_version_code=120001&resolution=720*1344&dpi=320&update_version_code=12009900&_rticket=1599995560251&storage_type=2&appTheme=dark&cpu_support64=false&host_abi=armeabi-v7a&app_type=normal&ts=1599995560&cdid=6227e97c-e9da-455d-b3f5-29f8a5d4968b&oaid=59423f0098833c63&tt_data=a
加密后 body:[116, 99, 5, 16, 0, 0, -97, -99, 35, 54, 17, -97, 18, -93, 11, 49, -127, -128, 108, -87, -77, -5, -12, -98, 33, -6, -45, -90, 18, -78, -53, 58, -45, 89, 4, -74, -108, -13, 6, -49, -73, 105, -79, 56, -16, 46, -126, 110, -90, 3, 121, 11, -70, -125, -22, -47, -48, -96, 98, 91, 33, 80, -16, 8, 89, -62, -100, 6, -74, 113, -128, -119, 76, -18, -6, -110, -31, 73, 82, 98, 43, -100, -18, 57, 69, -88, -4, -128, -90, -89, -7, -125, 13, -20, 65, 29, 89, -2, 58, -41, 122, -56, 111, 86, 21, -95, -20, -34, -28, 63, 116, -4, -124, -47, -20, -86, 22, 64, 8, 25, -12, 99, 25, 81, -63, 112, -20, -85, -37, 75, 79, 80, 93, 106, 54, 59, -22, 79, -83, -121, 104, 67, -8, 73, -98, 120, 64, 15, 29, -70, -42, 121, 32, 98, -75, -88, 115, -10, -37, -18, 122, -4, 32, -24, 100, -38, 79, 26, 77, -42, -51, 19, -79, 92, 8, 116, -17, -53, -127, -68, 113, -32, 61, -106, 124, 91, -57, 94, 47, 0, 8, -62, 46, -97, 84, 90, -2, 73, -12, 88, 48, 78, 49, -42, -66, 18, 96, -120, 94, -59, -105, -42, 62, 27, -83, -58, 27, 54, -54, 43, -109, -29, 75, 7, -53, -103, 87, 45, -124, -98, -125, 44, 58, 94, -30, 46, -61, 87, 123, 22, -99, 46, -84, -21, -41, -115, 10, -6, 11, -1, -5, 9, -120, -70, -21, 5, -80, -27, -54, 37, 16, -46, -3, -53, -125, 13, 36, 27, -52, -62, -112, -15, -47, 61, -41, 89, -97, -81, 11, 12, 41, -6, 32, 109, -128, -117, 73, -15, 125, -116, 14, 113, 54, 18, 37, -44, -70, -10, 94, -44, -21, -43, 125, -62, -123, 31, -38, 113, 64, 95, 113, 106, -117, 100, -32, -124, 78, 57, 1, -62, 114, 64, 18, -21, 4, -11, -88, -26, -15, 22, 53, 48, 21, -24, 90, -57, -55, -76, -57, 29, -67, 110, 50, -22, -74, 22, -61, -111, 19, -103, -117, -73, 124, -39, 39, 81, -59, 116, 16, 66, -61, -70, -51, 59, -123, -72, 97, -4, 18, -16, -24, -59, 8, -107, -72, -62, -98, -52, -64, 115, -23, 52, -49, -13, -12, 61, 45, 83, -100, 109, 113, -61, -18, 85, -5, -100, 4, 97, 105, -89, 100, 25, 86, -30, 122, 43, -1, -120, -14, -87, 56, 36, -83, 55, 38, -92, 127, -48, 40, -83, 10, 121, 7, 115, 127, 81, -77, -30, 51, -102, 59, 98, 111, -110, -64, 56, 108, -42, 106, -119, -100, -80, -79, 96, 99, -18, -80, 3, -45, 46, -62, -110, -39, 111, -19, -36, -62, 76, 35, 122, -113, 122, -65, -61, 113, 91, 102, 49, 52, -34, -5, 94, 41, -19, -27, 93, 73, 115, 4, 108, 52, -44, -10, 82, 125, -10, -72, -82, 29, -81, 38, 60, -112, -27, 45, 7, 116, 73, 36, 73, -18, -88, -48, 19, -3, -21, -10, 31, 55, 102, 96, -61, 2, -6, -88, 125, 35, 55, -103, 62, 74, 97, -18, -1, -88, -8, -2, 39, -43, 102, -60, -81, 57, -79, -29, -22, 7, -33, -74, 83, 77, -123, -128, 82, 0, 67, 71, -7, 124, -37, -38, 108, 98, 3, -124, -100, 64, 12, 34, 97, 40, 89, 118, -11, -51, 52, -59, -119, 108, 127, -92, -94, -52, -31, -65, -90, -89, -28, -98, 107, 40, 126, 98, -58, -49, -125, 26, -39, 67, -25, 91, 83, -54, 82, -127, -103, 25, -127, -32, -108, -118, -12, -43, -103, -102, -1, -57, 88, 4, 41, -9, 115, -70, -19, -17, -34, 19, -24, 98, -107, -103, 15, 41, 78, 68, 121, -1, -91, -101, -24, -103, 12, -32, 32, -16, -17, -97, -81, 84, 100, 89, 65, -39, -124, 16, 67, -37, -67, 50, -58, -18, -59, -67, -48, -46, 0, 36, 1, -105, 120, 78, 84, 23, -76, -105, -59, -40, -106, 4, -16, 24, 64, -37, -51, 122, 78, -28, 48, -89, 66, -120, 70, -106, -111, -103, 65, -37, 7, 83, -99, -81, 17, -32, 99, 18, -118, -27, 122, 79, 45, 80, 93, -51, 35, -1, 123, 70, 39, -21, -1, -90, -106, 37, -74, 126, -15, 106, -60, 82, 27, -104, -67, 38, -8, -29, 121, -66, 112, -38, 59, 27, 98, 3, -3, -79, 119, 98, -50, -49, 110, 21, 53, -54, 116, 7, -83, -61, -28, 107, 117, -39, -1, 73, 11, -52, -97, -75, -95, -38, -20, 126, -36, 16, 124, -36, 66, 102, -67, 96, 110, -122, -97, -41, -44]
注册后果:{"server_time":1599995569,"device_id":773668702534483,"install_id":3834709470876636,"device_id_str":"773668702534483","install_id_str":"3834709470876636","new_user":1}

搞定,每次可注册一个新设施号。

——————————————————————————————————————————

TiToData:业余的短视频、直播数据接口服务平台。

更多信息请分割:TiToData

笼罩支流平台:抖音,快手,小红书,TikTok,YouTube

正文完
 0