diff --git a/facebook私信/readme1.md b/facebook私信/readme1.md index b9f40f5..01077d9 100644 --- a/facebook私信/readme1.md +++ b/facebook私信/readme1.md @@ -6,6 +6,27 @@ fb测试地址 打开f12,刷新页面,发现fb存在 `pending` 连接。 +先发送点内容测试一下 `”在最早在最早在最早在”`,单击 hex viewer 命令切换到utf-8显示格式 + +![debugger](../img/108.png) + +发送的内容有了。分别用以下变量进行全局搜索,发现 `version_id` 只存在一处 + + { + "request_id" : 135 , + "type" : 3 , + "payload" : "{\"version_id\":\"5374491402668733\",\"tasks\":[{\"label\":\"46\",\"payload\":\"{\\"thread_id\\":100010764288690,\\"otid\\":\\"6967764888584867991\\",\\"source\\":1966082,\\"send_type\\":1,\\"text\\":\\"在最早在最早在最早在\\n\\",\\"initiating_source\\":0,\\"skip_url_preview_gen\\":0}\",\"queue_name\":\"100010764288690\",\"task_id\":59,\"failure_count\":null},{\"label\":\"21\",\"payload\":\"{\\"thread_id\\":100010764288690,\\"last_read_watermark_ts\\":1661244604250,\\"sync_group\\":1}\",\"queue_name\":\"100010764288690\",\"task_id\":60,\"failure_count\":null}],\"epoch_id\":6967764888764024872,\"data_trace_id\":\"#/Fg8S8JQS66+1KJPWt0yig\"}" , + "app_id" : "2220391788200892" + } + +![debugger](../img/109.png) + +断点调试看看 + +![debugger](../img/110.png) + +果然内容在 `tasks` 中 + 以下是 WebSocket 对象的相关事件。 open Socket.onopen 连接建立时触发 @@ -15,5 +36,4 @@ fb测试地址 Socket.send() 使用连接发送数据 Socket.close() 关闭连接 -先对 `Socket.send()` 打断点,但是发现存在很多位置,那如果快速找到 `Socket.send()` 发送的位置,`hook` `send()` 方法,直接快速 - +先对 `Socket.send()` 打断点,看能不能找到 `”在最早在最早在最早在”`的位置 \ No newline at end of file diff --git a/facebook私信/私信.py b/facebook私信/私信.py index 422aeef..8b324a6 100644 --- a/facebook私信/私信.py +++ b/facebook私信/私信.py @@ -1,11 +1,21 @@ import asyncio -import websockets +from aiowebsocket.converses import AioWebSocket -async def echo(websocket, path): - async for message in websocket: - message = "我收到了你的消息: {}".format(message) - await websocket.send(message) +async def startup(uri): + async with AioWebSocket(uri) as aws: + converse = aws.manipulator -asyncio.get_event_loop().run_until_complete(websockets.serve(echo, 'localhost', 8765)) -asyncio.get_event_loop().run_forever() + # 给服务端发送验证消息,观察网页接口数据动态获取 + message = '{"request_id":54,"type":3,"payload":"{\"version_id\":\"5374491402668733\",\"tasks\":[{\"label\":\"46\",\"payload\":\"{\\\"thread_id\\\":100010764288690,\\\"otid\\\":\\\"6967776862074270634\\\",\\\"source\\\":1966082,\\\"send_type\\\":1,\\\"text\\\":\\\"在最早在最早在最早在\\\",\\\"initiating_source\\\":0,\\\"skip_url_preview_gen\\\":0}\",\"queue_name\":\"100010764288690\",\"task_id\":13,\"failure_count\":null},{\"label\":\"21\",\"payload\":\"{\\\"thread_id\\\":100010764288690,\\\"last_read_watermark_ts\\\":1661247458952,\\\"sync_group\\\":1}\",\"queue_name\":\"100010764288690\",\"task_id\":14,\"failure_count\":null}],\"epoch_id\":6967776862243990774,\"data_trace_id\":\"#SHgGQS0HTdSm+u12zRK3wA\"}","app_id":"2220391788200892"}' + await converse.send(message) + + while True: + receive = await converse.receive() + # 拿到的是byte类型数据,解码为字符串数据 + print(receive.decode()) + + +if __name__ == '__main__': + remote = 'wss://edge-chat.facebook.com/chat?region=prn&sid=5144947822952447&cid=17bf7923-1b48-488f-b1c9-311faaaa6715' + asyncio.get_event_loop().run_until_complete(startup(remote)) diff --git a/img/108.png b/img/108.png new file mode 100644 index 0000000..fc0fb41 Binary files /dev/null and b/img/108.png differ diff --git a/img/109.png b/img/109.png new file mode 100644 index 0000000..f1428ed Binary files /dev/null and b/img/109.png differ diff --git a/img/110.png b/img/110.png new file mode 100644 index 0000000..e551d2f Binary files /dev/null and b/img/110.png differ