我使用如下代码,成功在手机上安装了插件.但是不知道是否运行有效。想到过要查看syslog文件,但是使用openSSH + syslogd 能时时查看嘛,不知道思路对不对。现在就是想验证这个hook是否有效运行。希望大家提供几个思路。谢谢大家!
后期是想实现监听网络通信,并能在网页上时时现实,好像是用CocoaHTTPServer 和WebSocketServer神马的可以实现,目前正在研究
CFHTTPMessageRef (*original_CFHTTPMessageCreateRequest)(CFAllocatorRef alloc,CFIndex statusCode,CFStringRef statusDescription,CFStringRef httpVersion);
CFHTTPMessageRef replaced_CFHTTPMessageCreateRequest(CFAllocatorRef alloc,CFIndex statusCode,CFStringRef statusDescription,CFStringRef httpVersion)
{
printf("http request is send\n");
//NSLog("CFHTTPMessageCreateRequest: %s",httpVersion);
NSLog(@"sss");
return original_CFHTTPMessageCreateRequest(alloc,statusCode,statusDescription,httpVersion);
}
%ctor
{
MSHookFunction((void *)CFHTTPMessageCreateRequest,(void *)replaced_CFHTTPMessageCreateRequest,(void * *)&original_CFHTTPMessageCreateRequest);
}