socket服务器

This commit is contained in:
luzhisheng 2022-03-16 17:39:43 +08:00
parent 13fe675fb6
commit fc48c8a2a6
6 changed files with 9305 additions and 5 deletions

BIN
img/61.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

BIN
img/62.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View File

@ -6,7 +6,7 @@
};
ws.onmessage = function (evt) {
console.log(window.ayf.RSA.evcrypt(evt.data))
console.log(window.ayf.RSA.evcrypt(evt.data));
};
ws.onclose = function (evt) {

File diff suppressed because it is too large Load Diff

View File

@ -46,3 +46,62 @@ websockets 地址
ws://127.0.0.1:8765
## 案例百度登陆
找到RSA加密地方
e.RSA.encrypt('111111111111111')
![debugger](../img/61.png)
将js保存到本地替换
![debugger](../img/62.png)
进行js注入
if (e.RSA && e.rsakey) {
var s = o;
!function () {
window.ayf = e;
var ws = new WebSocket("ws://127.0.0.1:9999");
ws.onopen = function (evt) {
};
ws.onmessage = function (evt) {
ws.send(window.ayf.RSA.evcrypt(evt.data))
};
ws.onclose = function (evt) {
};
}();
s.length < 128 && !e.config.safeFlag && (i.password = baidu.url.escapeSymbol(e.RSA.encrypt(s)),
i.rsakey = e.rsakey,
i.crypttype = 12)
}
python 服务端代码
import asyncio
import websockets
import time
async def echo(websocket, path):
while True:
t = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
await websocket.send(t)
msg = await websocket.recv()
print(msg)
await asyncio.sleep(10)
asyncio.get_event_loop().run_until_complete(
websockets.serve(echo, '127.0.0.1', 9999))
asyncio.get_event_loop().run_forever()

View File

@ -1,12 +1,17 @@
import asyncio
import websockets
import time
async def echo(websocket, path):
async for message in websocket:
message = "I got your message: {}".format(message)
await websocket.send(message)
while True:
t = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
await websocket.send(t)
msg = await websocket.recv()
print(msg)
await asyncio.sleep(10)
asyncio.get_event_loop().run_until_complete(websockets.serve(echo, 'localhost', 8765))
asyncio.get_event_loop().run_until_complete(
websockets.serve(echo, '127.0.0.1', 9999))
asyncio.get_event_loop().run_forever()