【问题标题】:IOS Jailbreak How do intercept SMS / Text MessagesIOS越狱如何拦截短信/短信
【发布时间】:2012-01-30 15:11:44
【问题描述】:

我目前正在尝试编写一个应用程序来拦截文本消息并根据该消息的内容做出反应。 我试图挂钩 CKSMSService 类中的_receivedMessage:(struct __CKSMSRecord *)message replace:(BOOL)replace 方法,但这似乎根本没有被调用。

有人可以告诉我我必须加入什么功能/类吗?我需要在文本消息显示并存储到数据库之前拦截它。我在 IOS 5.0.1 上。

非常感谢任何帮助。

【问题讨论】:

标签: ios sms hook jailbreak intercept


【解决方案1】:

此代码 sn-p 应该拦截 SMS 消息-您可以将其扩展为其他类型的通知。也适用于 iOS 5.0.1。但不适用于 iMessage。与 CoreTelephony 框架链接(那里有一堆私有标头,您可以对其进行分类转储)

#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");
        // Do 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);
}

【讨论】:

  • 您如何查看私有标头和类转储它们?
  • 嗨@rajagp,你知道收到通知后如何屏蔽消息吗?
  • 有没有其他方法可以做到这一点。我正在使用 Coretelephony.h 头文件。我可以使用此标头实现短信通知吗?
  • 我正在使用带有 Xcode 5 的 iOS 7.0.6。我已经实现了此代码,它会在收到短信时通知我,但不给我短信内容。
【解决方案2】:

虽然发帖人已经接受了rajagp's answer,但我很确定它并没有解决问题实际提出的问题,在 iOS 5 上。对于 iOS 5,我不再看到消息 content,尽管我确实收到了有新消息的通知。

所以,我所做的是从 SMS 数据库中获取 rajagp 的kCTMessageReceivedNotification 通知处理程序,并在其中获取use the code posted here to actually get the content of the text message

【讨论】:

    【解决方案3】:

    这仍然适用于 iOS 7,但我发现您在收到 kCTMessageReceivedNotification 通知后需要稍微延迟。否则你会错过刚刚收到的短信。我使用 0.1 秒的延迟,带有 [self performSelector .. afterDelay:0.1];

    【讨论】:

      猜你喜欢
      • 2014-08-22
      • 1970-01-01
      • 2012-01-29
      • 2011-11-24
      • 1970-01-01
      • 2011-03-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多