receive video

This commit is contained in:
yincong
2026-03-13 13:29:10 +08:00
parent eb4c1c2e0e
commit 42a10fb306
7 changed files with 135 additions and 18 deletions
+34 -7
View File
@@ -301,6 +301,7 @@ var uploadOnCompleteFuncAddr = baseAddr.add({{.uploadOnCompleteFuncAddr}});
var downloadImagAddr = baseAddr.add({{.downloadImagAddr}});
var startDownloadMedia = baseAddr.add({{.startDownloadMedia}})
var downloadFileAddr = baseAddr.add({{.downloadFileAddr}})
var downloadVideoAddr = baseAddr.add({{.downloadVideoAddr}})
var downloadGlobalX0;
var downloadFileX1 = ptr(0)
@@ -1313,14 +1314,15 @@ function setReceiver() {
downloadGlobalX0 = this.context.x0;
var fileIDAddr = this.context.x1.add(0x40).readPointer();
var fileId = fileIDAddr?.readUtf8String();
if (!fileId.endsWith("_1")) {
return
}
console.log(" [+] download file: ", fileId);
const t = this.context.x1.add(0xA0).readU32()
console.log(" [+] download file: ", fileId, " type", t);
if (t === 3) {
this.context.x1.add(0xA0).writeU32(0x02);
if (fileId.endsWith("_1")) {
this.context.x1.add(0xA0).writeU32(0x02);
}
if (fileId.endsWith("_31")) {
this.context.x1.add(0xA0).writeU32(0x04);
}
}
}
})
@@ -1366,6 +1368,27 @@ function setReceiver() {
}
}
});
Interceptor.attach(downloadVideoAddr, {
onEnter: function (args) {
var dataPtr = this.context.x1;
var dataLen = this.context.x2.toInt32();
var fileId = this.context.x22.add(0x40).readPointer().readUtf8String();
var cdnUrl = this.context.x22.add(0x58).readPointer().readUtf8String();
if (dataLen > 0) {
var buffer = dataPtr.readByteArray(dataLen);
var uint8Array = new Uint8Array(buffer);
send({
type: "download",
media: Array.from(uint8Array),
file_id: fileId,
cdn_url: cdnUrl,
})
}
}
});
}
setImmediate(setReceiver)
@@ -1550,8 +1573,10 @@ function getMessages(content, sender, mediaContent) {
break
}
}
} else if (content.startsWith("<msg><emoji")) {
} else if (part.startsWith("<msg><emoji")) {
messages.push({type: "face", data: {text: part}});
} else if (part.startsWith("<?xml version=\"1.0\"?><msg><videomsg")) {
messages.push({type: "video", data: {text: part}});
} else {
messages.push({type: "text", data: {text: part}});
}
@@ -1580,6 +1605,8 @@ function getMessages(content, sender, mediaContent) {
}
} else if (content.startsWith("<msg><emoji")) {
messages.push({type: "face", data: {text: content}});
} else if (content.startsWith("<?xml version=\"1.0\"?><msg><videomsg")) {
messages.push({type: "video", data: {text: content}});
} else {
messages.push({type: "text", data: {text: content}});
}