【问题标题】:How to block incoming SMS in iPhone jailbreak + code如何在 iPhone 越狱 + 代码中阻止传入的短信
【发布时间】:2012-04-12 11:51:07
【问题描述】:

我在问这个问题之前搜索了 SO,没有满足我需求的答案。

所以这是我的要求,

我有这段代码用于检测传入的 SMS,但它没有说明如何转储这些消息。我已成功阻止来电,但对于消息我不知道该怎么做。非常感谢这里的任何帮助。

我可以使用任何私有 API。

if ([notifyname isEqualToString:@"kCTSMSMessageReceivedNotification"])
{
    if ([[(NSDictionary *)userInfo allKeys]
         containsObject:@"kCTSMSMessage"]) // SMS Message
    {
        CTSMSMessage *message = (CTSMSMessage *)
        [(NSDictionary *)userInfo objectForKey:@"kCTSMSMessage"];
        NSString *address = CTSMSMessageCopyAddress(NULL, message);
        NSString *text = CTSMSMessageCopyText(NULL, message);
        //NSArray *lines = [text componentsSeparatedByString:@"\n"];
        printf(" %s %s\n", [address UTF8String],[text UTF8String]);
        //printf(" %s\n", [text cString]);
        fflush(stdout);

    }
}
else if ([notifyname isEqualToString:@"kCTMessageReceivedNotification"])//received SMS
{
    /*
     kCTMessageIdKey = "-2147483636″;
     kCTMessageTypeKey = 1;
     */

    NSDictionary *info = (NSDictionary *)userInfo;
    CFNumberRef msgID = (CFNumberRef)[info objectForKey:@"kCTMessageIdKey"];
    int result;
    CFNumberGetValue((CFNumberRef)msgID, kCFNumberSInt32Type, &result); 
    /*
     Class CTMessageCenter = NSClassFromString(@"CTMessageCenter");
     id mc = [CTMessageCenter sharedMessageCenter];
     id incMsg = [mc incomingMessageWithId: result];

     int msgType = (int)[incMsg messageType];

     if (msgType == 1) //experimentally detected number
     {
     id phonenumber = [incMsg sender];

     NSString *senderNumber = (NSString *)[phonenumber canonicalFormat];
     id incMsgPart = [[incMsg items] objectAtIndex:0];
     NSData *smsData = [incMsgPart data];
     NSString *smsText = [[NSString alloc] initWithData:smsData encoding:NSUTF8StringEncoding];
     }
     */
}

谢谢 纳文

【问题讨论】:

    标签: iphone sms jailbreak messages


    【解决方案1】:

    你的问题不够清楚。您是否希望将它们完全删除,以便它们甚至不会出现在消息应用程序(和数据库)中,或者您只是希望 SpringBoard 不通知用户传入消息?

    对于第一个,您必须挂钩实际发送您在代码片段中收听的通知的进程。我很确定您将不得不修补 imagent (/System/Library/PrivateFrameworks/IMCore.framework/imagent.app/imagent)。

    对于第二个,您必须在 SpringBoard 中玩耍。由于 iOS 5.0 BulletinBoard 正在处理向用户发送的通知,因此您可以在那里阻止它。 (您可能想查看 SMSBBPlugin,它是一个 BulletinBoard 插件)。

    或者只是启动你选择的反汇编程序,看看像 bitSMS 这样的调整是如何做到的;)

    请记住,越狱调整开发有时需要大量的逆向和修补,大多数人会将大部分发现留给自己。

    【讨论】:

    • 嗨@YllierDev,我正在寻找第一个,对于所选号码,我想完全拒绝短信。您能否给我更多有关如何挂钩该过程的信息或任何解释相同的链接。你是对的,他们中的大多数人都没有透露那里的调查结果:)
    • 我对 imagent 没有任何经验。您将不得不使用 MobileSubstrate 来覆盖方法或函数。 iphonedevwiki.net/index.php/MobileSubstrate 如果您不知道如何为 MobileSubstrate 编写调整,只需 google 即可。那里有很多小教程。最好将转储标头作为第一步。转储 imagent 的标头和相关的私有框架。此外,您可能需要一些倒车知识。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-01-30
    • 1970-01-01
    • 1970-01-01
    • 2013-03-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多