Ios拦截手机短信程序
- //extern id allIncomingMessages;
- //extern int incomingMessageCount;
- extern NSString* const kCTSMSMessageReceivedNotification;
- extern NSString* const kCTSMSMessageReplaceReceivedNotification;
- extern NSString* const kCTSIMSupportSIMStatusNotInserted;
- extern NSString* const kCTSIMSupportSIMStatusReady;
- //typedef struct _CTCall CTCall;
- extern NSString *CTCallCopyAddress(void*, CTCall *);
- void* CTSMSMessageSend(id server,id msg);
- typedef struct __CTSMSMessage CTSMSMessage;
- NSString *CTSMSMessageCopyAddress(void *, CTSMSMessage *);
- NSString *CTSMSMessageCopyText(void *, CTSMSMessage *);
- int CTSMSMessageGetRecordIdentifier(void * msg);
- NSString * CTSIMSupportGetSIMStatus();
- NSString * CTSIMSupportCopyMobileSubscriberIdentity();
- id CTSMSMessageCreate(void* unknow/*always 0*/,NSString* number,NSString* text);
- void * CTSMSMessageCreateReply(void* unknow/*always 0*/,void * forwardTo,NSString* text);
- id CTTelephonyCenterGetDefault(void);
- void CTTelephonyCenterAddObserver(id,id,CFNotificationCallback,NSString*,void*,int);
- void CTTelephonyCenterRemoveObserver(id,id,NSString*,void*);
- int CTSMSMessageGetUnreadCount(void);
- static void callback(CFNotificationCenterRef center,void *observer,CFStringRef name,const void *object, CFDictionaryRef userInfo){
- // NSLog(@"%@",name);
- NSString *strNotficationName=(NSString*)name;
- if ([strNotficationName isEqualToString:@"kCTMessageReceivedNotification"]) {
- int a=0;
- }
- // NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- @synchronized(nil) {
- if (!userInfo) return;
- if ([[(NSDictionary *)userInfo allKeys]
- containsObject:@"kCTMessageIdKey"]) // SMS Message
- {
- NSDictionary *info = (NSDictionary *)userInfo;
- CFNumberRef msgID = (CFNumberRef)[info objectForKey:@"kCTMessageTypeKey"];
- int result;
- CFNumberGetValue((CFNumberRef)msgID, kCFNumberSInt32Type, &result);
- Class CTTelephonyCenter=NSClassFromString(@"CTTelephonyCenter");
- Class CTMessageCenter = NSClassFromString(@"CTMessageCenter");
- id mc = [CTMessageCenter sharedMessageCenter];
- int count=[mc incomingMessageCount];
- id mcarr=[mc allIncomingMessages];
- // id incMsg =[mc incomingMessageWithId:result];
- // if (count==0) {
- // return;
- // }
- id incMsg = [[mc allIncomingMessages] objectAtIndex:0];
- 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] retain] retain];
- NSData *smsData = [[[incMsgPart data] retain] retain];
- // NSString *smsText = (NSString*)[[NSString alloc] initWithData:smsData encoding:NSASCIIStringEncoding] ;
- NSString *smsText = [NSString stringWithUTF8String:[smsData bytes]];
- NSLog(@"senderNumber = %@,text =%@",senderNumber,smsText);
- }
- }
- }
- // [pool release];
- }
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
- {
- self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
- // Override point for customization after application launch.
- self.window.backgroundColor = [UIColor whiteColor];
- [self.window makeKeyAndVisible];
- id ct = CTTelephonyCenterGetDefault();
- CTTelephonyCenterAddObserver(ct, NULL, callback, NULL, NULL, CFNotificationSuspensionBehaviorDrop);
- }
- CallTest.zip (94.6 KB)
Ios拦截手机短信程序的更多相关文章
- Atitit. 破解 拦截 绕过 网站 手机 短信 验证码 方式 v2 attilax 总结
Atitit. 破解 拦截 绕过 网站 手机 短信 验证码 方式 v2 attilax 总结 1. 验证码的前世今生11.1. 第一代验证码 图片验证码11.2. 第二代验证码 用户操作 ,比如 ...
- server宕机监控、检測、报警程序(139绑定手机短信报警)monitor_down.sh
宕机监控报警程序 一. 需求来源 宕机对运维人员来说,最痛苦了.怎样检測一台server是否还在正常执行,假设该server宕机,怎样在第一时间监測到并通知一线运维人员进行维护,最大化降低损失. ...
- atitit.破解 拦截 绕过 网站 手机 短信 验证码 之自动获取手机短信方式 attilax 总结
atitit.破解 拦截 绕过 网站 手机 短信 验证码 之自动获取手机短信方式 attilax 总结 1. 自动获取手机短信方式的原理 1 2. 调用api 1 3. ----核心代码 2 4. ...
- SNF开发平台WinForm之十二-发送手机短信功能调用-金笛-SNF快速开发平台3.3-Spring.Net.Framework
1.调用前组装参数 2.调用发送信息服务脚本 .调用前组装参数: BaseSendTaskEntity entity = new BaseSendTaskEntity(); entity.Mess ...
- 利用java实现的一个发送手机短信的小例子
今天闲来无事,在微博上看到一个关于用java实现的一个发送手机短信的程序,看了看,写的不太相信,闲的没事,把他整理下来,以后可能用得着 JAVA发送手机短信,流传有几种方法:(1)使用webservi ...
- C#简单实现发送手机短信
偶然想起,像编写一个从电脑向手机发送短信的程序,从网上查找到有三种方式:(1)使用webservice接口发送手机短信,这个可以使用sina提供的webservice进行发送,但是需要进行注册;(2) ...
- Android(java)学习笔记247:ContentProvider使用之利用ContentProvider备份和还原手机短信(掌握)
1.通过阅读系统源码我们知道: 短信的内容提供者: content://sms/ 系统短信的内容提供者的路径 2. 利用ContentProvider备份和还原手机短信: (1) ...
- JAVA发送手机短信
<p><span>JAVA发送手机短信,流传有几种方法:(1)使用webservice接口发送手机短信,这个可以使用sina提供的webservice进行发送,但是需要进行注册 ...
- Android(java)学习笔记191:ContentProvider使用之利用ContentProvider备份和还原手机短信(掌握)
1. 通过阅读系统源码我们知道: 短信的内容提供者: content://sms/ 系统短信的内容提供者的路径 2. 利用ContentProvider备份和还原手机短信: (1 ...
随机推荐
- Shell学习笔记 - 条件判断式
1. 判断格式 1) test 参数 文件 例: test -e /root/install.log 2) [ 参数 文件 ] -- 推荐使用 例: [ -e /root/install.log ] ...
- [转]Android 应用的自动升级、更新模块的实现
本文转自:http://www.oschina.net/question/163910_28462 我们看到很多Android应用都具有自动更新功能,用户一键就可以完成软件的升级更新.得益于Andro ...
- GSS7 spoj 6779. Can you answer these queries VII 树链剖分+线段树
GSS7Can you answer these queries VII 给出一棵树,树的节点有权值,有两种操作: 1.询问节点x,y的路径上最大子段和,可以为空 2.把节点x,y的路径上所有节点的权 ...
- SQL跨服务器操作语句
--简单的跨服务器查询语句 select * from opendatasource('SQLOLEDB', 'Data Source=192.168.0.1;User ID=sa;Password= ...
- HTML_创建易用的Web表单
首先创建一个表单域集合fieldset fieldset元素允许Web开发者将主题相关的表单组合在一起 <fieldset></fieldset> 要说明的是本例子中每个表单都 ...
- ASP.NET MVC 教程
http://msdn.microsoft.com/zh-cn/dd327597.aspx
- 安装包安装服务,点修复出现的错误”Error 1001:指定的服务已存在“ 解决办法
安装项目下,右键视图->自定义操作,出现安装.提交.回滚.卸载四个文件夹,右键安装,添加自定义操作,选择安装的服务为输出文件 右键安装输出文件->在condition->Not (I ...
- JQuery 动态添加onclick事件
$('#div_id').click(function(){ show(1,2,this); });
- 通信行业OSS支撑系统软件研发思考
一般的,对所谓大型.通信行业.OSS支撑软件系统,我们可宏观定义以下几点: 以年计的研发周期 以几十人计的研发团队 以百计的业务菜单功能点 以千计的数据库表 以万计的业务术语指标 以亿计的数据表记录 ...
- Java 字符流实现文件读写操作(FileReader-FileWriter)
Java 字符流实现文件读写操作(FileReader-FileWriter) 备注:字符流效率高,但是没有字节流底层 字节流地址:http://pengyan5945.iteye.com/blog/ ...