@@ -232,7 +232,7 @@ var wxOffsets = {
232
232
}
233
233
} ;
234
234
var moduleBaseAddress = Module . getBaseAddress ( 'WeChatWin.dll' ) ;
235
- // console.info ('moduleBaseAddress:', moduleBaseAddress)
235
+ // console.log ('moduleBaseAddress:', moduleBaseAddress)
236
236
/* -----------------base------------------------- */
237
237
var writeWStringPtr = function ( str ) {
238
238
console . log ( "\u8F93\u5165\u5B57\u7B26\u4E32\u5185\u5BB9: " . concat ( str ) ) ;
@@ -544,62 +544,62 @@ var getMyselfInfoFunction = function () {
544
544
out . private_key = serviceAddr . add ( 0x7D8 ) . readPointer ( ) . readUtf8String ( serviceAddr . add ( 0x7D8 + 0x10 ) . readU32 ( ) ) ;
545
545
}
546
546
}
547
- // console.info ('out:', JSON.stringify(out, null, 2))
547
+ // console.log ('out:', JSON.stringify(out, null, 2))
548
548
var myself = {
549
549
id : out . wxid ,
550
550
code : out . account ,
551
551
name : out . name ,
552
552
head_img_url : out . head_img
553
553
} ;
554
554
var myselfJson = JSON . stringify ( myself , null , 2 ) ;
555
- // console.info ('myselfJson:', myselfJson)
555
+ // console.log ('myselfJson:', myselfJson)
556
556
return myselfJson ;
557
557
} ;
558
- // console.info('myselfInfo:', getMyselfInfoFunction())
559
- // 发送文本消息
560
- /**
561
- * @Call : sendMsgNativeFunction -> agentSendMsg
562
- */
563
558
var sendMsgNativeFunction = ( function ( contactId , text ) {
564
- // console.log('\n\n');
559
+ console . log ( '\n\n' ) ;
560
+ console . log ( 'sendMsgNativeFunction contactId:' , contactId ) ;
565
561
var to_user = null ;
566
562
var text_msg = null ;
567
563
// const to_user = Memory.alloc(wxid.length * 2 + 2)
568
564
// to_user.writeUtf16String(wxid)
569
565
// to_user = new WeChatString(wxid).getMemoryAddress();
570
- // console.info ('wxid:', wxid)
566
+ // console.log ('wxid:', wxid)
571
567
to_user = writeWStringPtr ( contactId ) ;
572
- console . info ( 'to_user wxid :' , readWStringPtr ( to_user ) . readUtf16String ( ) ) ;
568
+ console . log ( 'to_user wxid :' , readWStringPtr ( to_user ) . readUtf16String ( ) ) ;
573
569
// const text_msg = Memory.alloc(msg.length * 2 + 2)
574
570
// text_msg.writeUtf16String(msg)
575
571
// text_msg = new WeChatString(msg).getMemoryAddress();
576
572
text_msg = writeWStringPtr ( text ) ;
577
- console . info ( 'text_msg msg:' , readWStringPtr ( text_msg ) . readUtf16String ( ) ) ;
573
+ console . log ( 'text_msg msg:' , readWStringPtr ( text_msg ) . readUtf16String ( ) ) ;
578
574
// console.log('\n\n');
579
575
var send_message_mgr_addr = moduleBaseAddress . add ( wxOffsets . kGetSendMessageMgr ) ;
580
576
var send_text_msg_addr = moduleBaseAddress . add ( wxOffsets . kSendTextMsg ) ;
581
577
var free_chat_msg_addr = moduleBaseAddress . add ( wxOffsets . kFreeChatMsg ) ;
578
+ console . log ( 'send_message_mgr_addr:' , send_message_mgr_addr ) ;
582
579
var chat_msg = Memory . alloc ( 0x460 * Process . pointerSize ) ; // 在frida中分配0x460字节的内存
583
580
chat_msg . writeByteArray ( Array ( 0x460 * Process . pointerSize ) . fill ( 0 ) ) ; // 清零分配的内存
581
+ console . log ( 'chat_msg:' , chat_msg ) ;
584
582
var temp = Memory . alloc ( 3 * Process . pointerSize ) ; // 分配临时数组内存
585
583
temp . writeByteArray ( Array ( 3 * Process . pointerSize ) . fill ( 0 ) ) ; // 初始化数组
584
+ console . log ( 'temp:' , temp ) ;
586
585
// 定义函数原型并实例化 NativeFunction 对象
587
586
var mgr = new NativeFunction ( send_message_mgr_addr , 'void' , [ ] ) ;
588
- var send = new NativeFunction ( send_text_msg_addr , 'uint64' , [ 'pointer' , 'pointer' , 'pointer' , 'pointer' , 'int64' , 'int64' , 'int64' , 'int64' ] ) ;
587
+ var sendMsg = new NativeFunction ( send_text_msg_addr , 'uint64' , [ 'pointer' , 'pointer' , 'pointer' , 'pointer' , 'int64' , 'int64' , 'int64' , 'int64' ] ) ;
589
588
var free = new NativeFunction ( free_chat_msg_addr , 'void' , [ 'pointer' ] ) ;
589
+ console . log ( 'mgr:' , mgr ) ;
590
590
// 调用发送消息管理器初始化
591
591
mgr ( ) ;
592
592
// 发送文本消息
593
- // console.info ('chat_msg:', chat_msg);
594
- // console.info ('to_user:', to_user);
595
- // console.info ('text_msg:', text_msg);
596
- // console.info ('temp:', temp);
597
- var success = send ( chat_msg , to_user , text_msg , temp , 1 , 1 , 0 , 0 ) ;
598
- console . info ( 'sendText success:' , success ) ;
593
+ // console.log ('chat_msg:', chat_msg);
594
+ // console.log ('to_user:', to_user);
595
+ // console.log ('text_msg:', text_msg);
596
+ // console.log ('temp:', temp);
597
+ var success = sendMsg ( chat_msg , to_user , text_msg , temp , 1 , 1 , 0 , 0 ) ;
598
+ console . log ( 'sendText success:' , success ) ;
599
599
// 释放ChatMsg内存
600
600
free ( chat_msg ) ;
601
+ console . log ( 'sendMsgNativeFunction success:' , success ) ;
601
602
} ) ;
602
- // sendMsgNativeFunction('filehelper', 'hello world')
603
603
// 接收消息回调
604
604
/**
605
605
* @Hook : recvMsg -> recvMsgNativeCallback
@@ -612,7 +612,7 @@ var recvMsgNativeCallback = (function () {
612
612
onEnter : function ( args ) {
613
613
try {
614
614
// 参数打印
615
- console . log ( "doAddMsg called with args: " + args [ 0 ] + ", " + args [ 1 ] + ", " + args [ 2 ] ) ;
615
+ // console.log("doAddMsg called with args: " + args[0] + ", " + args[1] + ", " + args[2]);
616
616
// 调用处理函数
617
617
var msg = HandleSyncMsg ( args [ 0 ] , args [ 1 ] , args [ 2 ] ) ;
618
618
// console.log("msg: " + JSON.stringify(msg, null, 2));
@@ -642,9 +642,6 @@ var recvMsgNativeCallback = (function () {
642
642
talkerId = msg . fromUser ;
643
643
content = msg . content ;
644
644
}
645
- if ( content === 'ding' ) {
646
- sendMsgNativeFunction ( talkerId , 'dong' ) ;
647
- }
648
645
var myContentPtr_1 = Memory . alloc ( content . length * 2 + 1 ) ;
649
646
myContentPtr_1 . writeUtf16String ( content ) ;
650
647
var myTalkerIdPtr_1 = Memory . alloc ( talkerId . length * 2 + 1 ) ;
@@ -667,7 +664,7 @@ var recvMsgNativeCallback = (function () {
667
664
}
668
665
catch ( e ) {
669
666
console . error ( '接收消息回调失败:' , e ) ;
670
- throw new Error ( e ) ;
667
+ // throw new Error(e)
671
668
}
672
669
}
673
670
} ) ;
@@ -678,3 +675,11 @@ var recvMsgNativeCallback = (function () {
678
675
return null ;
679
676
}
680
677
} ) ( ) ;
678
+ rpc . exports = {
679
+ sendMsgNativeFunction : function ( contactId , text ) {
680
+ return sendMsgNativeFunction ( contactId , text ) ;
681
+ } ,
682
+ getMyselfInfoFunction : function ( ) {
683
+ return getMyselfInfoFunction ( ) ;
684
+ }
685
+ } ;
0 commit comments