ads-tracker-baidu分析
声明本文章中所有内容仅供学习交流使用不用于其他任何目的抓包 内容、敏感网址、数据接口等均已做脱敏处理严禁用于商业用途和非法用途否则由此产生的一切后果均与作者无关侵权通过头像私信或名字简介叫我删除博客谢谢。部分python代码import asyncioimport execjsimport websocketsimport jsonimport sslimport timefrom datetime import datetimefrom Crypto.Cipher import AESfrom Crypto.Util.Padding import unpadimport base64class FootballScoreClient:def __init__(self, ads_tracker_baidu):ads ads_tracker_baiduck fads-tracker-baidu{ads}self.url /footballself.headers {cookie:f{ck},}self.initial_message {device: pc,topic: USER.topic.app.8}self.websocket Noneself.is_running Falseasync def connect(self):建立WebSocket连接try:ssl_context ssl.create_default_context()ssl_context.check_hostname Falsessl_context.verify_mode ssl.CERT_NONEself.websocket await websockets.connect(self.url,extra_headersself.headers,)print(f[{self._get_timestamp()}] 已连接到服务器)return Trueexcept Exception as e:print(f[{self._get_timestamp()}] 连接失败: {e})return Falseasync def send_initial_message(self):发送初始消息try:await self.websocket.send(json.dumps(self.initial_message))print(f[{self._get_timestamp()}] 发送初始消息: {self.initial_message})except Exception as e:print(f[{self._get_timestamp()}] 发送消息失败: {e})async def receive_messages(self):接收消息循环try:async for message in self.websocket:print(f[{self._get_timestamp()}] 收到消息: {message})await self.handle_message(message)except websockets.exceptions.ConnectionClosed as e:print(f[{self._get_timestamp()}] 连接关闭: {e})self.is_running Falseexcept Exception as e:print(f[{self._get_timestamp()}] 接收消息错误: {e})self.is_running Falseasync def handle_message(self, message):处理接收到的消息try:data decrypt_aes_cbc(message)# 在这里添加你的消息处理逻辑print(f解析后的数据: {data})passexcept json.JSONDecodeError:print(f无法解析消息: {message})async def run(self, auto_reconnectTrue):主运行函数self.is_running Truewhile self.is_running:if await self.connect():await self.send_initial_message()await self.receive_messages()if auto_reconnect and self.is_running:print(f[{self._get_timestamp()}] 5秒后重新连接...)await asyncio.sleep(5)else:breakasync def stop(self):停止客户端self.is_running Falseif self.websocket:await self.websocket.close()def _get_timestamp(self):获取当前时间戳return datetime.now().strftime(%Y-%m-%d %H:%M:%S)async def main():cp execjs.compile(open(1.js, r, encodingutf-8, errorsignore).read())ads_tracker_baidu cp.call(getAdsTrackerBaidu).split(ads-tracker-baidu)[-1]print(ads_tracker_baidu)client FootballScoreClient(ads_tracker_baidu)try:await client.run()except KeyboardInterrupt:print(\n正在关闭客户端...)await client.stop()if __name__ __main__:asyncio.run(main())结果总结1.出于安全考虑,本章未提供完整流程,调试环节省略较多,只提供大致思路,具体细节要你自己还原,相信你也能调试出来。2.具体更多细节请看名字进入详情了解更多细节具体细节要你自己还原,相信你也能调试出来。