IOS Jailbreak How do intercept SMS / Text Messages -
i'm trying write application intercepts text messages , reacts depending on content of message. tried hook _receivedmessage:(struct __cksmsrecord *)message replace:(bool)replace
method in cksmsservice class seems not called @ all.
could please tell me function/class have hook in? need intercept text message before gets displayed , stored database. i'm on ios 5.0.1.
any appreciated.
this code snippet should intercept sms messages- can extend other kinds of notifications. work on ios 5.0.1 well. not work imessages though. link coretelephony framework (there bunch of private headers there you'd can class-dump)
#include <dlfcn.h> #define coretelpath "/system/library/privateframeworks/coretelephony.framework/coretelephony" id(*cttelephonycentergetdefault)(); void (*cttelephonycenteraddobserver) (id,id,cfnotificationcallback,nsstring*,void*,int); static void telephonyeventcallback(cfnotificationcenterref center, void *observer, cfstringref name, const void *object, cfdictionaryref userinfo) { nsstring *notifyname=(nsstring *)name; if ([notifyname isequaltostring:@"kctmessagereceivednotification"])//received sms { nslog(@" sms notification received :kctmessagereceivednotification"); // blocking here. } } -(void) registercallback { void *handle = dlopen(coretelpath, rtld_lazy); cttelephonycentergetdefault = dlsym(handle, "cttelephonycentergetdefault"); cttelephonycenteraddobserver = dlsym(handle,"cttelephonycenteraddobserver"); dlclose(handle); id ct = cttelephonycentergetdefault(); cttelephonycenteraddobserver( ct, null, telephonyeventcallback, null, null, cfnotificationsuspensionbehaviordeliverimmediately); }
Comments
Post a Comment